@razorpay/blade 12.27.0 → 12.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ import '../Typography/Display/Display.js';
24
24
  import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
25
25
  import { jsx, jsxs } from 'react/jsx-runtime';
26
26
 
27
- var _excluded=["value","suffix","type","size","weight","isAffixSubtle","isStrikethrough","color","currencyIndicator","currency","testID"];var stripTrailingZerosFromParts=function stripTrailingZerosFromParts(parts){var decimalPart=parts.rawParts.filter(function(_ref){var type=_ref.type;return type==='fraction';}).map(function(_ref2){var value=_ref2.value;return value;}).join('');var hasFraction=parts.rawParts.some(function(_ref3){var type=_ref3.type;return type==='fraction';});if(hasFraction&&/^0+$/.test(decimalPart)){delete parts.decimal;delete parts.fraction;parts.rawParts=parts.rawParts.filter(function(_ref4){var type=_ref4.type;return type!=='decimal'&&type!=='fraction';});}return parts;};var pollyfilledFormatNumberByParts=function pollyfilledFormatNumberByParts(value,options){var _options$intlOptions;var parts=formatNumberByParts(value,options);if((options==null?void 0:(_options$intlOptions=options.intlOptions)==null?void 0:_options$intlOptions.trailingZeroDisplay)==='stripIfInteger'){return stripTrailingZerosFromParts(parts);}return parts;};var getTextColorProps=function getTextColorProps(_ref5){var color=_ref5.color;var props={amountValueColor:'surface.text.gray.normal'};if(!color)return props;props.amountValueColor=color;return props;};var AmountValue=function AmountValue(_ref6){var amount=_ref6.amount,_ref6$size=_ref6.size,size=_ref6$size===void 0?'medium':_ref6$size,_ref6$type=_ref6.type,type=_ref6$type===void 0?'body':_ref6$type,_ref6$weight=_ref6.weight,weight=_ref6$weight===void 0?'regular':_ref6$weight,amountValueColor=_ref6.amountValueColor,isAffixSubtle=_ref6.isAffixSubtle,suffix=_ref6.suffix;var isReactNative=getPlatformType()==='react-native';var affixFontSize=isAffixSubtle?subtleFontSizes[type][size]:normalAmountSizes[type][size];var numberFontFamily=type==='body'?'text':'heading';if(suffix==='decimals'&&isAffixSubtle){var AmountWrapper=isReactNative?Text:React__default.Fragment;return jsxs(AmountWrapper,{children:[jsx(BaseText,{fontSize:normalAmountSizes[type][size],fontWeight:weight,lineHeight:amountLineHeights[type][size],color:amountValueColor,fontFamily:numberFontFamily,as:isReactNative?undefined:'span',children:amount.integer}),jsxs(BaseText,{fontWeight:weight,fontSize:affixFontSize,fontFamily:numberFontFamily,color:amountValueColor,as:isReactNative?undefined:'span',opacity:isAffixSubtle?opacity[800]:1,children:[amount.decimal,amount.fraction]})]});}return jsxs(BaseText,{fontSize:normalAmountSizes[type][size],fontWeight:weight,fontFamily:numberFontFamily,color:amountValueColor,lineHeight:amountLineHeights[type][size],children:[amount.integer,amount.decimal,amount.fraction,amount.compact]});};var getAmountByParts=function getAmountByParts(_ref7){var suffix=_ref7.suffix,value=_ref7.value,currency=_ref7.currency;try{switch(suffix){case'decimals':{var options={intlOptions:{maximumFractionDigits:2,minimumFractionDigits:2},currency:currency};return pollyfilledFormatNumberByParts(value,options);}case'humanize':{var _options={intlOptions:{notation:'compact',maximumFractionDigits:2,trailingZeroDisplay:'stripIfInteger'},currency:currency};return pollyfilledFormatNumberByParts(value,_options);}default:{var _options2={intlOptions:{maximumFractionDigits:0,roundingMode:'floor'},currency:currency};return pollyfilledFormatNumberByParts(value,_options2);}}}catch(err){return {integer:`${value}`,currency:currency};}};var _Amount=function _Amount(_ref8,ref){var _renderedValue$isPref,_renderedValue$curren;var value=_ref8.value,_ref8$suffix=_ref8.suffix,suffix=_ref8$suffix===void 0?'decimals':_ref8$suffix,_ref8$type=_ref8.type,type=_ref8$type===void 0?'body':_ref8$type,_ref8$size=_ref8.size,size=_ref8$size===void 0?'medium':_ref8$size,_ref8$weight=_ref8.weight,weight=_ref8$weight===void 0?'regular':_ref8$weight,_ref8$isAffixSubtle=_ref8.isAffixSubtle,isAffixSubtle=_ref8$isAffixSubtle===void 0?true:_ref8$isAffixSubtle,_ref8$isStrikethrough=_ref8.isStrikethrough,isStrikethrough=_ref8$isStrikethrough===void 0?false:_ref8$isStrikethrough,color=_ref8.color,_ref8$currencyIndicat=_ref8.currencyIndicator,currencyIndicator=_ref8$currencyIndicat===void 0?'currency-symbol':_ref8$currencyIndicat,_ref8$currency=_ref8.currency,currency=_ref8$currency===void 0?'INR':_ref8$currency,testID=_ref8.testID,rest=_objectWithoutProperties(_ref8,_excluded);if(__DEV__){if(typeof value!=='number'){throwBladeError({message:'`value` prop must be of type `number` for Amount.',moduleName:'Amount'});}if(color==='neutral'){throwBladeError({message:'`neutral` color is not supported.',moduleName:'Amount'});}var bodySizes=objectKeysWithType(normalAmountSizes.body);if((type==='body'||!type)&&!bodySizes.includes(size)){throwBladeError({message:`size="${size}" is not allowed with type="body"`,moduleName:'Amount'});}var displaySizes=objectKeysWithType(normalAmountSizes.display);if(type==='display'&&!displaySizes.includes(size)){throwBladeError({message:`size="${size}" is not allowed with type="display"`,moduleName:'Amount'});}var headingSizes=objectKeysWithType(normalAmountSizes.heading);if(type==='heading'&&!headingSizes.includes(size)){throwBladeError({message:`size="${size}" is not allowed with type="heading"`,moduleName:'Amount'});}}var _getTextColorProps=getTextColorProps({color:color}),amountValueColor=_getTextColorProps.amountValueColor;var renderedValue=getAmountByParts({suffix:suffix,value:value,currency:currency});var isPrefixSymbol=(_renderedValue$isPref=renderedValue.isPrefixSymbol)!=null?_renderedValue$isPref:true;var currencySymbol=(_renderedValue$curren=renderedValue.currency)!=null?_renderedValue$curren:currency;var currencyPosition=isPrefixSymbol?'left':'right';var currencySymbolOrCode=currencyIndicator==='currency-symbol'?currencySymbol:currency;var currencyFontSize=isAffixSubtle?subtleFontSizes[type][size]:normalAmountSizes[type][size];var isReactNative=getPlatformType()==='react-native';return jsx(BaseBox,Object.assign({ref:ref,display:isReactNative?'flex':'inline-flex',flexDirection:"row"},metaAttribute({name:MetaConstants.Amount,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{children:jsxs(BaseBox,{display:isReactNative?'flex':'inline-flex',alignItems:"baseline",flexDirection:"row",position:"relative",children:[renderedValue.minusSign?jsx(BaseText,{fontSize:normalAmountSizes[type][size],fontWeight:weight,lineHeight:amountLineHeights[type][size],color:amountValueColor,as:isReactNative?undefined:'span',marginX:"spacing.2",children:renderedValue.minusSign}):null,currencyPosition==='left'&&jsx(BaseText,{marginRight:"spacing.1",fontWeight:weight,fontSize:currencyFontSize,color:amountValueColor,as:isReactNative?undefined:'span',opacity:isAffixSubtle?opacity[800]:1,children:currencySymbolOrCode}),jsx(AmountValue,{amount:renderedValue,amountValueColor:amountValueColor,type:type,weight:weight,size:size,isAffixSubtle:isAffixSubtle,suffix:suffix,currency:currency}),currencyPosition==='right'&&jsx(BaseText,{marginLeft:"spacing.1",fontWeight:weight,fontSize:currencyFontSize,color:amountValueColor,as:isReactNative?undefined:'span',opacity:isAffixSubtle?opacity[800]:1,children:currencySymbolOrCode}),isStrikethrough&&jsx(BaseBox,{borderBottomColor:amountValueColor,borderBottomWidth:type==='body'?'thin':'thicker',borderBottomStyle:"solid",position:"absolute",width:"100%",top:"50%"})]})}));};var Amount=assignWithoutSideEffects(React__default.forwardRef(_Amount),{displayName:'Amount',componentId:'Amount'});
27
+ var _excluded=["value","suffix","type","size","weight","isAffixSubtle","isStrikethrough","color","currencyIndicator","currency","fractionDigits","testID"];var stripTrailingZerosFromParts=function stripTrailingZerosFromParts(parts){var decimalPart=parts.rawParts.filter(function(_ref){var type=_ref.type;return type==='fraction';}).map(function(_ref2){var value=_ref2.value;return value;}).join('');var hasFraction=parts.rawParts.some(function(_ref3){var type=_ref3.type;return type==='fraction';});if(hasFraction&&/^0+$/.test(decimalPart)){delete parts.decimal;delete parts.fraction;parts.rawParts=parts.rawParts.filter(function(_ref4){var type=_ref4.type;return type!=='decimal'&&type!=='fraction';});}return parts;};var pollyfilledFormatNumberByParts=function pollyfilledFormatNumberByParts(value,options){var _options$intlOptions;var parts=formatNumberByParts(value,options);if((options==null?void 0:(_options$intlOptions=options.intlOptions)==null?void 0:_options$intlOptions.trailingZeroDisplay)==='stripIfInteger'){return stripTrailingZerosFromParts(parts);}return parts;};var getTextColorProps=function getTextColorProps(_ref5){var color=_ref5.color;var props={amountValueColor:'surface.text.gray.normal'};if(!color)return props;props.amountValueColor=color;return props;};var AmountValue=function AmountValue(_ref6){var amount=_ref6.amount,_ref6$size=_ref6.size,size=_ref6$size===void 0?'medium':_ref6$size,_ref6$type=_ref6.type,type=_ref6$type===void 0?'body':_ref6$type,_ref6$weight=_ref6.weight,weight=_ref6$weight===void 0?'regular':_ref6$weight,amountValueColor=_ref6.amountValueColor,isAffixSubtle=_ref6.isAffixSubtle,suffix=_ref6.suffix;var isReactNative=getPlatformType()==='react-native';var affixFontSize=isAffixSubtle?subtleFontSizes[type][size]:normalAmountSizes[type][size];var numberFontFamily=type==='body'?'text':'heading';if(suffix==='decimals'&&isAffixSubtle){var AmountWrapper=isReactNative?Text:React__default.Fragment;return jsxs(AmountWrapper,{children:[jsx(BaseText,{fontSize:normalAmountSizes[type][size],fontWeight:weight,lineHeight:amountLineHeights[type][size],color:amountValueColor,fontFamily:numberFontFamily,as:isReactNative?undefined:'span',children:amount.integer}),jsxs(BaseText,{fontWeight:weight,fontSize:affixFontSize,fontFamily:numberFontFamily,color:amountValueColor,as:isReactNative?undefined:'span',opacity:isAffixSubtle?opacity[800]:1,children:[amount.decimal,amount.fraction]})]});}return jsxs(BaseText,{fontSize:normalAmountSizes[type][size],fontWeight:weight,fontFamily:numberFontFamily,color:amountValueColor,lineHeight:amountLineHeights[type][size],children:[amount.integer,amount.decimal,amount.fraction,amount.compact]});};var getAmountByParts=function getAmountByParts(_ref7){var suffix=_ref7.suffix,value=_ref7.value,currency=_ref7.currency,_ref7$fractionDigits=_ref7.fractionDigits,fractionDigits=_ref7$fractionDigits===void 0?2:_ref7$fractionDigits;try{switch(suffix){case'decimals':{var options={intlOptions:{maximumFractionDigits:fractionDigits,minimumFractionDigits:fractionDigits},currency:currency};return pollyfilledFormatNumberByParts(value,options);}case'humanize':{var _options={intlOptions:{notation:'compact',maximumFractionDigits:2,trailingZeroDisplay:'stripIfInteger'},currency:currency};return pollyfilledFormatNumberByParts(value,_options);}default:{var _options2={intlOptions:{maximumFractionDigits:0,roundingMode:'floor'},currency:currency};return pollyfilledFormatNumberByParts(value,_options2);}}}catch(err){return {integer:`${value}`,currency:currency};}};var _Amount=function _Amount(_ref8,ref){var _renderedValue$isPref,_renderedValue$curren;var value=_ref8.value,_ref8$suffix=_ref8.suffix,suffix=_ref8$suffix===void 0?'decimals':_ref8$suffix,_ref8$type=_ref8.type,type=_ref8$type===void 0?'body':_ref8$type,_ref8$size=_ref8.size,size=_ref8$size===void 0?'medium':_ref8$size,_ref8$weight=_ref8.weight,weight=_ref8$weight===void 0?'regular':_ref8$weight,_ref8$isAffixSubtle=_ref8.isAffixSubtle,isAffixSubtle=_ref8$isAffixSubtle===void 0?true:_ref8$isAffixSubtle,_ref8$isStrikethrough=_ref8.isStrikethrough,isStrikethrough=_ref8$isStrikethrough===void 0?false:_ref8$isStrikethrough,color=_ref8.color,_ref8$currencyIndicat=_ref8.currencyIndicator,currencyIndicator=_ref8$currencyIndicat===void 0?'currency-symbol':_ref8$currencyIndicat,_ref8$currency=_ref8.currency,currency=_ref8$currency===void 0?'INR':_ref8$currency,_ref8$fractionDigits=_ref8.fractionDigits,fractionDigits=_ref8$fractionDigits===void 0?2:_ref8$fractionDigits,testID=_ref8.testID,rest=_objectWithoutProperties(_ref8,_excluded);if(__DEV__){if(typeof value!=='number'){throwBladeError({message:'`value` prop must be of type `number` for Amount.',moduleName:'Amount'});}if(color==='neutral'){throwBladeError({message:'`neutral` color is not supported.',moduleName:'Amount'});}var bodySizes=objectKeysWithType(normalAmountSizes.body);if((type==='body'||!type)&&!bodySizes.includes(size)){throwBladeError({message:`size="${size}" is not allowed with type="body"`,moduleName:'Amount'});}var displaySizes=objectKeysWithType(normalAmountSizes.display);if(type==='display'&&!displaySizes.includes(size)){throwBladeError({message:`size="${size}" is not allowed with type="display"`,moduleName:'Amount'});}var headingSizes=objectKeysWithType(normalAmountSizes.heading);if(type==='heading'&&!headingSizes.includes(size)){throwBladeError({message:`size="${size}" is not allowed with type="heading"`,moduleName:'Amount'});}}var _getTextColorProps=getTextColorProps({color:color}),amountValueColor=_getTextColorProps.amountValueColor;var renderedValue=getAmountByParts({suffix:suffix,value:value,currency:currency,fractionDigits:fractionDigits});var isPrefixSymbol=(_renderedValue$isPref=renderedValue.isPrefixSymbol)!=null?_renderedValue$isPref:true;var currencySymbol=(_renderedValue$curren=renderedValue.currency)!=null?_renderedValue$curren:currency;var currencyPosition=isPrefixSymbol?'left':'right';var currencySymbolOrCode=currencyIndicator==='currency-symbol'?currencySymbol:currency;var currencyFontSize=isAffixSubtle?subtleFontSizes[type][size]:normalAmountSizes[type][size];var isReactNative=getPlatformType()==='react-native';return jsx(BaseBox,Object.assign({ref:ref,display:isReactNative?'flex':'inline-flex',flexDirection:"row"},metaAttribute({name:MetaConstants.Amount,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{children:jsxs(BaseBox,{display:isReactNative?'flex':'inline-flex',alignItems:"baseline",flexDirection:"row",position:"relative",children:[renderedValue.minusSign?jsx(BaseText,{fontSize:normalAmountSizes[type][size],fontWeight:weight,lineHeight:amountLineHeights[type][size],color:amountValueColor,as:isReactNative?undefined:'span',marginX:"spacing.2",children:renderedValue.minusSign}):null,currencyPosition==='left'&&jsx(BaseText,{marginRight:"spacing.1",fontWeight:weight,fontSize:currencyFontSize,color:amountValueColor,as:isReactNative?undefined:'span',opacity:isAffixSubtle?opacity[800]:1,children:currencySymbolOrCode}),jsx(AmountValue,{amount:renderedValue,amountValueColor:amountValueColor,type:type,weight:weight,size:size,isAffixSubtle:isAffixSubtle,suffix:suffix,currency:currency}),currencyPosition==='right'&&jsx(BaseText,{marginLeft:"spacing.1",fontWeight:weight,fontSize:currencyFontSize,color:amountValueColor,as:isReactNative?undefined:'span',opacity:isAffixSubtle?opacity[800]:1,children:currencySymbolOrCode}),isStrikethrough&&jsx(BaseBox,{borderBottomColor:amountValueColor,borderBottomWidth:type==='body'?'thin':'thicker',borderBottomStyle:"solid",position:"absolute",width:"100%",top:"50%"})]})}));};var Amount=assignWithoutSideEffects(React__default.forwardRef(_Amount),{displayName:'Amount',componentId:'Amount'});
28
28
 
29
29
  export { Amount, getAmountByParts };
30
30
  //# sourceMappingURL=Amount.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Amount.js","sources":["../../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport type { CurrencyCodeType } from '@razorpay/i18nify-js/currency';\nimport { formatNumberByParts } from '@razorpay/i18nify-js/currency';\nimport type { AmountTypeProps } from './amountTokens';\nimport { normalAmountSizes, subtleFontSizes, amountLineHeights } from './amountTokens';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { DataAnalyticsAttribute, BladeElementRef, TestID } from '~utils/types';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { objectKeysWithType } from '~utils/objectKeysWithType';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { Text } from '~components/Typography';\nimport { opacity } from '~tokens/global';\nimport type { FontFamily } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\n/**\n * Pollyfill function to get around the node 18 error\n *\n * This function is maintained by i18nify team. Reach out to them for any change regarding this.\n */\nconst stripTrailingZerosFromParts = (\n parts: ReturnType<typeof formatNumberByParts>,\n): ReturnType<typeof formatNumberByParts> => {\n const decimalPart = parts.rawParts\n .filter(({ type }) => type === 'fraction')\n .map(({ value }) => value)\n .join('');\n\n const hasFraction = parts.rawParts.some(({ type }) => type === 'fraction');\n\n if (hasFraction && /^0+$/.test(decimalPart)) {\n delete parts.decimal;\n delete parts.fraction;\n parts.rawParts = parts.rawParts.filter(({ type }) => type !== 'decimal' && type !== 'fraction');\n }\n\n return parts;\n};\n\n/**\n * Wrapper that uses pollyfill of i18nify team\n */\nconst pollyfilledFormatNumberByParts: typeof formatNumberByParts = (value, options) => {\n const parts = formatNumberByParts(value, options);\n\n if (options?.intlOptions?.trailingZeroDisplay === 'stripIfInteger') {\n return stripTrailingZerosFromParts(parts);\n }\n\n return parts;\n};\n\ntype AmountCommonProps = {\n /**\n * The value to be rendered within the component.\n *\n */\n value: number;\n /**\n * Sets the color of the amount.\n *\n * @default undefined\n */\n color?: BaseTextProps['color'];\n /**\n * Indicates what the suffix of amount should be\n *\n * @default 'decimals'\n */\n suffix?: 'decimals' | 'none' | 'humanize';\n /**\n * Makes the currency indicator(currency symbol/code) and decimal digits small and faded\n *\n * @default true\n */\n isAffixSubtle?: true | false;\n /**\n * Determines the visual representation of the currency, choose between displaying the currency symbol or code.\n *\n * Note: Currency symbol and code is determined by the locale set in user's browser or set via @razorpay/i18nify-react library.\n *\n * @default 'currency-symbol'\n */\n currencyIndicator?: 'currency-symbol' | 'currency-code';\n /**\n * The currency of the amount. Note that this component\n * only displays the provided value in the specified currency, it does not perform any currency conversion.\n *\n * @default 'INR'\n * */\n currency?: CurrencyCodeType;\n /**\n * If true, the amount text will have a line through it.\n *\n * @default false\n */\n isStrikethrough?: boolean;\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\ntype ColorProps = {\n amountValueColor: BaseTextProps['color'];\n};\n\ntype AmountProps = AmountTypeProps & AmountCommonProps;\n\nconst getTextColorProps = ({ color }: { color: AmountProps['color'] }): ColorProps => {\n const props: ColorProps = {\n amountValueColor: 'surface.text.gray.normal',\n };\n if (!color) return props;\n props.amountValueColor = color;\n return props;\n};\n\ntype AmountType = Partial<ReturnType<typeof formatNumberByParts>>;\n\ninterface AmountValue extends Omit<AmountProps, 'value'> {\n amountValueColor: BaseTextProps['color'];\n amount: AmountType;\n size: Exclude<AmountProps['size'], undefined>;\n}\n\nconst AmountValue = ({\n amount,\n size = 'medium',\n type = 'body',\n weight = 'regular',\n amountValueColor,\n isAffixSubtle,\n suffix,\n}: AmountValue): ReactElement => {\n const isReactNative = getPlatformType() === 'react-native';\n const affixFontSize = isAffixSubtle ? subtleFontSizes[type][size] : normalAmountSizes[type][size];\n const numberFontFamily: keyof FontFamily = type === 'body' ? 'text' : 'heading';\n if (suffix === 'decimals' && isAffixSubtle) {\n // Native does not support alignItems of Text inside a div, instead we need to wrap is in a Text\n const AmountWrapper = isReactNative ? Text : React.Fragment;\n\n return (\n <AmountWrapper>\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n fontFamily={numberFontFamily}\n as={isReactNative ? undefined : 'span'}\n >\n {amount.integer}\n </BaseText>\n <BaseText\n fontWeight={weight}\n fontSize={affixFontSize}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {amount.decimal}\n {amount.fraction}\n </BaseText>\n </AmountWrapper>\n );\n }\n\n return (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n lineHeight={amountLineHeights[type][size]}\n >\n {amount.integer}\n {amount.decimal}\n {amount.fraction}\n {amount.compact}\n </BaseText>\n );\n};\n\ntype FormatAmountWithSuffixType = {\n suffix: AmountProps['suffix'];\n value: number;\n currency: AmountProps['currency'];\n};\n\n/**\n * Returns a parsed object based on the suffix passed in parameters\n * === Logic ===\n * value = 12500.45 \n * if suffix === 'decimals' => {\n \"integer\": \"12,500\",\n \"decimal\": \".\",\n \"fraction\": \"45\",\n \"compact\": \"K\",\n \"isPrefixSymbol\": false,\n \"rawParts\": [{\"type\": \"integer\",\"value\": \"12\"},{\"type\": \"group\",\"value\": \",\"},{\"type\": \"integer\",\"value\": \"500\"},{\"type\": \"decimal\",\"value\": \".\"},{\"type\": \"fraction\",\"value\": \"45\"}]\n}\n * @returns {AmountType}\n */\nexport const getAmountByParts = ({\n suffix,\n value,\n currency,\n}: FormatAmountWithSuffixType): AmountType => {\n try {\n switch (suffix) {\n case 'decimals': {\n const options = {\n intlOptions: {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n case 'humanize': {\n const options = {\n intlOptions: {\n notation: 'compact',\n maximumFractionDigits: 2,\n trailingZeroDisplay: 'stripIfInteger',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n\n default: {\n const options = {\n intlOptions: {\n maximumFractionDigits: 0,\n roundingMode: 'floor',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n }\n } catch (err: unknown) {\n return {\n integer: `${value}`,\n currency,\n };\n }\n};\n\nconst _Amount = (\n {\n value,\n suffix = 'decimals',\n type = 'body',\n size = 'medium',\n weight = 'regular',\n isAffixSubtle = true,\n isStrikethrough = false,\n color,\n currencyIndicator = 'currency-symbol',\n currency = 'INR',\n testID,\n ...rest\n }: AmountProps,\n ref: React.Ref<BladeElementRef>,\n): ReactElement => {\n if (__DEV__) {\n if (typeof value !== 'number') {\n throwBladeError({\n message: '`value` prop must be of type `number` for Amount.',\n moduleName: 'Amount',\n });\n }\n // @ts-expect-error neutral color should throw error\n if (color === 'neutral') {\n throwBladeError({\n message: '`neutral` color is not supported.',\n moduleName: 'Amount',\n });\n }\n\n const bodySizes = objectKeysWithType(normalAmountSizes.body);\n if ((type === 'body' || !type) && !bodySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"body\"`,\n moduleName: 'Amount',\n });\n }\n\n const displaySizes = objectKeysWithType(normalAmountSizes.display);\n if (type === 'display' && !displaySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"display\"`,\n moduleName: 'Amount',\n });\n }\n\n const headingSizes = objectKeysWithType(normalAmountSizes.heading);\n if (type === 'heading' && !headingSizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"heading\"`,\n moduleName: 'Amount',\n });\n }\n }\n\n const { amountValueColor } = getTextColorProps({\n color,\n });\n\n const renderedValue = getAmountByParts({ suffix, value, currency });\n const isPrefixSymbol = renderedValue.isPrefixSymbol ?? true;\n const currencySymbol = renderedValue.currency ?? currency;\n\n const currencyPosition = isPrefixSymbol ? 'left' : 'right';\n const currencySymbolOrCode = currencyIndicator === 'currency-symbol' ? currencySymbol : currency;\n\n const currencyFontSize = isAffixSubtle\n ? subtleFontSizes[type][size]\n : normalAmountSizes[type][size];\n const isReactNative = getPlatformType() === 'react-native';\n\n return (\n <BaseBox\n ref={ref as never}\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n flexDirection=\"row\"\n {...metaAttribute({ name: MetaConstants.Amount, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n alignItems=\"baseline\"\n flexDirection=\"row\"\n position=\"relative\"\n >\n {renderedValue.minusSign ? (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n marginX=\"spacing.2\"\n >\n {renderedValue.minusSign}\n </BaseText>\n ) : null}\n {currencyPosition === 'left' && (\n <BaseText\n marginRight=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n <AmountValue\n amount={renderedValue}\n amountValueColor={amountValueColor}\n type={type}\n weight={weight}\n size={size}\n isAffixSubtle={isAffixSubtle}\n suffix={suffix}\n currency={currency}\n />\n {currencyPosition === 'right' && (\n <BaseText\n marginLeft=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n {isStrikethrough && (\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: the borderBottomColor error below is thrown here as well\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore- intentionally setting the border color to the color prop for this hacky strikethrough\n borderBottomColor={amountValueColor}\n borderBottomWidth={type === 'body' ? 'thin' : 'thicker'}\n borderBottomStyle=\"solid\"\n position=\"absolute\"\n width=\"100%\"\n top=\"50%\"\n />\n )}\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst Amount = assignWithoutSideEffects(React.forwardRef(_Amount), {\n displayName: 'Amount',\n componentId: 'Amount',\n});\n\nexport type { AmountProps };\nexport { Amount };\n"],"names":["stripTrailingZerosFromParts","parts","decimalPart","rawParts","filter","_ref","type","map","_ref2","value","join","hasFraction","some","_ref3","test","decimal","fraction","_ref4","pollyfilledFormatNumberByParts","options","_options$intlOptions","formatNumberByParts","intlOptions","trailingZeroDisplay","getTextColorProps","_ref5","color","props","amountValueColor","AmountValue","_ref6","amount","_ref6$size","size","_ref6$type","_ref6$weight","weight","isAffixSubtle","suffix","isReactNative","getPlatformType","affixFontSize","subtleFontSizes","normalAmountSizes","numberFontFamily","AmountWrapper","Text","React","Fragment","_jsxs","children","_jsx","BaseText","fontSize","fontWeight","lineHeight","amountLineHeights","fontFamily","as","undefined","integer","opacity","compact","getAmountByParts","_ref7","currency","maximumFractionDigits","minimumFractionDigits","notation","roundingMode","err","_Amount","_ref8","ref","_renderedValue$isPref","_renderedValue$curren","_ref8$suffix","_ref8$type","_ref8$size","_ref8$weight","_ref8$isAffixSubtle","_ref8$isStrikethrough","isStrikethrough","_ref8$currencyIndicat","currencyIndicator","_ref8$currency","testID","rest","_objectWithoutProperties","_excluded","__DEV__","throwBladeError","message","moduleName","bodySizes","objectKeysWithType","body","includes","displaySizes","display","headingSizes","heading","_getTextColorProps","renderedValue","isPrefixSymbol","currencySymbol","currencyPosition","currencySymbolOrCode","currencyFontSize","BaseBox","Object","assign","flexDirection","metaAttribute","name","MetaConstants","Amount","getStyledProps","makeAnalyticsAttribute","alignItems","position","minusSign","marginX","marginRight","marginLeft","borderBottomColor","borderBottomWidth","borderBottomStyle","width","top","assignWithoutSideEffects","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;0IA2BA,IAAMA,2BAA2B,CAAG,SAA9BA,2BAA2BA,CAC/BC,KAA6C,CACF,CAC3C,IAAMC,WAAW,CAAGD,KAAK,CAACE,QAAQ,CAC/BC,MAAM,CAAC,SAAAC,IAAA,CAAG,CAAA,IAAAC,IAAI,CAAAD,IAAA,CAAJC,IAAI,CAAA,OAAOA,IAAI,GAAK,UAAU,GAAC,CACzCC,GAAG,CAAC,SAAAC,KAAA,MAAGC,KAAK,CAAAD,KAAA,CAALC,KAAK,CAAO,OAAAA,KAAK,CAAC,CAAA,CAAA,CACzBC,IAAI,CAAC,EAAE,CAAC,CAEX,IAAMC,WAAW,CAAGV,KAAK,CAACE,QAAQ,CAACS,IAAI,CAAC,SAAAC,KAAA,CAAG,CAAA,IAAAP,IAAI,CAAAO,KAAA,CAAJP,IAAI,CAAA,OAAOA,IAAI,GAAK,UAAU,CAAA,CAAA,CAAC,CAE1E,GAAIK,WAAW,EAAI,MAAM,CAACG,IAAI,CAACZ,WAAW,CAAC,CAAE,CAC3C,OAAOD,KAAK,CAACc,OAAO,CACpB,OAAOd,KAAK,CAACe,QAAQ,CACrBf,KAAK,CAACE,QAAQ,CAAGF,KAAK,CAACE,QAAQ,CAACC,MAAM,CAAC,SAAAa,KAA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AgB,CAAEA,gBAAiB,CACnCtB,IAAI,CAAEA,IAAK,CACX8B,MAAM,CAAEA,MAAO,CACfH,IAAI,CAAEA,IAAK,CACXI,aAAa,CAAEA,aAAc,CAC7BC,MAAM,CAAEA,MAAO,CACf2B,QAAQ,CAAEA,QAAS,CACpB,CAAC,CACDyC,gBAAgB,GAAK,OAAO,EAC3BvD,GAAA,CAACC,QAAQ,EACPwE,UAAU,CAAC,WAAW,CACtBtE,UAAU,CAAElB,MAAO,CACnBiB,QAAQ,CAAEuD,gBAAiB,CAC3BlF,KAAK,CAAEE,gBAAiB,CACxB8B,EAAE,CAAEnB,aAAa,CAAGoB,SAAS,CAAG,MAAO,CACvCE,OAAO,CAAExB,aAAa,CAAGwB,OAAO,CAAC,GAAG,CAAC,CAAG,CAAE,CAAAX,QAAA,CAEzCyD,oBAAoB,CACb,CACX,CACAzB,eAAe,EAGd/B,GAAA,CAAC0D,OAAO,EAGNgB,iBAAiB,CAAEjG,gBAAiB,CACpCkG,iBAAiB,CAAExH,IAAI,GAAK,MAAM,CAAG,MAAM,CAAG,SAAU,CACxDyH,iBAAiB,CAAC,OAAO,CACzBP,QAAQ,CAAC,UAAU,CACnBQ,KAAK,CAAC,MAAM,CACZC,GAAG,CAAC,KAAK,CACV,CACF,CACM,CAAA,CAAC,EACH,CAAC,CAEd,CAAC,CAEK,IAAAb,MAAM,CAAGc,wBAAwB,CAACnF,cAAK,CAACoF,UAAU,CAAC5D,OAAO,CAAC,CAAE,CACjE6D,WAAW,CAAE,QAAQ,CACrBC,WAAW,CAAE,QACf,CAAC;;;;"}
1
+ {"version":3,"file":"Amount.js","sources":["../../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport type { CurrencyCodeType } from '@razorpay/i18nify-js/currency';\nimport { formatNumberByParts } from '@razorpay/i18nify-js/currency';\nimport type { AmountTypeProps } from './amountTokens';\nimport { normalAmountSizes, subtleFontSizes, amountLineHeights } from './amountTokens';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { DataAnalyticsAttribute, BladeElementRef, TestID } from '~utils/types';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { objectKeysWithType } from '~utils/objectKeysWithType';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { Text } from '~components/Typography';\nimport { opacity } from '~tokens/global';\nimport type { FontFamily } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\n/**\n * Pollyfill function to get around the node 18 error\n *\n * This function is maintained by i18nify team. Reach out to them for any change regarding this.\n */\nconst stripTrailingZerosFromParts = (\n parts: ReturnType<typeof formatNumberByParts>,\n): ReturnType<typeof formatNumberByParts> => {\n const decimalPart = parts.rawParts\n .filter(({ type }) => type === 'fraction')\n .map(({ value }) => value)\n .join('');\n\n const hasFraction = parts.rawParts.some(({ type }) => type === 'fraction');\n\n if (hasFraction && /^0+$/.test(decimalPart)) {\n delete parts.decimal;\n delete parts.fraction;\n parts.rawParts = parts.rawParts.filter(({ type }) => type !== 'decimal' && type !== 'fraction');\n }\n\n return parts;\n};\n\n/**\n * Wrapper that uses pollyfill of i18nify team\n */\nconst pollyfilledFormatNumberByParts: typeof formatNumberByParts = (value, options) => {\n const parts = formatNumberByParts(value, options);\n\n if (options?.intlOptions?.trailingZeroDisplay === 'stripIfInteger') {\n return stripTrailingZerosFromParts(parts);\n }\n\n return parts;\n};\n\ntype AmountCommonProps = {\n /**\n * The value to be rendered within the component.\n *\n */\n value: number;\n /**\n * Sets the color of the amount.\n *\n * @default undefined\n */\n color?: BaseTextProps['color'];\n /**\n * Indicates what the suffix of amount should be\n *\n * @default 'decimals'\n */\n suffix?: 'decimals' | 'none' | 'humanize';\n /**\n * Makes the currency indicator(currency symbol/code) and decimal digits small and faded\n *\n * @default true\n */\n isAffixSubtle?: true | false;\n /**\n * Determines the visual representation of the currency, choose between displaying the currency symbol or code.\n *\n * Note: Currency symbol and code is determined by the locale set in user's browser or set via @razorpay/i18nify-react library.\n *\n * @default 'currency-symbol'\n */\n currencyIndicator?: 'currency-symbol' | 'currency-code';\n /**\n * The currency of the amount. Note that this component\n * only displays the provided value in the specified currency, it does not perform any currency conversion.\n *\n * @default 'INR'\n * */\n currency?: CurrencyCodeType;\n /**\n * If true, the amount text will have a line through it.\n *\n * @default false\n */\n isStrikethrough?: boolean;\n /**\n * Controls the number of decimal places to display when suffix is 'decimals'.\n *\n * @default 2\n */\n fractionDigits?: number;\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\ntype ColorProps = {\n amountValueColor: BaseTextProps['color'];\n};\n\ntype AmountProps = AmountTypeProps & AmountCommonProps;\n\nconst getTextColorProps = ({ color }: { color: AmountProps['color'] }): ColorProps => {\n const props: ColorProps = {\n amountValueColor: 'surface.text.gray.normal',\n };\n if (!color) return props;\n props.amountValueColor = color;\n return props;\n};\n\ntype AmountType = Partial<ReturnType<typeof formatNumberByParts>>;\n\ninterface AmountValue extends Omit<AmountProps, 'value'> {\n amountValueColor: BaseTextProps['color'];\n amount: AmountType;\n size: Exclude<AmountProps['size'], undefined>;\n}\n\nconst AmountValue = ({\n amount,\n size = 'medium',\n type = 'body',\n weight = 'regular',\n amountValueColor,\n isAffixSubtle,\n suffix,\n}: AmountValue): ReactElement => {\n const isReactNative = getPlatformType() === 'react-native';\n const affixFontSize = isAffixSubtle ? subtleFontSizes[type][size] : normalAmountSizes[type][size];\n const numberFontFamily: keyof FontFamily = type === 'body' ? 'text' : 'heading';\n if (suffix === 'decimals' && isAffixSubtle) {\n // Native does not support alignItems of Text inside a div, instead we need to wrap is in a Text\n const AmountWrapper = isReactNative ? Text : React.Fragment;\n\n return (\n <AmountWrapper>\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n fontFamily={numberFontFamily}\n as={isReactNative ? undefined : 'span'}\n >\n {amount.integer}\n </BaseText>\n <BaseText\n fontWeight={weight}\n fontSize={affixFontSize}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {amount.decimal}\n {amount.fraction}\n </BaseText>\n </AmountWrapper>\n );\n }\n\n return (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n lineHeight={amountLineHeights[type][size]}\n >\n {amount.integer}\n {amount.decimal}\n {amount.fraction}\n {amount.compact}\n </BaseText>\n );\n};\n\ntype FormatAmountWithSuffixType = {\n suffix: AmountProps['suffix'];\n value: number;\n currency: AmountProps['currency'];\n fractionDigits?: number;\n};\n\n/**\n * Returns a parsed object based on the suffix passed in parameters\n * === Logic ===\n * value = 12500.45 \n * if suffix === 'decimals' => {\n \"integer\": \"12,500\",\n \"decimal\": \".\",\n \"fraction\": \"45\",\n \"compact\": \"K\",\n \"isPrefixSymbol\": false,\n \"rawParts\": [{\"type\": \"integer\",\"value\": \"12\"},{\"type\": \"group\",\"value\": \",\"},{\"type\": \"integer\",\"value\": \"500\"},{\"type\": \"decimal\",\"value\": \".\"},{\"type\": \"fraction\",\"value\": \"45\"}]\n}\n * @returns {AmountType}\n */\nexport const getAmountByParts = ({\n suffix,\n value,\n currency,\n fractionDigits = 2,\n}: FormatAmountWithSuffixType): AmountType => {\n try {\n switch (suffix) {\n case 'decimals': {\n const options = {\n intlOptions: {\n maximumFractionDigits: fractionDigits,\n minimumFractionDigits: fractionDigits,\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n case 'humanize': {\n const options = {\n intlOptions: {\n notation: 'compact',\n maximumFractionDigits: 2,\n trailingZeroDisplay: 'stripIfInteger',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n\n default: {\n const options = {\n intlOptions: {\n maximumFractionDigits: 0,\n roundingMode: 'floor',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n }\n } catch (err: unknown) {\n return {\n integer: `${value}`,\n currency,\n };\n }\n};\n\nconst _Amount = (\n {\n value,\n suffix = 'decimals',\n type = 'body',\n size = 'medium',\n weight = 'regular',\n isAffixSubtle = true,\n isStrikethrough = false,\n color,\n currencyIndicator = 'currency-symbol',\n currency = 'INR',\n fractionDigits = 2,\n testID,\n ...rest\n }: AmountProps,\n ref: React.Ref<BladeElementRef>,\n): ReactElement => {\n if (__DEV__) {\n if (typeof value !== 'number') {\n throwBladeError({\n message: '`value` prop must be of type `number` for Amount.',\n moduleName: 'Amount',\n });\n }\n // @ts-expect-error neutral color should throw error\n if (color === 'neutral') {\n throwBladeError({\n message: '`neutral` color is not supported.',\n moduleName: 'Amount',\n });\n }\n\n const bodySizes = objectKeysWithType(normalAmountSizes.body);\n if ((type === 'body' || !type) && !bodySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"body\"`,\n moduleName: 'Amount',\n });\n }\n\n const displaySizes = objectKeysWithType(normalAmountSizes.display);\n if (type === 'display' && !displaySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"display\"`,\n moduleName: 'Amount',\n });\n }\n\n const headingSizes = objectKeysWithType(normalAmountSizes.heading);\n if (type === 'heading' && !headingSizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"heading\"`,\n moduleName: 'Amount',\n });\n }\n }\n\n const { amountValueColor } = getTextColorProps({\n color,\n });\n\n const renderedValue = getAmountByParts({ suffix, value, currency, fractionDigits });\n const isPrefixSymbol = renderedValue.isPrefixSymbol ?? true;\n const currencySymbol = renderedValue.currency ?? currency;\n\n const currencyPosition = isPrefixSymbol ? 'left' : 'right';\n const currencySymbolOrCode = currencyIndicator === 'currency-symbol' ? currencySymbol : currency;\n\n const currencyFontSize = isAffixSubtle\n ? subtleFontSizes[type][size]\n : normalAmountSizes[type][size];\n const isReactNative = getPlatformType() === 'react-native';\n\n return (\n <BaseBox\n ref={ref as never}\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n flexDirection=\"row\"\n {...metaAttribute({ name: MetaConstants.Amount, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n alignItems=\"baseline\"\n flexDirection=\"row\"\n position=\"relative\"\n >\n {renderedValue.minusSign ? (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n marginX=\"spacing.2\"\n >\n {renderedValue.minusSign}\n </BaseText>\n ) : null}\n {currencyPosition === 'left' && (\n <BaseText\n marginRight=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n <AmountValue\n amount={renderedValue}\n amountValueColor={amountValueColor}\n type={type}\n weight={weight}\n size={size}\n isAffixSubtle={isAffixSubtle}\n suffix={suffix}\n currency={currency}\n />\n {currencyPosition === 'right' && (\n <BaseText\n marginLeft=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n {isStrikethrough && (\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: the borderBottomColor error below is thrown here as well\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore- intentionally setting the border color to the color prop for this hacky strikethrough\n borderBottomColor={amountValueColor}\n borderBottomWidth={type === 'body' ? 'thin' : 'thicker'}\n borderBottomStyle=\"solid\"\n position=\"absolute\"\n width=\"100%\"\n top=\"50%\"\n />\n )}\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst Amount = assignWithoutSideEffects(React.forwardRef(_Amount), {\n displayName: 'Amount',\n componentId: 'Amount',\n});\n\nexport type { AmountProps };\nexport { Amount };\n"],"names":["stripTrailingZerosFromParts","parts","decimalPart","rawParts","filter","_ref","type","map","_ref2","value","join","hasFraction","some","_ref3","test","decimal","fraction","_ref4","pollyfilledFormatNumberByParts","options","_options$intlOptions","formatNumberByParts","intlOptions","trailingZeroDisplay","getTextColorProps","_ref5","color","props","amountValueColor","AmountValue","_ref6","amount","_ref6$size","size","_ref6$type","_ref6$weight","weight","isAffixSubtle","suffix","isReactNative","getPlatformType","affixFontSize","subtleFontSizes","normalAmountSizes","numberFontFamily","AmountWrapper","Text","React","Fragment","_jsxs","children","_jsx","BaseText","fontSize","fontWeight","lineHeight","amountLineHeights","fontFamily","as","undefined","integer","opacity","compact","getAmountByParts","_ref7","currency","_ref7$fractionDigits","fractionDigits","maximumFractionDigits","minimumFractionDigits","notation","roundingMode","err","_Amount","_ref8","ref","_renderedValue$isPref","_renderedValue$curren","_ref8$suffix","_ref8$type","_ref8$size","_ref8$weight","_ref8$isAffixSubtle","_ref8$isStrikethrough","isStrikethrough","_ref8$currencyIndicat","currencyIndicator","_ref8$currency","_ref8$fractionDigits","testID","rest","_objectWithoutProperties","_excluded","__DEV__","throwBladeError","message","moduleName","bodySizes","objectKeysWithType","body","includes","displaySizes","display","headingSizes","heading","_getTextColorProps","renderedValue","isPrefixSymbol","currencySymbol","currencyPosition","currencySymbolOrCode","currencyFontSize","BaseBox","Object","assign","flexDirection","metaAttribute","name","MetaConstants","Amount","getStyledProps","makeAnalyticsAttribute","alignItems","position","minusSign","marginX","marginRight","marginLeft","borderBottomColor","borderBottomWidth","borderB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,CAAEA,MAAO,CACf2B,QAAQ,CAAEA,QAAS,CACpB,CAAC,CACD4C,gBAAgB,GAAK,OAAO,EAC3B1D,GAAA,CAACC,QAAQ,CAAA,CACP2E,UAAU,CAAC,WAAW,CACtBzE,UAAU,CAAElB,MAAO,CACnBiB,QAAQ,CAAE0D,gBAAiB,CAC3BrF,KAAK,CAAEE,gBAAiB,CACxB8B,EAAE,CAAEnB,aAAa,CAAGoB,SAAS,CAAG,MAAO,CACvCE,OAAO,CAAExB,aAAa,CAAGwB,OAAO,CAAC,GAAG,CAAC,CAAG,CAAE,CAAAX,QAAA,CAEzC4D,oBAAoB,CACb,CACX,CACA1B,eAAe,EAGdjC,GAAA,CAAC6D,OAAO,CAGNgB,CAAAA,iBAAiB,CAAEpG,gBAAiB,CACpCqG,iBAAiB,CAAE3H,IAAI,GAAK,MAAM,CAAG,MAAM,CAAG,SAAU,CACxD4H,iBAAiB,CAAC,OAAO,CACzBP,QAAQ,CAAC,UAAU,CACnBQ,KAAK,CAAC,MAAM,CACZC,GAAG,CAAC,KAAK,CACV,CACF,CAAA,CACM,CAAC,CACH,CAAA,CAAC,CAEd,CAAC,CAEK,IAAAb,MAAM,CAAGc,wBAAwB,CAACtF,cAAK,CAACuF,UAAU,CAAC7D,OAAO,CAAC,CAAE,CACjE8D,WAAW,CAAE,QAAQ,CACrBC,WAAW,CAAE,QACf,CAAC;;;;"}
@@ -27,7 +27,7 @@ import { getStyledProps } from '../Box/styledProps/getStyledProps.js';
27
27
  import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
28
28
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
29
29
 
30
- var _excluded = ["value", "suffix", "type", "size", "weight", "isAffixSubtle", "isStrikethrough", "color", "currencyIndicator", "currency", "testID"];
30
+ var _excluded = ["value", "suffix", "type", "size", "weight", "isAffixSubtle", "isStrikethrough", "color", "currencyIndicator", "currency", "fractionDigits", "testID"];
31
31
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
32
32
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
33
33
  var stripTrailingZerosFromParts = function stripTrailingZerosFromParts(parts) {
@@ -136,15 +136,17 @@ var AmountValue = function AmountValue(_ref6) {
136
136
  var getAmountByParts = function getAmountByParts(_ref7) {
137
137
  var suffix = _ref7.suffix,
138
138
  value = _ref7.value,
139
- currency = _ref7.currency;
139
+ currency = _ref7.currency,
140
+ _ref7$fractionDigits = _ref7.fractionDigits,
141
+ fractionDigits = _ref7$fractionDigits === void 0 ? 2 : _ref7$fractionDigits;
140
142
  try {
141
143
  switch (suffix) {
142
144
  case 'decimals':
143
145
  {
144
146
  var options = {
145
147
  intlOptions: {
146
- maximumFractionDigits: 2,
147
- minimumFractionDigits: 2
148
+ maximumFractionDigits: fractionDigits,
149
+ minimumFractionDigits: fractionDigits
148
150
  },
149
151
  currency: currency
150
152
  };
@@ -201,6 +203,8 @@ var _Amount = function _Amount(_ref8, ref) {
201
203
  currencyIndicator = _ref8$currencyIndicat === void 0 ? 'currency-symbol' : _ref8$currencyIndicat,
202
204
  _ref8$currency = _ref8.currency,
203
205
  currency = _ref8$currency === void 0 ? 'INR' : _ref8$currency,
206
+ _ref8$fractionDigits = _ref8.fractionDigits,
207
+ fractionDigits = _ref8$fractionDigits === void 0 ? 2 : _ref8$fractionDigits,
204
208
  testID = _ref8.testID,
205
209
  rest = _objectWithoutProperties(_ref8, _excluded);
206
210
  if (true) {
@@ -246,7 +250,8 @@ var _Amount = function _Amount(_ref8, ref) {
246
250
  var renderedValue = getAmountByParts({
247
251
  suffix: suffix,
248
252
  value: value,
249
- currency: currency
253
+ currency: currency,
254
+ fractionDigits: fractionDigits
250
255
  });
251
256
  var isPrefixSymbol = (_renderedValue$isPref = renderedValue.isPrefixSymbol) !== null && _renderedValue$isPref !== void 0 ? _renderedValue$isPref : true;
252
257
  var currencySymbol = (_renderedValue$curren = renderedValue.currency) !== null && _renderedValue$curren !== void 0 ? _renderedValue$curren : currency;
@@ -1 +1 @@
1
- {"version":3,"file":"Amount.js","sources":["../../../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport type { CurrencyCodeType } from '@razorpay/i18nify-js/currency';\nimport { formatNumberByParts } from '@razorpay/i18nify-js/currency';\nimport type { AmountTypeProps } from './amountTokens';\nimport { normalAmountSizes, subtleFontSizes, amountLineHeights } from './amountTokens';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { DataAnalyticsAttribute, BladeElementRef, TestID } from '~utils/types';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { objectKeysWithType } from '~utils/objectKeysWithType';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { Text } from '~components/Typography';\nimport { opacity } from '~tokens/global';\nimport type { FontFamily } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\n/**\n * Pollyfill function to get around the node 18 error\n *\n * This function is maintained by i18nify team. Reach out to them for any change regarding this.\n */\nconst stripTrailingZerosFromParts = (\n parts: ReturnType<typeof formatNumberByParts>,\n): ReturnType<typeof formatNumberByParts> => {\n const decimalPart = parts.rawParts\n .filter(({ type }) => type === 'fraction')\n .map(({ value }) => value)\n .join('');\n\n const hasFraction = parts.rawParts.some(({ type }) => type === 'fraction');\n\n if (hasFraction && /^0+$/.test(decimalPart)) {\n delete parts.decimal;\n delete parts.fraction;\n parts.rawParts = parts.rawParts.filter(({ type }) => type !== 'decimal' && type !== 'fraction');\n }\n\n return parts;\n};\n\n/**\n * Wrapper that uses pollyfill of i18nify team\n */\nconst pollyfilledFormatNumberByParts: typeof formatNumberByParts = (value, options) => {\n const parts = formatNumberByParts(value, options);\n\n if (options?.intlOptions?.trailingZeroDisplay === 'stripIfInteger') {\n return stripTrailingZerosFromParts(parts);\n }\n\n return parts;\n};\n\ntype AmountCommonProps = {\n /**\n * The value to be rendered within the component.\n *\n */\n value: number;\n /**\n * Sets the color of the amount.\n *\n * @default undefined\n */\n color?: BaseTextProps['color'];\n /**\n * Indicates what the suffix of amount should be\n *\n * @default 'decimals'\n */\n suffix?: 'decimals' | 'none' | 'humanize';\n /**\n * Makes the currency indicator(currency symbol/code) and decimal digits small and faded\n *\n * @default true\n */\n isAffixSubtle?: true | false;\n /**\n * Determines the visual representation of the currency, choose between displaying the currency symbol or code.\n *\n * Note: Currency symbol and code is determined by the locale set in user's browser or set via @razorpay/i18nify-react library.\n *\n * @default 'currency-symbol'\n */\n currencyIndicator?: 'currency-symbol' | 'currency-code';\n /**\n * The currency of the amount. Note that this component\n * only displays the provided value in the specified currency, it does not perform any currency conversion.\n *\n * @default 'INR'\n * */\n currency?: CurrencyCodeType;\n /**\n * If true, the amount text will have a line through it.\n *\n * @default false\n */\n isStrikethrough?: boolean;\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\ntype ColorProps = {\n amountValueColor: BaseTextProps['color'];\n};\n\ntype AmountProps = AmountTypeProps & AmountCommonProps;\n\nconst getTextColorProps = ({ color }: { color: AmountProps['color'] }): ColorProps => {\n const props: ColorProps = {\n amountValueColor: 'surface.text.gray.normal',\n };\n if (!color) return props;\n props.amountValueColor = color;\n return props;\n};\n\ntype AmountType = Partial<ReturnType<typeof formatNumberByParts>>;\n\ninterface AmountValue extends Omit<AmountProps, 'value'> {\n amountValueColor: BaseTextProps['color'];\n amount: AmountType;\n size: Exclude<AmountProps['size'], undefined>;\n}\n\nconst AmountValue = ({\n amount,\n size = 'medium',\n type = 'body',\n weight = 'regular',\n amountValueColor,\n isAffixSubtle,\n suffix,\n}: AmountValue): ReactElement => {\n const isReactNative = getPlatformType() === 'react-native';\n const affixFontSize = isAffixSubtle ? subtleFontSizes[type][size] : normalAmountSizes[type][size];\n const numberFontFamily: keyof FontFamily = type === 'body' ? 'text' : 'heading';\n if (suffix === 'decimals' && isAffixSubtle) {\n // Native does not support alignItems of Text inside a div, instead we need to wrap is in a Text\n const AmountWrapper = isReactNative ? Text : React.Fragment;\n\n return (\n <AmountWrapper>\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n fontFamily={numberFontFamily}\n as={isReactNative ? undefined : 'span'}\n >\n {amount.integer}\n </BaseText>\n <BaseText\n fontWeight={weight}\n fontSize={affixFontSize}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {amount.decimal}\n {amount.fraction}\n </BaseText>\n </AmountWrapper>\n );\n }\n\n return (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n lineHeight={amountLineHeights[type][size]}\n >\n {amount.integer}\n {amount.decimal}\n {amount.fraction}\n {amount.compact}\n </BaseText>\n );\n};\n\ntype FormatAmountWithSuffixType = {\n suffix: AmountProps['suffix'];\n value: number;\n currency: AmountProps['currency'];\n};\n\n/**\n * Returns a parsed object based on the suffix passed in parameters\n * === Logic ===\n * value = 12500.45 \n * if suffix === 'decimals' => {\n \"integer\": \"12,500\",\n \"decimal\": \".\",\n \"fraction\": \"45\",\n \"compact\": \"K\",\n \"isPrefixSymbol\": false,\n \"rawParts\": [{\"type\": \"integer\",\"value\": \"12\"},{\"type\": \"group\",\"value\": \",\"},{\"type\": \"integer\",\"value\": \"500\"},{\"type\": \"decimal\",\"value\": \".\"},{\"type\": \"fraction\",\"value\": \"45\"}]\n}\n * @returns {AmountType}\n */\nexport const getAmountByParts = ({\n suffix,\n value,\n currency,\n}: FormatAmountWithSuffixType): AmountType => {\n try {\n switch (suffix) {\n case 'decimals': {\n const options = {\n intlOptions: {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n case 'humanize': {\n const options = {\n intlOptions: {\n notation: 'compact',\n maximumFractionDigits: 2,\n trailingZeroDisplay: 'stripIfInteger',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n\n default: {\n const options = {\n intlOptions: {\n maximumFractionDigits: 0,\n roundingMode: 'floor',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n }\n } catch (err: unknown) {\n return {\n integer: `${value}`,\n currency,\n };\n }\n};\n\nconst _Amount = (\n {\n value,\n suffix = 'decimals',\n type = 'body',\n size = 'medium',\n weight = 'regular',\n isAffixSubtle = true,\n isStrikethrough = false,\n color,\n currencyIndicator = 'currency-symbol',\n currency = 'INR',\n testID,\n ...rest\n }: AmountProps,\n ref: React.Ref<BladeElementRef>,\n): ReactElement => {\n if (__DEV__) {\n if (typeof value !== 'number') {\n throwBladeError({\n message: '`value` prop must be of type `number` for Amount.',\n moduleName: 'Amount',\n });\n }\n // @ts-expect-error neutral color should throw error\n if (color === 'neutral') {\n throwBladeError({\n message: '`neutral` color is not supported.',\n moduleName: 'Amount',\n });\n }\n\n const bodySizes = objectKeysWithType(normalAmountSizes.body);\n if ((type === 'body' || !type) && !bodySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"body\"`,\n moduleName: 'Amount',\n });\n }\n\n const displaySizes = objectKeysWithType(normalAmountSizes.display);\n if (type === 'display' && !displaySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"display\"`,\n moduleName: 'Amount',\n });\n }\n\n const headingSizes = objectKeysWithType(normalAmountSizes.heading);\n if (type === 'heading' && !headingSizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"heading\"`,\n moduleName: 'Amount',\n });\n }\n }\n\n const { amountValueColor } = getTextColorProps({\n color,\n });\n\n const renderedValue = getAmountByParts({ suffix, value, currency });\n const isPrefixSymbol = renderedValue.isPrefixSymbol ?? true;\n const currencySymbol = renderedValue.currency ?? currency;\n\n const currencyPosition = isPrefixSymbol ? 'left' : 'right';\n const currencySymbolOrCode = currencyIndicator === 'currency-symbol' ? currencySymbol : currency;\n\n const currencyFontSize = isAffixSubtle\n ? subtleFontSizes[type][size]\n : normalAmountSizes[type][size];\n const isReactNative = getPlatformType() === 'react-native';\n\n return (\n <BaseBox\n ref={ref as never}\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n flexDirection=\"row\"\n {...metaAttribute({ name: MetaConstants.Amount, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n alignItems=\"baseline\"\n flexDirection=\"row\"\n position=\"relative\"\n >\n {renderedValue.minusSign ? (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n marginX=\"spacing.2\"\n >\n {renderedValue.minusSign}\n </BaseText>\n ) : null}\n {currencyPosition === 'left' && (\n <BaseText\n marginRight=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n <AmountValue\n amount={renderedValue}\n amountValueColor={amountValueColor}\n type={type}\n weight={weight}\n size={size}\n isAffixSubtle={isAffixSubtle}\n suffix={suffix}\n currency={currency}\n />\n {currencyPosition === 'right' && (\n <BaseText\n marginLeft=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n {isStrikethrough && (\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: the borderBottomColor error below is thrown here as well\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore- intentionally setting the border color to the color prop for this hacky strikethrough\n borderBottomColor={amountValueColor}\n borderBottomWidth={type === 'body' ? 'thin' : 'thicker'}\n borderBottomStyle=\"solid\"\n position=\"absolute\"\n width=\"100%\"\n top=\"50%\"\n />\n )}\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst Amount = assignWithoutSideEffects(React.forwardRef(_Amount), {\n displayName: 'Amount',\n componentId: 'Amount',\n});\n\nexport type { AmountProps };\nexport { Amount };\n"],"names":["stripTrailingZerosFromParts","parts","decimalPart","rawParts","filter","_ref","type","map","_ref2","value","join","hasFraction","some","_ref3","test","decimal","fraction","_ref4","pollyfilledFormatNumberByParts","options","_options$intlOptions","formatNumberByParts","intlOptions","trailingZeroDisplay","getTextColorProps","_ref5","color","props","amountValueColor","AmountValue","_ref6","amount","_ref6$size","size","_ref6$type","_ref6$weight","weight","isAffixSubtle","suffix","isReactNative","getPlatformType","affixFontSize","subtleFontSizes","normalAmountSizes","numberFontFamily","AmountWrapper","Text","React","Fragment","_jsxs","children","_jsx","BaseText","fontSize","fontWeight","lineHeight","amountLineHeights","fontFamily","as","undefined","integer","opacity","compact","getAmountByParts","_ref7","currency","maximumFractionDigits","minimumFractionDigits","notation","roundingMode","err","concat","_Amount","_ref8","ref","_renderedValue$isPref","_renderedValue$curren","_ref8$suffix","_ref8$type","_ref8$size","_ref8$weight","_ref8$isAffixSubtle","_ref8$isStrikethrough","isStrikethrough","_ref8$currencyIndicat","currencyIndicator","_ref8$currency","testID","rest","_objectWithoutProperties","_excluded","throwBladeError","message","moduleName","bodySizes","objectKeysWithType","body","includes","displaySizes","display","headingSizes","heading","_getTextColorProps","renderedValue","isPrefixSymbol","currencySymbol","currencyPosition","currencySymbolOrCode","currencyFontSize","BaseBox","_objectSpread","flexDirection","metaAttribute","name","MetaConstants","Amount","getStyledProps","makeAnalyticsAttribute","alignItems","position","minusSign","marginX","marginRight","marginLeft","borderBottomColor","borderBottomWidth","borderBottomStyle","width","top","assignWithoutSideEffects","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAMA,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAC/BC,KAA6C,EACF;EAC3C,IAAMC,WAAW,GAAGD,KAAK,CAACE,QAAQ,CAC/BC,MAAM,CAAC,UAAAC,IAAA,EAAA;AAAA,IAAA,IAAGC,IAAI,GAAAD,IAAA,CAAJC,IAAI,CAAA;IAAA,OAAOA,IAAI,KAAK,UAAU,CAAA;AAAA,GAAA,CAAC,CACzCC,GAAG,CAAC,UAAAC,KAAA,EAAA;AAAA,IAAA,IAAGC,KAAK,GAAAD,KAAA,CAALC,KAAK,CAAA;AAAA,IAAA,OAAOA,KAAK,CAAA;AAAA,GAAA,CAAC,CACzBC,IAAI,CAAC,EAAE,CAAC,CAAA;EAEX,IAAMC,WAAW,GAAGV,KAAK,CAACE,QAAQ,CAACS,IAAI,CAAC,UAAAC,KAAA,EAAA;AAAA,IAAA,IAAGP,IAAI,GAAAO,KAAA,CAAJP,IAAI,CAAA;IAAA,OAAOA,IAAI,KAAK,UAAU,CAAA;GAAC,CAAA,CAAA;EAE1E,IAAIK,WAAW,IAAI,MAAM,CAACG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,MAAO;QACvCE,OAAO,EAAExB,aAAa,GAAGwB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAE;AAAAX,QAAAA,QAAA,EAEzCyD,oBAAAA;OACO,CACX,EACAxB,eAAe;AAAA;AACd;AACA;AACAhC,MAAAA,GAAA,CAAC0D,OAAAA;AACC;AACA;AAAA,QAAA;AACAe,QAAAA,iBAAiB,EAAEhG,gBAAiB;AACpCiG,QAAAA,iBAAiB,EAAEvH,IAAI,KAAK,MAAM,GAAG,MAAM,GAAG,SAAU;AACxDwH,QAAAA,iBAAiB,EAAC,OAAO;AACzBP,QAAAA,QAAQ,EAAC,UAAU;AACnBQ,QAAAA,KAAK,EAAC,MAAM;AACZC,QAAAA,GAAG,EAAC,KAAA;AAAK,OACV,CACF,CAAA;KACM,CAAA;AAAC,GAAA,CACH,CAAC,CAAA;AAEd,CAAC,CAAA;AAEKb,IAAAA,MAAM,gBAAGc,wBAAwB,eAAClF,cAAK,CAACmF,UAAU,CAAC1D,OAAO,CAAC,EAAE;AACjE2D,EAAAA,WAAW,EAAE,QAAQ;AACrBC,EAAAA,WAAW,EAAE,QAAA;AACf,CAAC;;;;"}
1
+ {"version":3,"file":"Amount.js","sources":["../../../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport type { CurrencyCodeType } from '@razorpay/i18nify-js/currency';\nimport { formatNumberByParts } from '@razorpay/i18nify-js/currency';\nimport type { AmountTypeProps } from './amountTokens';\nimport { normalAmountSizes, subtleFontSizes, amountLineHeights } from './amountTokens';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { DataAnalyticsAttribute, BladeElementRef, TestID } from '~utils/types';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { objectKeysWithType } from '~utils/objectKeysWithType';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { Text } from '~components/Typography';\nimport { opacity } from '~tokens/global';\nimport type { FontFamily } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\n/**\n * Pollyfill function to get around the node 18 error\n *\n * This function is maintained by i18nify team. Reach out to them for any change regarding this.\n */\nconst stripTrailingZerosFromParts = (\n parts: ReturnType<typeof formatNumberByParts>,\n): ReturnType<typeof formatNumberByParts> => {\n const decimalPart = parts.rawParts\n .filter(({ type }) => type === 'fraction')\n .map(({ value }) => value)\n .join('');\n\n const hasFraction = parts.rawParts.some(({ type }) => type === 'fraction');\n\n if (hasFraction && /^0+$/.test(decimalPart)) {\n delete parts.decimal;\n delete parts.fraction;\n parts.rawParts = parts.rawParts.filter(({ type }) => type !== 'decimal' && type !== 'fraction');\n }\n\n return parts;\n};\n\n/**\n * Wrapper that uses pollyfill of i18nify team\n */\nconst pollyfilledFormatNumberByParts: typeof formatNumberByParts = (value, options) => {\n const parts = formatNumberByParts(value, options);\n\n if (options?.intlOptions?.trailingZeroDisplay === 'stripIfInteger') {\n return stripTrailingZerosFromParts(parts);\n }\n\n return parts;\n};\n\ntype AmountCommonProps = {\n /**\n * The value to be rendered within the component.\n *\n */\n value: number;\n /**\n * Sets the color of the amount.\n *\n * @default undefined\n */\n color?: BaseTextProps['color'];\n /**\n * Indicates what the suffix of amount should be\n *\n * @default 'decimals'\n */\n suffix?: 'decimals' | 'none' | 'humanize';\n /**\n * Makes the currency indicator(currency symbol/code) and decimal digits small and faded\n *\n * @default true\n */\n isAffixSubtle?: true | false;\n /**\n * Determines the visual representation of the currency, choose between displaying the currency symbol or code.\n *\n * Note: Currency symbol and code is determined by the locale set in user's browser or set via @razorpay/i18nify-react library.\n *\n * @default 'currency-symbol'\n */\n currencyIndicator?: 'currency-symbol' | 'currency-code';\n /**\n * The currency of the amount. Note that this component\n * only displays the provided value in the specified currency, it does not perform any currency conversion.\n *\n * @default 'INR'\n * */\n currency?: CurrencyCodeType;\n /**\n * If true, the amount text will have a line through it.\n *\n * @default false\n */\n isStrikethrough?: boolean;\n /**\n * Controls the number of decimal places to display when suffix is 'decimals'.\n *\n * @default 2\n */\n fractionDigits?: number;\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\ntype ColorProps = {\n amountValueColor: BaseTextProps['color'];\n};\n\ntype AmountProps = AmountTypeProps & AmountCommonProps;\n\nconst getTextColorProps = ({ color }: { color: AmountProps['color'] }): ColorProps => {\n const props: ColorProps = {\n amountValueColor: 'surface.text.gray.normal',\n };\n if (!color) return props;\n props.amountValueColor = color;\n return props;\n};\n\ntype AmountType = Partial<ReturnType<typeof formatNumberByParts>>;\n\ninterface AmountValue extends Omit<AmountProps, 'value'> {\n amountValueColor: BaseTextProps['color'];\n amount: AmountType;\n size: Exclude<AmountProps['size'], undefined>;\n}\n\nconst AmountValue = ({\n amount,\n size = 'medium',\n type = 'body',\n weight = 'regular',\n amountValueColor,\n isAffixSubtle,\n suffix,\n}: AmountValue): ReactElement => {\n const isReactNative = getPlatformType() === 'react-native';\n const affixFontSize = isAffixSubtle ? subtleFontSizes[type][size] : normalAmountSizes[type][size];\n const numberFontFamily: keyof FontFamily = type === 'body' ? 'text' : 'heading';\n if (suffix === 'decimals' && isAffixSubtle) {\n // Native does not support alignItems of Text inside a div, instead we need to wrap is in a Text\n const AmountWrapper = isReactNative ? Text : React.Fragment;\n\n return (\n <AmountWrapper>\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n fontFamily={numberFontFamily}\n as={isReactNative ? undefined : 'span'}\n >\n {amount.integer}\n </BaseText>\n <BaseText\n fontWeight={weight}\n fontSize={affixFontSize}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {amount.decimal}\n {amount.fraction}\n </BaseText>\n </AmountWrapper>\n );\n }\n\n return (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n lineHeight={amountLineHeights[type][size]}\n >\n {amount.integer}\n {amount.decimal}\n {amount.fraction}\n {amount.compact}\n </BaseText>\n );\n};\n\ntype FormatAmountWithSuffixType = {\n suffix: AmountProps['suffix'];\n value: number;\n currency: AmountProps['currency'];\n fractionDigits?: number;\n};\n\n/**\n * Returns a parsed object based on the suffix passed in parameters\n * === Logic ===\n * value = 12500.45 \n * if suffix === 'decimals' => {\n \"integer\": \"12,500\",\n \"decimal\": \".\",\n \"fraction\": \"45\",\n \"compact\": \"K\",\n \"isPrefixSymbol\": false,\n \"rawParts\": [{\"type\": \"integer\",\"value\": \"12\"},{\"type\": \"group\",\"value\": \",\"},{\"type\": \"integer\",\"value\": \"500\"},{\"type\": \"decimal\",\"value\": \".\"},{\"type\": \"fraction\",\"value\": \"45\"}]\n}\n * @returns {AmountType}\n */\nexport const getAmountByParts = ({\n suffix,\n value,\n currency,\n fractionDigits = 2,\n}: FormatAmountWithSuffixType): AmountType => {\n try {\n switch (suffix) {\n case 'decimals': {\n const options = {\n intlOptions: {\n maximumFractionDigits: fractionDigits,\n minimumFractionDigits: fractionDigits,\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n case 'humanize': {\n const options = {\n intlOptions: {\n notation: 'compact',\n maximumFractionDigits: 2,\n trailingZeroDisplay: 'stripIfInteger',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n\n default: {\n const options = {\n intlOptions: {\n maximumFractionDigits: 0,\n roundingMode: 'floor',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n }\n } catch (err: unknown) {\n return {\n integer: `${value}`,\n currency,\n };\n }\n};\n\nconst _Amount = (\n {\n value,\n suffix = 'decimals',\n type = 'body',\n size = 'medium',\n weight = 'regular',\n isAffixSubtle = true,\n isStrikethrough = false,\n color,\n currencyIndicator = 'currency-symbol',\n currency = 'INR',\n fractionDigits = 2,\n testID,\n ...rest\n }: AmountProps,\n ref: React.Ref<BladeElementRef>,\n): ReactElement => {\n if (__DEV__) {\n if (typeof value !== 'number') {\n throwBladeError({\n message: '`value` prop must be of type `number` for Amount.',\n moduleName: 'Amount',\n });\n }\n // @ts-expect-error neutral color should throw error\n if (color === 'neutral') {\n throwBladeError({\n message: '`neutral` color is not supported.',\n moduleName: 'Amount',\n });\n }\n\n const bodySizes = objectKeysWithType(normalAmountSizes.body);\n if ((type === 'body' || !type) && !bodySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"body\"`,\n moduleName: 'Amount',\n });\n }\n\n const displaySizes = objectKeysWithType(normalAmountSizes.display);\n if (type === 'display' && !displaySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"display\"`,\n moduleName: 'Amount',\n });\n }\n\n const headingSizes = objectKeysWithType(normalAmountSizes.heading);\n if (type === 'heading' && !headingSizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"heading\"`,\n moduleName: 'Amount',\n });\n }\n }\n\n const { amountValueColor } = getTextColorProps({\n color,\n });\n\n const renderedValue = getAmountByParts({ suffix, value, currency, fractionDigits });\n const isPrefixSymbol = renderedValue.isPrefixSymbol ?? true;\n const currencySymbol = renderedValue.currency ?? currency;\n\n const currencyPosition = isPrefixSymbol ? 'left' : 'right';\n const currencySymbolOrCode = currencyIndicator === 'currency-symbol' ? currencySymbol : currency;\n\n const currencyFontSize = isAffixSubtle\n ? subtleFontSizes[type][size]\n : normalAmountSizes[type][size];\n const isReactNative = getPlatformType() === 'react-native';\n\n return (\n <BaseBox\n ref={ref as never}\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n flexDirection=\"row\"\n {...metaAttribute({ name: MetaConstants.Amount, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n alignItems=\"baseline\"\n flexDirection=\"row\"\n position=\"relative\"\n >\n {renderedValue.minusSign ? (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n marginX=\"spacing.2\"\n >\n {renderedValue.minusSign}\n </BaseText>\n ) : null}\n {currencyPosition === 'left' && (\n <BaseText\n marginRight=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n <AmountValue\n amount={renderedValue}\n amountValueColor={amountValueColor}\n type={type}\n weight={weight}\n size={size}\n isAffixSubtle={isAffixSubtle}\n suffix={suffix}\n currency={currency}\n />\n {currencyPosition === 'right' && (\n <BaseText\n marginLeft=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n {isStrikethrough && (\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: the borderBottomColor error below is thrown here as well\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore- intentionally setting the border color to the color prop for this hacky strikethrough\n borderBottomColor={amountValueColor}\n borderBottomWidth={type === 'body' ? 'thin' : 'thicker'}\n borderBottomStyle=\"solid\"\n position=\"absolute\"\n width=\"100%\"\n top=\"50%\"\n />\n )}\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst Amount = assignWithoutSideEffects(React.forwardRef(_Amount), {\n displayName: 'Amount',\n componentId: 'Amount',\n});\n\nexport type { AmountProps };\nexport { Amount };\n"],"names":["stripTrailingZerosFromParts","parts","decimalPart","rawParts","filter","_ref","type","map","_ref2","value","join","hasFraction","some","_ref3","test","decimal","fraction","_ref4","pollyfilledFormatNumberByParts","options","_options$intlOptions","formatNumberByParts","intlOptions","trailingZeroDisplay","getTextColorProps","_ref5","color","props","amountValueColor","AmountValue","_ref6","amount","_ref6$size","size","_ref6$type","_ref6$weight","weight","isAffixSubtle","suffix","isReactNative","getPlatformType","affixFontSize","subtleFontSizes","normalAmountSizes","numberFontFamily","AmountWrapper","Text","React","Fragment","_jsxs","children","_jsx","BaseText","fontSize","fontWeight","lineHeight","amountLineHeights","fontFamily","as","undefined","integer","opacity","compact","getAmountByParts","_ref7","currency","_ref7$fractionDigits","fractionDigits","maximumFractionDigits","minimumFractionDigits","notation","roundingMode","err","concat","_Amount","_ref8","ref","_renderedValue$isPref","_renderedValue$curren","_ref8$suffix","_ref8$type","_ref8$size","_ref8$weight","_ref8$isAffixSubtle","_ref8$isStrikethrough","isStrikethrough","_ref8$currencyIndicat","currencyIndicator","_ref8$currency","_ref8$fractionDigits","testID","rest","_objectWithoutProperties","_excluded","throwBladeError","message","moduleName","bodySizes","objectKeysWithType","body","includes","displaySizes","display","headingSizes","heading","_getTextColorProps","renderedValue","isPrefixSymbol","currencySymbol","currencyPosition","currencySymbolOrCode","currencyFontSize","BaseBox","_objectSpread","flexDirection","metaAttribute","name","MetaConstants","Amount","getStyledProps","makeAnalyticsAttribute","alignItems","position","minusSign","marginX","marginRight","marginLeft","borderBottomColor","borderBottomWidth","borderBottomStyle","width","top","assignWithoutSideEffects","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAMA,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAC/BC,KAA6C,EACF;EAC3C,IAAMC,WAAW,GAAGD,KAAK,CAACE,QAAQ,CAC/BC,MAAM,CAAC,UAAAC,IAAA,EAAA;AAAA,IAAA,IAAGC,IAAI,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AAG,EAAC,KAAA;AAAK,OACV,CACF,CAAA;KACM,CAAA;AAAC,GAAA,CACH,CAAC,CAAA;AAEd,CAAC,CAAA;AAEKb,IAAAA,MAAM,gBAAGc,wBAAwB,eAACrF,cAAK,CAACsF,UAAU,CAAC3D,OAAO,CAAC,EAAE;AACjE4D,EAAAA,WAAW,EAAE,QAAQ;AACrBC,EAAAA,WAAW,EAAE,QAAA;AACf,CAAC;;;;"}
@@ -27,7 +27,7 @@ import { getStyledProps } from '../Box/styledProps/getStyledProps.js';
27
27
  import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
28
28
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
29
29
 
30
- var _excluded = ["value", "suffix", "type", "size", "weight", "isAffixSubtle", "isStrikethrough", "color", "currencyIndicator", "currency", "testID"];
30
+ var _excluded = ["value", "suffix", "type", "size", "weight", "isAffixSubtle", "isStrikethrough", "color", "currencyIndicator", "currency", "fractionDigits", "testID"];
31
31
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
32
32
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
33
33
  var stripTrailingZerosFromParts = function stripTrailingZerosFromParts(parts) {
@@ -136,15 +136,17 @@ var AmountValue = function AmountValue(_ref6) {
136
136
  var getAmountByParts = function getAmountByParts(_ref7) {
137
137
  var suffix = _ref7.suffix,
138
138
  value = _ref7.value,
139
- currency = _ref7.currency;
139
+ currency = _ref7.currency,
140
+ _ref7$fractionDigits = _ref7.fractionDigits,
141
+ fractionDigits = _ref7$fractionDigits === void 0 ? 2 : _ref7$fractionDigits;
140
142
  try {
141
143
  switch (suffix) {
142
144
  case 'decimals':
143
145
  {
144
146
  var options = {
145
147
  intlOptions: {
146
- maximumFractionDigits: 2,
147
- minimumFractionDigits: 2
148
+ maximumFractionDigits: fractionDigits,
149
+ minimumFractionDigits: fractionDigits
148
150
  },
149
151
  currency: currency
150
152
  };
@@ -201,6 +203,8 @@ var _Amount = function _Amount(_ref8, ref) {
201
203
  currencyIndicator = _ref8$currencyIndicat === void 0 ? 'currency-symbol' : _ref8$currencyIndicat,
202
204
  _ref8$currency = _ref8.currency,
203
205
  currency = _ref8$currency === void 0 ? 'INR' : _ref8$currency,
206
+ _ref8$fractionDigits = _ref8.fractionDigits,
207
+ fractionDigits = _ref8$fractionDigits === void 0 ? 2 : _ref8$fractionDigits,
204
208
  testID = _ref8.testID,
205
209
  rest = _objectWithoutProperties(_ref8, _excluded);
206
210
  if (false) {
@@ -246,7 +250,8 @@ var _Amount = function _Amount(_ref8, ref) {
246
250
  var renderedValue = getAmountByParts({
247
251
  suffix: suffix,
248
252
  value: value,
249
- currency: currency
253
+ currency: currency,
254
+ fractionDigits: fractionDigits
250
255
  });
251
256
  var isPrefixSymbol = (_renderedValue$isPref = renderedValue.isPrefixSymbol) !== null && _renderedValue$isPref !== void 0 ? _renderedValue$isPref : true;
252
257
  var currencySymbol = (_renderedValue$curren = renderedValue.currency) !== null && _renderedValue$curren !== void 0 ? _renderedValue$curren : currency;
@@ -1 +1 @@
1
- {"version":3,"file":"Amount.js","sources":["../../../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport type { CurrencyCodeType } from '@razorpay/i18nify-js/currency';\nimport { formatNumberByParts } from '@razorpay/i18nify-js/currency';\nimport type { AmountTypeProps } from './amountTokens';\nimport { normalAmountSizes, subtleFontSizes, amountLineHeights } from './amountTokens';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { DataAnalyticsAttribute, BladeElementRef, TestID } from '~utils/types';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { objectKeysWithType } from '~utils/objectKeysWithType';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { Text } from '~components/Typography';\nimport { opacity } from '~tokens/global';\nimport type { FontFamily } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\n/**\n * Pollyfill function to get around the node 18 error\n *\n * This function is maintained by i18nify team. Reach out to them for any change regarding this.\n */\nconst stripTrailingZerosFromParts = (\n parts: ReturnType<typeof formatNumberByParts>,\n): ReturnType<typeof formatNumberByParts> => {\n const decimalPart = parts.rawParts\n .filter(({ type }) => type === 'fraction')\n .map(({ value }) => value)\n .join('');\n\n const hasFraction = parts.rawParts.some(({ type }) => type === 'fraction');\n\n if (hasFraction && /^0+$/.test(decimalPart)) {\n delete parts.decimal;\n delete parts.fraction;\n parts.rawParts = parts.rawParts.filter(({ type }) => type !== 'decimal' && type !== 'fraction');\n }\n\n return parts;\n};\n\n/**\n * Wrapper that uses pollyfill of i18nify team\n */\nconst pollyfilledFormatNumberByParts: typeof formatNumberByParts = (value, options) => {\n const parts = formatNumberByParts(value, options);\n\n if (options?.intlOptions?.trailingZeroDisplay === 'stripIfInteger') {\n return stripTrailingZerosFromParts(parts);\n }\n\n return parts;\n};\n\ntype AmountCommonProps = {\n /**\n * The value to be rendered within the component.\n *\n */\n value: number;\n /**\n * Sets the color of the amount.\n *\n * @default undefined\n */\n color?: BaseTextProps['color'];\n /**\n * Indicates what the suffix of amount should be\n *\n * @default 'decimals'\n */\n suffix?: 'decimals' | 'none' | 'humanize';\n /**\n * Makes the currency indicator(currency symbol/code) and decimal digits small and faded\n *\n * @default true\n */\n isAffixSubtle?: true | false;\n /**\n * Determines the visual representation of the currency, choose between displaying the currency symbol or code.\n *\n * Note: Currency symbol and code is determined by the locale set in user's browser or set via @razorpay/i18nify-react library.\n *\n * @default 'currency-symbol'\n */\n currencyIndicator?: 'currency-symbol' | 'currency-code';\n /**\n * The currency of the amount. Note that this component\n * only displays the provided value in the specified currency, it does not perform any currency conversion.\n *\n * @default 'INR'\n * */\n currency?: CurrencyCodeType;\n /**\n * If true, the amount text will have a line through it.\n *\n * @default false\n */\n isStrikethrough?: boolean;\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\ntype ColorProps = {\n amountValueColor: BaseTextProps['color'];\n};\n\ntype AmountProps = AmountTypeProps & AmountCommonProps;\n\nconst getTextColorProps = ({ color }: { color: AmountProps['color'] }): ColorProps => {\n const props: ColorProps = {\n amountValueColor: 'surface.text.gray.normal',\n };\n if (!color) return props;\n props.amountValueColor = color;\n return props;\n};\n\ntype AmountType = Partial<ReturnType<typeof formatNumberByParts>>;\n\ninterface AmountValue extends Omit<AmountProps, 'value'> {\n amountValueColor: BaseTextProps['color'];\n amount: AmountType;\n size: Exclude<AmountProps['size'], undefined>;\n}\n\nconst AmountValue = ({\n amount,\n size = 'medium',\n type = 'body',\n weight = 'regular',\n amountValueColor,\n isAffixSubtle,\n suffix,\n}: AmountValue): ReactElement => {\n const isReactNative = getPlatformType() === 'react-native';\n const affixFontSize = isAffixSubtle ? subtleFontSizes[type][size] : normalAmountSizes[type][size];\n const numberFontFamily: keyof FontFamily = type === 'body' ? 'text' : 'heading';\n if (suffix === 'decimals' && isAffixSubtle) {\n // Native does not support alignItems of Text inside a div, instead we need to wrap is in a Text\n const AmountWrapper = isReactNative ? Text : React.Fragment;\n\n return (\n <AmountWrapper>\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n fontFamily={numberFontFamily}\n as={isReactNative ? undefined : 'span'}\n >\n {amount.integer}\n </BaseText>\n <BaseText\n fontWeight={weight}\n fontSize={affixFontSize}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {amount.decimal}\n {amount.fraction}\n </BaseText>\n </AmountWrapper>\n );\n }\n\n return (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n lineHeight={amountLineHeights[type][size]}\n >\n {amount.integer}\n {amount.decimal}\n {amount.fraction}\n {amount.compact}\n </BaseText>\n );\n};\n\ntype FormatAmountWithSuffixType = {\n suffix: AmountProps['suffix'];\n value: number;\n currency: AmountProps['currency'];\n};\n\n/**\n * Returns a parsed object based on the suffix passed in parameters\n * === Logic ===\n * value = 12500.45 \n * if suffix === 'decimals' => {\n \"integer\": \"12,500\",\n \"decimal\": \".\",\n \"fraction\": \"45\",\n \"compact\": \"K\",\n \"isPrefixSymbol\": false,\n \"rawParts\": [{\"type\": \"integer\",\"value\": \"12\"},{\"type\": \"group\",\"value\": \",\"},{\"type\": \"integer\",\"value\": \"500\"},{\"type\": \"decimal\",\"value\": \".\"},{\"type\": \"fraction\",\"value\": \"45\"}]\n}\n * @returns {AmountType}\n */\nexport const getAmountByParts = ({\n suffix,\n value,\n currency,\n}: FormatAmountWithSuffixType): AmountType => {\n try {\n switch (suffix) {\n case 'decimals': {\n const options = {\n intlOptions: {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n case 'humanize': {\n const options = {\n intlOptions: {\n notation: 'compact',\n maximumFractionDigits: 2,\n trailingZeroDisplay: 'stripIfInteger',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n\n default: {\n const options = {\n intlOptions: {\n maximumFractionDigits: 0,\n roundingMode: 'floor',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n }\n } catch (err: unknown) {\n return {\n integer: `${value}`,\n currency,\n };\n }\n};\n\nconst _Amount = (\n {\n value,\n suffix = 'decimals',\n type = 'body',\n size = 'medium',\n weight = 'regular',\n isAffixSubtle = true,\n isStrikethrough = false,\n color,\n currencyIndicator = 'currency-symbol',\n currency = 'INR',\n testID,\n ...rest\n }: AmountProps,\n ref: React.Ref<BladeElementRef>,\n): ReactElement => {\n if (__DEV__) {\n if (typeof value !== 'number') {\n throwBladeError({\n message: '`value` prop must be of type `number` for Amount.',\n moduleName: 'Amount',\n });\n }\n // @ts-expect-error neutral color should throw error\n if (color === 'neutral') {\n throwBladeError({\n message: '`neutral` color is not supported.',\n moduleName: 'Amount',\n });\n }\n\n const bodySizes = objectKeysWithType(normalAmountSizes.body);\n if ((type === 'body' || !type) && !bodySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"body\"`,\n moduleName: 'Amount',\n });\n }\n\n const displaySizes = objectKeysWithType(normalAmountSizes.display);\n if (type === 'display' && !displaySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"display\"`,\n moduleName: 'Amount',\n });\n }\n\n const headingSizes = objectKeysWithType(normalAmountSizes.heading);\n if (type === 'heading' && !headingSizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"heading\"`,\n moduleName: 'Amount',\n });\n }\n }\n\n const { amountValueColor } = getTextColorProps({\n color,\n });\n\n const renderedValue = getAmountByParts({ suffix, value, currency });\n const isPrefixSymbol = renderedValue.isPrefixSymbol ?? true;\n const currencySymbol = renderedValue.currency ?? currency;\n\n const currencyPosition = isPrefixSymbol ? 'left' : 'right';\n const currencySymbolOrCode = currencyIndicator === 'currency-symbol' ? currencySymbol : currency;\n\n const currencyFontSize = isAffixSubtle\n ? subtleFontSizes[type][size]\n : normalAmountSizes[type][size];\n const isReactNative = getPlatformType() === 'react-native';\n\n return (\n <BaseBox\n ref={ref as never}\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n flexDirection=\"row\"\n {...metaAttribute({ name: MetaConstants.Amount, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n alignItems=\"baseline\"\n flexDirection=\"row\"\n position=\"relative\"\n >\n {renderedValue.minusSign ? (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n marginX=\"spacing.2\"\n >\n {renderedValue.minusSign}\n </BaseText>\n ) : null}\n {currencyPosition === 'left' && (\n <BaseText\n marginRight=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n <AmountValue\n amount={renderedValue}\n amountValueColor={amountValueColor}\n type={type}\n weight={weight}\n size={size}\n isAffixSubtle={isAffixSubtle}\n suffix={suffix}\n currency={currency}\n />\n {currencyPosition === 'right' && (\n <BaseText\n marginLeft=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n {isStrikethrough && (\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: the borderBottomColor error below is thrown here as well\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore- intentionally setting the border color to the color prop for this hacky strikethrough\n borderBottomColor={amountValueColor}\n borderBottomWidth={type === 'body' ? 'thin' : 'thicker'}\n borderBottomStyle=\"solid\"\n position=\"absolute\"\n width=\"100%\"\n top=\"50%\"\n />\n )}\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst Amount = assignWithoutSideEffects(React.forwardRef(_Amount), {\n displayName: 'Amount',\n componentId: 'Amount',\n});\n\nexport type { AmountProps };\nexport { Amount };\n"],"names":["stripTrailingZerosFromParts","parts","decimalPart","rawParts","filter","_ref","type","map","_ref2","value","join","hasFraction","some","_ref3","test","decimal","fraction","_ref4","pollyfilledFormatNumberByParts","options","_options$intlOptions","formatNumberByParts","intlOptions","trailingZeroDisplay","getTextColorProps","_ref5","color","props","amountValueColor","AmountValue","_ref6","amount","_ref6$size","size","_ref6$type","_ref6$weight","weight","isAffixSubtle","suffix","isReactNative","getPlatformType","affixFontSize","subtleFontSizes","normalAmountSizes","numberFontFamily","AmountWrapper","Text","React","Fragment","_jsxs","children","_jsx","BaseText","fontSize","fontWeight","lineHeight","amountLineHeights","fontFamily","as","undefined","integer","opacity","compact","getAmountByParts","_ref7","currency","maximumFractionDigits","minimumFractionDigits","notation","roundingMode","err","concat","_Amount","_ref8","ref","_renderedValue$isPref","_renderedValue$curren","_ref8$suffix","_ref8$type","_ref8$size","_ref8$weight","_ref8$isAffixSubtle","_ref8$isStrikethrough","isStrikethrough","_ref8$currencyIndicat","currencyIndicator","_ref8$currency","testID","rest","_objectWithoutProperties","_excluded","throwBladeError","message","moduleName","bodySizes","objectKeysWithType","body","includes","displaySizes","display","headingSizes","heading","_getTextColorProps","renderedValue","isPrefixSymbol","currencySymbol","currencyPosition","currencySymbolOrCode","currencyFontSize","BaseBox","_objectSpread","flexDirection","metaAttribute","name","MetaConstants","Amount","getStyledProps","makeAnalyticsAttribute","alignItems","position","minusSign","marginX","marginRight","marginLeft","borderBottomColor","borderBottomWidth","borderBottomStyle","width","top","assignWithoutSideEffects","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAMA,2BAA2B,GAAG,SAA9BA,2BAA2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ACmF,UAAU,CAAC1D,OAAO,CAAC,EAAE;AACjE2D,EAAAA,WAAW,EAAE,QAAQ;AACrBC,EAAAA,WAAW,EAAE,QAAA;AACf,CAAC;;;;"}
1
+ {"version":3,"file":"Amount.js","sources":["../../../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport type { CurrencyCodeType } from '@razorpay/i18nify-js/currency';\nimport { formatNumberByParts } from '@razorpay/i18nify-js/currency';\nimport type { AmountTypeProps } from './amountTokens';\nimport { normalAmountSizes, subtleFontSizes, amountLineHeights } from './amountTokens';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { DataAnalyticsAttribute, BladeElementRef, TestID } from '~utils/types';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { objectKeysWithType } from '~utils/objectKeysWithType';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { Text } from '~components/Typography';\nimport { opacity } from '~tokens/global';\nimport type { FontFamily } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\n/**\n * Pollyfill function to get around the node 18 error\n *\n * This function is maintained by i18nify team. Reach out to them for any change regarding this.\n */\nconst stripTrailingZerosFromParts = (\n parts: ReturnType<typeof formatNumberByParts>,\n): ReturnType<typeof formatNumberByParts> => {\n const decimalPart = parts.rawParts\n .filter(({ type }) => type === 'fraction')\n .map(({ value }) => value)\n .join('');\n\n const hasFraction = parts.rawParts.some(({ type }) => type === 'fraction');\n\n if (hasFraction && /^0+$/.test(decimalPart)) {\n delete parts.decimal;\n delete parts.fraction;\n parts.rawParts = parts.rawParts.filter(({ type }) => type !== 'decimal' && type !== 'fraction');\n }\n\n return parts;\n};\n\n/**\n * Wrapper that uses pollyfill of i18nify team\n */\nconst pollyfilledFormatNumberByParts: typeof formatNumberByParts = (value, options) => {\n const parts = formatNumberByParts(value, options);\n\n if (options?.intlOptions?.trailingZeroDisplay === 'stripIfInteger') {\n return stripTrailingZerosFromParts(parts);\n }\n\n return parts;\n};\n\ntype AmountCommonProps = {\n /**\n * The value to be rendered within the component.\n *\n */\n value: number;\n /**\n * Sets the color of the amount.\n *\n * @default undefined\n */\n color?: BaseTextProps['color'];\n /**\n * Indicates what the suffix of amount should be\n *\n * @default 'decimals'\n */\n suffix?: 'decimals' | 'none' | 'humanize';\n /**\n * Makes the currency indicator(currency symbol/code) and decimal digits small and faded\n *\n * @default true\n */\n isAffixSubtle?: true | false;\n /**\n * Determines the visual representation of the currency, choose between displaying the currency symbol or code.\n *\n * Note: Currency symbol and code is determined by the locale set in user's browser or set via @razorpay/i18nify-react library.\n *\n * @default 'currency-symbol'\n */\n currencyIndicator?: 'currency-symbol' | 'currency-code';\n /**\n * The currency of the amount. Note that this component\n * only displays the provided value in the specified currency, it does not perform any currency conversion.\n *\n * @default 'INR'\n * */\n currency?: CurrencyCodeType;\n /**\n * If true, the amount text will have a line through it.\n *\n * @default false\n */\n isStrikethrough?: boolean;\n /**\n * Controls the number of decimal places to display when suffix is 'decimals'.\n *\n * @default 2\n */\n fractionDigits?: number;\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\ntype ColorProps = {\n amountValueColor: BaseTextProps['color'];\n};\n\ntype AmountProps = AmountTypeProps & AmountCommonProps;\n\nconst getTextColorProps = ({ color }: { color: AmountProps['color'] }): ColorProps => {\n const props: ColorProps = {\n amountValueColor: 'surface.text.gray.normal',\n };\n if (!color) return props;\n props.amountValueColor = color;\n return props;\n};\n\ntype AmountType = Partial<ReturnType<typeof formatNumberByParts>>;\n\ninterface AmountValue extends Omit<AmountProps, 'value'> {\n amountValueColor: BaseTextProps['color'];\n amount: AmountType;\n size: Exclude<AmountProps['size'], undefined>;\n}\n\nconst AmountValue = ({\n amount,\n size = 'medium',\n type = 'body',\n weight = 'regular',\n amountValueColor,\n isAffixSubtle,\n suffix,\n}: AmountValue): ReactElement => {\n const isReactNative = getPlatformType() === 'react-native';\n const affixFontSize = isAffixSubtle ? subtleFontSizes[type][size] : normalAmountSizes[type][size];\n const numberFontFamily: keyof FontFamily = type === 'body' ? 'text' : 'heading';\n if (suffix === 'decimals' && isAffixSubtle) {\n // Native does not support alignItems of Text inside a div, instead we need to wrap is in a Text\n const AmountWrapper = isReactNative ? Text : React.Fragment;\n\n return (\n <AmountWrapper>\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n fontFamily={numberFontFamily}\n as={isReactNative ? undefined : 'span'}\n >\n {amount.integer}\n </BaseText>\n <BaseText\n fontWeight={weight}\n fontSize={affixFontSize}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {amount.decimal}\n {amount.fraction}\n </BaseText>\n </AmountWrapper>\n );\n }\n\n return (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n lineHeight={amountLineHeights[type][size]}\n >\n {amount.integer}\n {amount.decimal}\n {amount.fraction}\n {amount.compact}\n </BaseText>\n );\n};\n\ntype FormatAmountWithSuffixType = {\n suffix: AmountProps['suffix'];\n value: number;\n currency: AmountProps['currency'];\n fractionDigits?: number;\n};\n\n/**\n * Returns a parsed object based on the suffix passed in parameters\n * === Logic ===\n * value = 12500.45 \n * if suffix === 'decimals' => {\n \"integer\": \"12,500\",\n \"decimal\": \".\",\n \"fraction\": \"45\",\n \"compact\": \"K\",\n \"isPrefixSymbol\": false,\n \"rawParts\": [{\"type\": \"integer\",\"value\": \"12\"},{\"type\": \"group\",\"value\": \",\"},{\"type\": \"integer\",\"value\": \"500\"},{\"type\": \"decimal\",\"value\": \".\"},{\"type\": \"fraction\",\"value\": \"45\"}]\n}\n * @returns {AmountType}\n */\nexport const getAmountByParts = ({\n suffix,\n value,\n currency,\n fractionDigits = 2,\n}: FormatAmountWithSuffixType): AmountType => {\n try {\n switch (suffix) {\n case 'decimals': {\n const options = {\n intlOptions: {\n maximumFractionDigits: fractionDigits,\n minimumFractionDigits: fractionDigits,\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n case 'humanize': {\n const options = {\n intlOptions: {\n notation: 'compact',\n maximumFractionDigits: 2,\n trailingZeroDisplay: 'stripIfInteger',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n\n default: {\n const options = {\n intlOptions: {\n maximumFractionDigits: 0,\n roundingMode: 'floor',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n }\n } catch (err: unknown) {\n return {\n integer: `${value}`,\n currency,\n };\n }\n};\n\nconst _Amount = (\n {\n value,\n suffix = 'decimals',\n type = 'body',\n size = 'medium',\n weight = 'regular',\n isAffixSubtle = true,\n isStrikethrough = false,\n color,\n currencyIndicator = 'currency-symbol',\n currency = 'INR',\n fractionDigits = 2,\n testID,\n ...rest\n }: AmountProps,\n ref: React.Ref<BladeElementRef>,\n): ReactElement => {\n if (__DEV__) {\n if (typeof value !== 'number') {\n throwBladeError({\n message: '`value` prop must be of type `number` for Amount.',\n moduleName: 'Amount',\n });\n }\n // @ts-expect-error neutral color should throw error\n if (color === 'neutral') {\n throwBladeError({\n message: '`neutral` color is not supported.',\n moduleName: 'Amount',\n });\n }\n\n const bodySizes = objectKeysWithType(normalAmountSizes.body);\n if ((type === 'body' || !type) && !bodySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"body\"`,\n moduleName: 'Amount',\n });\n }\n\n const displaySizes = objectKeysWithType(normalAmountSizes.display);\n if (type === 'display' && !displaySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"display\"`,\n moduleName: 'Amount',\n });\n }\n\n const headingSizes = objectKeysWithType(normalAmountSizes.heading);\n if (type === 'heading' && !headingSizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"heading\"`,\n moduleName: 'Amount',\n });\n }\n }\n\n const { amountValueColor } = getTextColorProps({\n color,\n });\n\n const renderedValue = getAmountByParts({ suffix, value, currency, fractionDigits });\n const isPrefixSymbol = renderedValue.isPrefixSymbol ?? true;\n const currencySymbol = renderedValue.currency ?? currency;\n\n const currencyPosition = isPrefixSymbol ? 'left' : 'right';\n const currencySymbolOrCode = currencyIndicator === 'currency-symbol' ? currencySymbol : currency;\n\n const currencyFontSize = isAffixSubtle\n ? subtleFontSizes[type][size]\n : normalAmountSizes[type][size];\n const isReactNative = getPlatformType() === 'react-native';\n\n return (\n <BaseBox\n ref={ref as never}\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n flexDirection=\"row\"\n {...metaAttribute({ name: MetaConstants.Amount, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n alignItems=\"baseline\"\n flexDirection=\"row\"\n position=\"relative\"\n >\n {renderedValue.minusSign ? (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n marginX=\"spacing.2\"\n >\n {renderedValue.minusSign}\n </BaseText>\n ) : null}\n {currencyPosition === 'left' && (\n <BaseText\n marginRight=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n <AmountValue\n amount={renderedValue}\n amountValueColor={amountValueColor}\n type={type}\n weight={weight}\n size={size}\n isAffixSubtle={isAffixSubtle}\n suffix={suffix}\n currency={currency}\n />\n {currencyPosition === 'right' && (\n <BaseText\n marginLeft=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n {isStrikethrough && (\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: the borderBottomColor error below is thrown here as well\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore- intentionally setting the border color to the color prop for this hacky strikethrough\n borderBottomColor={amountValueColor}\n borderBottomWidth={type === 'body' ? 'thin' : 'thicker'}\n borderBottomStyle=\"solid\"\n position=\"absolute\"\n width=\"100%\"\n top=\"50%\"\n />\n )}\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst Amount = assignWithoutSideEffects(React.forwardRef(_Amount), {\n displayName: 'Amount',\n componentId: 'Amount',\n});\n\nexport type { AmountProps };\nexport { Amount };\n"],"names":["stripTrailingZerosFromParts","parts","decimalPart","rawParts","filter","_ref","type","map","_ref2","value","join","hasFraction","some","_ref3","test","decimal","fraction","_ref4","pollyfilledFormatNumberByParts","options","_options$intlOptions","formatNumberByParts","intlOptions","trailingZeroDisplay","getTextColorProps","_ref5","color","props","amountValueColor","AmountValue","_ref6","amount","_ref6$size","size","_ref6$type","_ref6$weight","weight","isAffixSubtle","suffix","isReactNative","getPlatformType","affixFontSize","subtleFontSizes","normalAmountSizes","numberFontFamily","AmountWrapper","Text","React","Fragment","_jsxs","children","_jsx","BaseText","fontSize","fontWeight","lineHeight","amountLineHeights","fontFamily","as","undefined","integer","opacity","compact","getAmountByParts","_ref7","currency","_ref7$fractionDigits","fractionDigits","maximumFractionDigits","minimumFractionDigits","notation","roundingMode","err","concat","_Amount","_ref8","ref","_renderedValue$isPref","_renderedValue$curren","_ref8$suffix","_ref8$type","_ref8$size","_ref8$weight","_ref8$isAffixSubtle","_ref8$isStrikethrough","isStrikethrough","_ref8$currencyIndicat","currencyIndicator","_ref8$currency","_ref8$fractionDigits","testID","rest","_objectWithoutProperties","_excluded","throwBladeError","message","moduleName","bodySizes","objectKeysWithType","body","includes","displaySizes","display","headingSizes","heading","_getTextColorProps","renderedValue","isPrefixSymbol","currencySymbol","currencyPosition","currencySymbolOrCode","currencyFontSize","BaseBox","_objectSpread","flexDirection","metaAttribute","name","MetaConstants","Amount","getStyledProps","makeAnalyticsAttribute","alignItems","position","minusSign","marginX","marginRight","marginLeft","borderBottomColor","borderBottomWidth","borderBottomStyle","width","top","assignWithoutSideEffects","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAMA,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAC/BC,KAA6C,EACF;EAC3C,IAAMC,WAAW,GAAGD,KAAK,CAACE,QAAQ,CAC/BC,MAAM,CAAC,UAAAC,IAAA,EAAA;AAAA,IAAA,IAAGC,IAAI,GAAAD,IAAA,CAAJC,IAAI,CAAA;IAAA,OAAOA,IAAI,KAAK,UAAU,CAAA;AAAA,GAAA,CAAC,CACzCC,GAAG,CAAC,UAAAC,KAAA,EAAA;AAAA,IAAA,IAAGC,KAAK,GAAAD,KAAA,CAALC,KAAK,CAAA;AAAA,IAAA,OAAOA,KAAK,CAAA;AAAA,GAAA,CAAC,CACzBC,IAAI,CAAC,EAAE,CAAC,CAAA;EAEX,IAAMC,WAAW,GAAGV,KAAK,CAACE,QAAQ,CAACS,IAAI,CAAC,UAAAC,KAAA,EAAA;AAAA,IAAA,IAAGP,IAAI,GAAAO,KAAA,CAAJP,IAAI,CAAA;IAAA,OAAOA,IAAI,KAAK,UAAU,CAAA;GAAC,CAAA,CAAA;EAE1E,IAAIK,WAAW,IAAI,MAAM,CAACG,IAAI,CAACZ,WAAW,CAAC,EAAE;IAC3C,OAAOD,KAAK,CAACc,OAAO,CAAA;IACpB,OAAOd,KAAK,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,QAAAA,UAAU,EAAC,WAAW;AACtBxE,QAAAA,UAAU,EAAElB,MAAO;AACnBiB,QAAAA,QAAQ,EAAE0D,gBAAiB;AAC3BrF,QAAAA,KAAK,EAAEE,gBAAiB;AACxB8B,QAAAA,EAAE,EAAEnB,aAAa,GAAGoB,SAAS,GAAG,MAAO;QACvCE,OAAO,EAAExB,aAAa,GAAGwB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAE;AAAAX,QAAAA,QAAA,EAEzC4D,oBAAAA;OACO,CACX,EACAzB,eAAe;AAAA;AACd;AACA;AACAlC,MAAAA,GAAA,CAAC6D,OAAAA;AACC;AACA;AAAA,QAAA;AACAe,QAAAA,iBAAiB,EAAEnG,gBAAiB;AACpCoG,QAAAA,iBAAiB,EAAE1H,IAAI,KAAK,MAAM,GAAG,MAAM,GAAG,SAAU;AACxD2H,QAAAA,iBAAiB,EAAC,OAAO;AACzBP,QAAAA,QAAQ,EAAC,UAAU;AACnBQ,QAAAA,KAAK,EAAC,MAAM;AACZC,QAAAA,GAAG,EAAC,KAAA;AAAK,OACV,CACF,CAAA;KACM,CAAA;AAAC,GAAA,CACH,CAAC,CAAA;AAEd,CAAC,CAAA;AAEKb,IAAAA,MAAM,gBAAGc,wBAAwB,eAACrF,cAAK,CAACsF,UAAU,CAAC3D,OAAO,CAAC,EAAE;AACjE4D,EAAAA,WAAW,EAAE,QAAQ;AACrBC,EAAAA,WAAW,EAAE,QAAA;AACf,CAAC;;;;"}
@@ -5541,6 +5541,12 @@ type AmountCommonProps = {
5541
5541
  * @default false
5542
5542
  */
5543
5543
  isStrikethrough?: boolean;
5544
+ /**
5545
+ * Controls the number of decimal places to display when suffix is 'decimals'.
5546
+ *
5547
+ * @default 2
5548
+ */
5549
+ fractionDigits?: number;
5544
5550
  } & TestID & DataAnalyticsAttribute & StyledPropsBlade;
5545
5551
  type AmountProps = AmountTypeProps & AmountCommonProps;
5546
5552
  declare const Amount: React__default.ForwardRefExoticComponent<AmountProps & React__default.RefAttributes<BladeElementRef>>;
@@ -4676,6 +4676,12 @@ type AmountCommonProps = {
4676
4676
  * @default false
4677
4677
  */
4678
4678
  isStrikethrough?: boolean;
4679
+ /**
4680
+ * Controls the number of decimal places to display when suffix is 'decimals'.
4681
+ *
4682
+ * @default 2
4683
+ */
4684
+ fractionDigits?: number;
4679
4685
  } & TestID & DataAnalyticsAttribute & StyledPropsBlade;
4680
4686
  type AmountProps = AmountTypeProps & AmountCommonProps;
4681
4687
  declare const Amount: React__default.ForwardRefExoticComponent<AmountProps & React__default.RefAttributes<BladeElementRef>>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@razorpay/blade",
3
3
  "description": "The Design System that powers Razorpay",
4
- "version": "12.27.0",
4
+ "version": "12.28.0",
5
5
  "license": "MIT",
6
6
  "engines": {
7
7
  "node": ">=18.12.1"