@razorpay/blade 11.1.1 → 11.2.1
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.
- package/build/lib/native/components/Amount/Amount.js +4 -3
- package/build/lib/native/components/Amount/Amount.js.map +1 -1
- package/build/lib/native/components/Amount/amountTokens.js +2 -2
- package/build/lib/native/components/Amount/amountTokens.js.map +1 -1
- package/build/lib/native/components/Dropdown/Dropdown.js +1 -1
- package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/development/components/Amount/Amount.js +107 -106
- package/build/lib/web/development/components/Amount/Amount.js.map +1 -1
- package/build/lib/web/development/components/Amount/amountTokens.js +1 -415
- package/build/lib/web/development/components/Amount/amountTokens.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js +1 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js +15 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
- package/build/lib/web/production/components/Amount/Amount.js +107 -106
- package/build/lib/web/production/components/Amount/Amount.js.map +1 -1
- package/build/lib/web/production/components/Amount/amountTokens.js +1 -415
- package/build/lib/web/production/components/Amount/amountTokens.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js +1 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js +15 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
- package/build/types/components/index.d.ts +4 -384
- package/build/types/components/index.native.d.ts +4 -384
- package/package.json +6 -3
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
1
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { formatNumber, formatNumberByParts } from '@razorpay/i18nify-js/currency';
|
|
5
|
+
import { subtleFontSizes, normalAmountSizes, amountLineHeights } from './amountTokens.js';
|
|
5
6
|
import '../Box/BaseBox/index.js';
|
|
6
7
|
import '../../utils/index.js';
|
|
7
8
|
import '../../utils/metaAttribute/index.js';
|
|
@@ -37,7 +38,7 @@ var getTextColorProps = function getTextColorProps(_ref) {
|
|
|
37
38
|
return props;
|
|
38
39
|
};
|
|
39
40
|
var AmountValue = function AmountValue(_ref2) {
|
|
40
|
-
var
|
|
41
|
+
var amount = _ref2.amount,
|
|
41
42
|
_ref2$size = _ref2.size,
|
|
42
43
|
size = _ref2$size === void 0 ? 'medium' : _ref2$size,
|
|
43
44
|
_ref2$type = _ref2.type,
|
|
@@ -51,9 +52,6 @@ var AmountValue = function AmountValue(_ref2) {
|
|
|
51
52
|
var affixFontSize = isAffixSubtle ? subtleFontSizes[type][size] : normalAmountSizes[type][size];
|
|
52
53
|
var numberFontFamily = type === 'body' ? 'text' : 'heading';
|
|
53
54
|
if (suffix === 'decimals' && isAffixSubtle) {
|
|
54
|
-
var integer = value.split('.')[0];
|
|
55
|
-
var decimal = value.split('.')[1];
|
|
56
|
-
|
|
57
55
|
// Native does not support alignItems of Text inside a div, instead we need to wrap is in a Text
|
|
58
56
|
var AmountWrapper = isReactNative ? Text : React__default.Fragment;
|
|
59
57
|
return /*#__PURE__*/jsxs(AmountWrapper, {
|
|
@@ -64,7 +62,7 @@ var AmountValue = function AmountValue(_ref2) {
|
|
|
64
62
|
color: amountValueColor,
|
|
65
63
|
fontFamily: numberFontFamily,
|
|
66
64
|
as: isReactNative ? undefined : 'span',
|
|
67
|
-
children: integer
|
|
65
|
+
children: amount.integer
|
|
68
66
|
}), /*#__PURE__*/jsxs(BaseText, {
|
|
69
67
|
fontWeight: weight,
|
|
70
68
|
fontSize: affixFontSize,
|
|
@@ -72,7 +70,7 @@ var AmountValue = function AmountValue(_ref2) {
|
|
|
72
70
|
color: amountValueColor,
|
|
73
71
|
as: isReactNative ? undefined : 'span',
|
|
74
72
|
opacity: isAffixSubtle ? opacity[8] : 1,
|
|
75
|
-
children: [
|
|
73
|
+
children: [amount.decimal, amount.fraction]
|
|
76
74
|
})]
|
|
77
75
|
});
|
|
78
76
|
}
|
|
@@ -82,99 +80,93 @@ var AmountValue = function AmountValue(_ref2) {
|
|
|
82
80
|
fontFamily: numberFontFamily,
|
|
83
81
|
color: amountValueColor,
|
|
84
82
|
lineHeight: amountLineHeights[type][size],
|
|
85
|
-
children:
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// This function rounds a number to a specified number of decimal places
|
|
90
|
-
// and floors the result.
|
|
91
|
-
var getFlooredFixed = function getFlooredFixed(value, decimalPlaces) {
|
|
92
|
-
var factor = Math.pow(100, decimalPlaces);
|
|
93
|
-
var roundedValue = Math.floor(value * factor) / factor;
|
|
94
|
-
return Number(roundedValue.toFixed(decimalPlaces));
|
|
95
|
-
};
|
|
96
|
-
var addCommas = function addCommas(amountValue, currency) {
|
|
97
|
-
var decimalPlaces = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
98
|
-
// If the currency is 'INR', set the locale to 'en-IN' (Indian English).
|
|
99
|
-
// Otherwise, set the locale to 'en-US' (U.S. English).
|
|
100
|
-
var locale = currency === 'INR' ? 'en-IN' : 'en-US';
|
|
101
|
-
return amountValue.toLocaleString(locale, {
|
|
102
|
-
minimumFractionDigits: decimalPlaces
|
|
83
|
+
children: amount.formatted
|
|
103
84
|
});
|
|
104
85
|
};
|
|
105
86
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
87
|
+
* Returns a parsed object based on the suffix passed in parameters
|
|
88
|
+
* === Logic ===
|
|
89
|
+
* value = 12500.45
|
|
90
|
+
* if suffix === 'decimals' => {
|
|
91
|
+
"formatted": "12,500.45",
|
|
92
|
+
"integer": "12,500",
|
|
93
|
+
"decimal": ".",
|
|
94
|
+
"fraction": "45",
|
|
95
|
+
"isPrefixSymbol": false,
|
|
96
|
+
"rawParts": [{"type": "integer","value": "12"},{"type": "group","value": ","},{"type": "integer","value": "500"},{"type": "decimal","value": "."},{"type": "fraction","value": "45"}]
|
|
97
|
+
}
|
|
98
|
+
* else if suffix === 'humanize' => { formatted: "1.2T" }
|
|
99
|
+
* else => { formatted: "1,23,456" }
|
|
100
|
+
* @returns {AmountType}
|
|
109
101
|
*/
|
|
110
|
-
var
|
|
111
|
-
var
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
102
|
+
var formatAmountWithSuffix = function formatAmountWithSuffix(_ref3) {
|
|
103
|
+
var suffix = _ref3.suffix,
|
|
104
|
+
value = _ref3.value;
|
|
105
|
+
try {
|
|
106
|
+
switch (suffix) {
|
|
107
|
+
case 'decimals':
|
|
108
|
+
{
|
|
109
|
+
var options = {
|
|
110
|
+
intlOptions: {
|
|
111
|
+
maximumFractionDigits: 2,
|
|
112
|
+
minimumFractionDigits: 2
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
return _objectSpread(_objectSpread({}, formatNumberByParts(value, options)), {}, {
|
|
116
|
+
formatted: formatNumber(value, options)
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
case 'humanize':
|
|
120
|
+
{
|
|
121
|
+
var formatted = formatNumber(value, {
|
|
122
|
+
intlOptions: {
|
|
123
|
+
notation: 'compact'
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
formatted: formatted
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
default:
|
|
131
|
+
{
|
|
132
|
+
var _formatted = formatNumber(value, {
|
|
133
|
+
intlOptions: {
|
|
134
|
+
maximumFractionDigits: 0,
|
|
135
|
+
roundingMode: 'floor'
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return {
|
|
139
|
+
formatted: _formatted
|
|
140
|
+
};
|
|
141
|
+
}
|
|
125
142
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
};
|
|
130
|
-
var formatAmountWithSuffix = function formatAmountWithSuffix(_ref4) {
|
|
131
|
-
var suffix = _ref4.suffix,
|
|
132
|
-
value = _ref4.value,
|
|
133
|
-
currency = _ref4.currency,
|
|
134
|
-
denominationPosition = _ref4.denominationPosition;
|
|
135
|
-
switch (suffix) {
|
|
136
|
-
case 'decimals':
|
|
137
|
-
{
|
|
138
|
-
var decimalNumber = getFlooredFixed(value, 2);
|
|
139
|
-
return addCommas(decimalNumber, currency, 2);
|
|
140
|
-
}
|
|
141
|
-
case 'humanize':
|
|
142
|
-
{
|
|
143
|
-
return getHumanizedAmount({
|
|
144
|
-
value: value,
|
|
145
|
-
currency: currency,
|
|
146
|
-
denominationPosition: denominationPosition
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
case 'none':
|
|
150
|
-
{
|
|
151
|
-
return addCommas(getFlooredFixed(value, 0), currency);
|
|
152
|
-
}
|
|
153
|
-
default:
|
|
154
|
-
return addCommas(getFlooredFixed(value, 0), currency);
|
|
143
|
+
} catch (err) {
|
|
144
|
+
return {
|
|
145
|
+
formatted: "".concat(value)
|
|
146
|
+
};
|
|
155
147
|
}
|
|
156
148
|
};
|
|
157
|
-
var _Amount = function _Amount(
|
|
158
|
-
var value =
|
|
159
|
-
|
|
160
|
-
suffix =
|
|
161
|
-
|
|
162
|
-
type =
|
|
163
|
-
|
|
164
|
-
size =
|
|
165
|
-
|
|
166
|
-
weight =
|
|
167
|
-
|
|
168
|
-
isAffixSubtle =
|
|
169
|
-
|
|
170
|
-
isStrikethrough =
|
|
171
|
-
color =
|
|
172
|
-
|
|
173
|
-
currencyIndicator =
|
|
174
|
-
|
|
175
|
-
currency =
|
|
176
|
-
testID =
|
|
177
|
-
styledProps = _objectWithoutProperties(
|
|
149
|
+
var _Amount = function _Amount(_ref4) {
|
|
150
|
+
var value = _ref4.value,
|
|
151
|
+
_ref4$suffix = _ref4.suffix,
|
|
152
|
+
suffix = _ref4$suffix === void 0 ? 'decimals' : _ref4$suffix,
|
|
153
|
+
_ref4$type = _ref4.type,
|
|
154
|
+
type = _ref4$type === void 0 ? 'body' : _ref4$type,
|
|
155
|
+
_ref4$size = _ref4.size,
|
|
156
|
+
size = _ref4$size === void 0 ? 'medium' : _ref4$size,
|
|
157
|
+
_ref4$weight = _ref4.weight,
|
|
158
|
+
weight = _ref4$weight === void 0 ? 'regular' : _ref4$weight,
|
|
159
|
+
_ref4$isAffixSubtle = _ref4.isAffixSubtle,
|
|
160
|
+
isAffixSubtle = _ref4$isAffixSubtle === void 0 ? true : _ref4$isAffixSubtle,
|
|
161
|
+
_ref4$isStrikethrough = _ref4.isStrikethrough,
|
|
162
|
+
isStrikethrough = _ref4$isStrikethrough === void 0 ? false : _ref4$isStrikethrough,
|
|
163
|
+
color = _ref4.color,
|
|
164
|
+
_ref4$currencyIndicat = _ref4.currencyIndicator,
|
|
165
|
+
currencyIndicator = _ref4$currencyIndicat === void 0 ? 'currency-symbol' : _ref4$currencyIndicat,
|
|
166
|
+
_ref4$currency = _ref4.currency,
|
|
167
|
+
currency = _ref4$currency === void 0 ? 'INR' : _ref4$currency,
|
|
168
|
+
testID = _ref4.testID,
|
|
169
|
+
styledProps = _objectWithoutProperties(_ref4, _excluded);
|
|
178
170
|
if (true) {
|
|
179
171
|
if (typeof value !== 'number') {
|
|
180
172
|
throwBladeError({
|
|
@@ -211,19 +203,27 @@ var _Amount = function _Amount(_ref5) {
|
|
|
211
203
|
});
|
|
212
204
|
}
|
|
213
205
|
}
|
|
214
|
-
var currencySymbolOrCode = currencyIndicatorMapping[currency][currencyIndicator];
|
|
215
|
-
var currencyPosition = currencyPositionMapping[currency] || 'left';
|
|
216
|
-
var denominationPosition = currencyPosition === 'left' ? 'right' : 'left';
|
|
217
|
-
var renderedValue = formatAmountWithSuffix({
|
|
218
|
-
suffix: suffix,
|
|
219
|
-
value: value,
|
|
220
|
-
currency: currency,
|
|
221
|
-
denominationPosition: denominationPosition
|
|
222
|
-
});
|
|
223
206
|
var _getTextColorProps = getTextColorProps({
|
|
224
207
|
color: color
|
|
225
208
|
}),
|
|
226
209
|
amountValueColor = _getTextColorProps.amountValueColor;
|
|
210
|
+
var isPrefixSymbol, currencySymbol;
|
|
211
|
+
try {
|
|
212
|
+
var byParts = formatNumberByParts(value, {
|
|
213
|
+
currency: currency
|
|
214
|
+
});
|
|
215
|
+
isPrefixSymbol = byParts.isPrefixSymbol;
|
|
216
|
+
currencySymbol = byParts.currency;
|
|
217
|
+
} catch (err) {
|
|
218
|
+
isPrefixSymbol = true;
|
|
219
|
+
currencySymbol = currency;
|
|
220
|
+
}
|
|
221
|
+
var currencyPosition = isPrefixSymbol ? 'left' : 'right';
|
|
222
|
+
var renderedValue = formatAmountWithSuffix({
|
|
223
|
+
suffix: suffix,
|
|
224
|
+
value: value
|
|
225
|
+
});
|
|
226
|
+
var currencySymbolOrCode = currencyIndicator === 'currency-symbol' ? currencySymbol : currency;
|
|
227
227
|
var currencyFontSize = isAffixSubtle ? subtleFontSizes[type][size] : normalAmountSizes[type][size];
|
|
228
228
|
var isReactNative = getPlatformType() === 'react-native';
|
|
229
229
|
return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread({
|
|
@@ -247,13 +247,14 @@ var _Amount = function _Amount(_ref5) {
|
|
|
247
247
|
opacity: isAffixSubtle ? opacity[8] : 1,
|
|
248
248
|
children: currencySymbolOrCode
|
|
249
249
|
}), /*#__PURE__*/jsx(AmountValue, {
|
|
250
|
-
|
|
250
|
+
amount: renderedValue,
|
|
251
251
|
amountValueColor: amountValueColor,
|
|
252
252
|
type: type,
|
|
253
253
|
weight: weight,
|
|
254
254
|
size: size,
|
|
255
255
|
isAffixSubtle: isAffixSubtle,
|
|
256
|
-
suffix: suffix
|
|
256
|
+
suffix: suffix,
|
|
257
|
+
currency: currency
|
|
257
258
|
}), currencyPosition === 'right' && /*#__PURE__*/jsx(BaseText, {
|
|
258
259
|
marginLeft: "spacing.1",
|
|
259
260
|
fontWeight: weight,
|
|
@@ -280,5 +281,5 @@ var Amount = /*#__PURE__*/assignWithoutSideEffects(_Amount, {
|
|
|
280
281
|
componentId: 'Amount'
|
|
281
282
|
});
|
|
282
283
|
|
|
283
|
-
export { Amount,
|
|
284
|
+
export { Amount, formatAmountWithSuffix };
|
|
284
285
|
//# 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 { AmountTypeProps, Currency } from './amountTokens';\nimport {\n normalAmountSizes,\n getCurrencyAbbreviations,\n currencyIndicatorMapping,\n subtleFontSizes,\n amountLineHeights,\n currencyPositionMapping,\n} from './amountTokens';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { 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';\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 * @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?: Currency;\n /**\n * If true, the amount text will have a line through it.\n *\n * @default false\n */\n isStrikethrough?: boolean;\n} & TestID &\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\ninterface AmountValue extends Omit<AmountProps, 'value'> {\n amountValueColor: BaseTextProps['color'];\n value: string;\n size: Exclude<AmountProps['size'], undefined>;\n}\n\nconst AmountValue = ({\n value,\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 const integer = value.split('.')[0];\n const decimal = value.split('.')[1];\n\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 {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[8] : 1}\n >\n .{decimal || '00'}\n </BaseText>\n </AmountWrapper>\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 {value}\n </BaseText>\n );\n};\n\n// This function rounds a number to a specified number of decimal places\n// and floors the result.\nexport const getFlooredFixed = (value: number, decimalPlaces: number): number => {\n const factor = 100 ** decimalPlaces;\n const roundedValue = Math.floor(value * factor) / factor;\n return Number(roundedValue.toFixed(decimalPlaces));\n};\n\nexport const addCommas = (amountValue: number, currency: Currency, decimalPlaces = 0): string => {\n // If the currency is 'INR', set the locale to 'en-IN' (Indian English).\n // Otherwise, set the locale to 'en-US' (U.S. English).\n const locale = currency === 'INR' ? 'en-IN' : 'en-US';\n return amountValue.toLocaleString(locale, { minimumFractionDigits: decimalPlaces });\n};\n/**\n * This function returns the humanized amount\n * ie: for INR 2000 => 2K\n * for MYR 2000000 => 2M\n */\nexport const getHumanizedAmount = ({\n value,\n currency,\n denominationPosition = 'right',\n}: {\n value: number;\n currency: Currency;\n denominationPosition?: 'left' | 'right';\n}): string => {\n let amountValue = value;\n const abbreviations = getCurrencyAbbreviations(currency);\n const abbreviation = abbreviations.find((abbr) => amountValue >= abbr.value);\n\n if (abbreviation) {\n amountValue = amountValue / abbreviation.value;\n const formattedAmountValue = getFlooredFixed(amountValue, 2);\n\n if (denominationPosition === 'right') {\n return `${addCommas(formattedAmountValue, currency)}${abbreviation.symbol}`;\n }\n\n return `${abbreviation.symbol}${addCommas(formattedAmountValue, currency)}`;\n }\n\n return amountValue.toString();\n};\n\ntype FormatAmountWithSuffixType = {\n suffix: AmountProps['suffix'];\n value: number;\n currency: Currency;\n denominationPosition?: 'left' | 'right';\n};\n\nexport const formatAmountWithSuffix = ({\n suffix,\n value,\n currency,\n denominationPosition,\n}: FormatAmountWithSuffixType): string => {\n switch (suffix) {\n case 'decimals': {\n const decimalNumber = getFlooredFixed(value, 2);\n return addCommas(decimalNumber, currency, 2);\n }\n case 'humanize': {\n return getHumanizedAmount({ value, currency, denominationPosition });\n }\n case 'none': {\n return addCommas(getFlooredFixed(value, 0), currency);\n }\n default:\n return addCommas(getFlooredFixed(value, 0), currency);\n }\n};\n\nconst _Amount = ({\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 ...styledProps\n}: AmountProps): 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 currencySymbolOrCode = currencyIndicatorMapping[currency][currencyIndicator];\n const currencyPosition = currencyPositionMapping[currency] || 'left';\n const denominationPosition = currencyPosition === 'left' ? 'right' : 'left';\n const renderedValue = formatAmountWithSuffix({ suffix, value, currency, denominationPosition });\n const { amountValueColor } = getTextColorProps({\n color,\n });\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 display={(isReactNative ? 'flex' : 'inline-flex') as never}\n flexDirection=\"row\"\n {...metaAttribute({ name: MetaConstants.Amount, testID })}\n {...getStyledProps(styledProps)}\n >\n <BaseBox\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n alignItems=\"baseline\"\n flexDirection=\"row\"\n position=\"relative\"\n >\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[8] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n <AmountValue\n value={renderedValue}\n amountValueColor={amountValueColor}\n type={type}\n weight={weight}\n size={size}\n isAffixSubtle={isAffixSubtle}\n suffix={suffix}\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[8] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n {isStrikethrough && (\n <BaseBox\n // @ts-expect-error - 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(_Amount, {\n displayName: 'Amount',\n componentId: 'Amount',\n});\n\nexport type { AmountProps };\nexport { Amount };\n"],"names":["getTextColorProps","_ref","color","props","amountValueColor","AmountValue","_ref2","value","_ref2$size","size","_ref2$type","type","_ref2$weight","weight","isAffixSubtle","suffix","isReactNative","getPlatformType","affixFontSize","subtleFontSizes","normalAmountSizes","numberFontFamily","integer","split","decimal","AmountWrapper","Text","React","Fragment","_jsxs","children","_jsx","BaseText","fontSize","fontWeight","lineHeight","amountLineHeights","fontFamily","as","undefined","opacity","getFlooredFixed","decimalPlaces","factor","Math","pow","roundedValue","floor","Number","toFixed","addCommas","amountValue","currency","arguments","length","locale","toLocaleString","minimumFractionDigits","getHumanizedAmount","_ref3","_ref3$denominationPos","denominationPosition","abbreviations","getCurrencyAbbreviations","abbreviation","find","abbr","formattedAmountValue","concat","symbol","toString","formatAmountWithSuffix","_ref4","decimalNumber","_Amount","_ref5","_ref5$suffix","_ref5$type","_ref5$size","_ref5$weight","_ref5$isAffixSubtle","_ref5$isStrikethrough","isStrikethrough","_ref5$currencyIndicat","currencyIndicator","_ref5$currency","testID","styledProps","_objectWithoutProperties","_excluded","throwBladeError","message","moduleName","bodySizes","objectKeysWithType","body","includes","displaySizes","display","headingSizes","heading","currencySymbolOrCode","currencyIndicatorMapping","currencyPosition","currencyPositionMapping","renderedValue","_getTextColorProps","currencyFontSize","BaseBox","_objectSpread","flexDirection","metaAttribute","name","MetaConstants","Amount","getStyledProps","alignItems","position","marginRight","marginLeft","borderBottomColor","borderBottomWidth","borderBottomStyle","width","top","assignWithoutSideEffects","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAA+D;AAAA,EAAA,IAAzDC,KAAK,GAAAD,IAAA,CAALC,KAAK,CAAA;AAChC,EAAA,IAAMC,KAAiB,GAAG;AACxBC,IAAAA,gBAAgB,EAAE,0BAAA;GACnB,CAAA;AACD,EAAA,IAAI,CAACF,KAAK,EAAE,OAAOC,KAAK,CAAA;EACxBA,KAAK,CAACC,gBAAgB,GAAGF,KAAK,CAAA;AAC9B,EAAA,OAAOC,KAAK,CAAA;AACd,CAAC,CAAA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AE,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 { formatNumber, 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 { 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';\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 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>> & { formatted: string };\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[8] : 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.formatted}\n </BaseText>\n );\n};\n\ntype FormatAmountWithSuffixType = {\n suffix: AmountProps['suffix'];\n value: 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 \"formatted\": \"12,500.45\",\n \"integer\": \"12,500\",\n \"decimal\": \".\",\n \"fraction\": \"45\",\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 * else if suffix === 'humanize' => { formatted: \"1.2T\" }\n * else => { formatted: \"1,23,456\" }\n * @returns {AmountType}\n */\nexport const formatAmountWithSuffix = ({\n suffix,\n value,\n}: FormatAmountWithSuffixType): AmountType => {\n try {\n switch (suffix) {\n case 'decimals': {\n const options = {\n intlOptions: {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n },\n };\n return {\n ...formatNumberByParts(value, options),\n formatted: formatNumber(value, options),\n };\n }\n case 'humanize': {\n const formatted = formatNumber(value, {\n intlOptions: {\n notation: 'compact',\n },\n });\n return {\n formatted,\n };\n }\n\n default: {\n const formatted = formatNumber(value, {\n intlOptions: {\n maximumFractionDigits: 0,\n roundingMode: 'floor',\n },\n });\n return {\n formatted,\n };\n }\n }\n } catch (err: unknown) {\n return {\n formatted: `${value}`,\n };\n }\n};\n\nconst _Amount = ({\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 ...styledProps\n}: AmountProps): 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 let isPrefixSymbol, currencySymbol;\n try {\n const byParts = formatNumberByParts(value, {\n currency,\n });\n isPrefixSymbol = byParts.isPrefixSymbol;\n currencySymbol = byParts.currency;\n } catch (err: unknown) {\n isPrefixSymbol = true;\n currencySymbol = currency;\n }\n\n const currencyPosition = isPrefixSymbol ? 'left' : 'right';\n const renderedValue = formatAmountWithSuffix({ suffix, value });\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 display={(isReactNative ? 'flex' : 'inline-flex') as never}\n flexDirection=\"row\"\n {...metaAttribute({ name: MetaConstants.Amount, testID })}\n {...getStyledProps(styledProps)}\n >\n <BaseBox\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n alignItems=\"baseline\"\n flexDirection=\"row\"\n position=\"relative\"\n >\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[8] : 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[8] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n {isStrikethrough && (\n <BaseBox\n // @ts-expect-error - 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(_Amount, {\n displayName: 'Amount',\n componentId: 'Amount',\n});\n\nexport type { AmountProps };\nexport { Amount };\n"],"names":["getTextColorProps","_ref","color","props","amountValueColor","AmountValue","_ref2","amount","_ref2$size","size","_ref2$type","type","_ref2$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","decimal","fraction","formatted","formatAmountWithSuffix","_ref3","value","options","intlOptions","maximumFractionDigits","minimumFractionDigits","_objectSpread","formatNumberByParts","formatNumber","notation","roundingMode","err","concat","_Amount","_ref4","_ref4$suffix","_ref4$type","_ref4$size","_ref4$weight","_ref4$isAffixSubtle","_ref4$isStrikethrough","isStrikethrough","_ref4$currencyIndicat","currencyIndicator","_ref4$currency","currency","testID","styledProps","_objectWithoutProperties","_excluded","throwBladeError","message","moduleName","bodySizes","objectKeysWithType","body","includes","displaySizes","display","headingSizes","heading","_getTextColorProps","isPrefixSymbol","currencySymbol","byParts","currencyPosition","renderedValue","currencySymbolOrCode","currencyFontSize","BaseBox","flexDirection","metaAttribute","name","MetaConstants","Amount","getStyledProps","alignItems","position","marginRight","marginLeft","borderBottomColor","borderBottomWidth","borderBottomStyle","width","top","assignWithoutSideEffects","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAA+D;AAAA,EAAA,IAAzDC,KAAK,GAAAD,IAAA,CAALC,KAAK,CAAA;AAChC,EAAA,IAAMC,KAAiB,GAAG;AACxBC,IAAAA,gBAAgB,EAAE,0BAAA;GACnB,CAAA;AACD,EAAA,IAAI,CAACF,KAAK,EAAE,OAAOC,KAAK,CAAA;EACxBA,KAAK,CAACC,gBAAgB,GAAGF,KAAK,CAAA;AAC9B,EAAA,OAAOC,KAAK,CAAA;AACd,CAAC,CAAA;AAUD,IAAME,WAAW,GAAG,SAAdA,WAAWA,CAAAC,KAAA,EAQgB;AAAA,EAAA,IAP/BC,MAAM,GAAAD,KAAA,CAANC,MAAM;IAAAC,UAAA,GAAAF,KAAA,CACNG,IAAI;AAAJA,IAAAA,IAAI,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,UAAA;IAAAE,UAAA,GAAAJ,KAAA,CACfK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,UAAA;IAAAE,YAAA,GAAAN,KAAA,CACbO,MAAM;AAANA,IAAAA,MAAM,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,SAAS,GAAAA,YAAA;IAClBR,gBAAgB,GAAAE,KAAA,CAAhBF,gBAAgB;IAChBU,aAAa,GAAAR,KAAA,CAAbQ,aAAa;IACbC,M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