@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,6 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { formatNumberByParts, formatNumber } from '@razorpay/i18nify-js/currency';
|
|
4
|
+
import { subtleFontSizes, normalAmountSizes, amountLineHeights } from './amountTokens.js';
|
|
4
5
|
import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
|
|
5
6
|
import 'react-native';
|
|
6
7
|
import { getPlatformType } from '../../utils/getPlatformType/getPlatformType.js';
|
|
@@ -20,7 +21,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
20
21
|
import { Text } from '../Typography/Text/Text.js';
|
|
21
22
|
import '../Typography/Code/Code.js';
|
|
22
23
|
|
|
23
|
-
var _excluded=["value","suffix","type","size","weight","isAffixSubtle","isStrikethrough","color","currencyIndicator","currency","testID"];var getTextColorProps=function getTextColorProps(_ref){var color=_ref.color;var props={amountValueColor:'surface.text.gray.normal'};if(!color)return props;props.amountValueColor=color;return props;};var AmountValue=function AmountValue(_ref2){var
|
|
24
|
+
var _excluded=["value","suffix","type","size","weight","isAffixSubtle","isStrikethrough","color","currencyIndicator","currency","testID"];var getTextColorProps=function getTextColorProps(_ref){var color=_ref.color;var props={amountValueColor:'surface.text.gray.normal'};if(!color)return props;props.amountValueColor=color;return props;};var AmountValue=function AmountValue(_ref2){var amount=_ref2.amount,_ref2$size=_ref2.size,size=_ref2$size===void 0?'medium':_ref2$size,_ref2$type=_ref2.type,type=_ref2$type===void 0?'body':_ref2$type,_ref2$weight=_ref2.weight,weight=_ref2$weight===void 0?'regular':_ref2$weight,amountValueColor=_ref2.amountValueColor,isAffixSubtle=_ref2.isAffixSubtle,suffix=_ref2.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[8]:1,children:[amount.decimal,amount.fraction]})]});}return jsx(BaseText,{fontSize:normalAmountSizes[type][size],fontWeight:weight,fontFamily:numberFontFamily,color:amountValueColor,lineHeight:amountLineHeights[type][size],children:amount.formatted});};var formatAmountWithSuffix=function formatAmountWithSuffix(_ref3){var suffix=_ref3.suffix,value=_ref3.value;try{switch(suffix){case'decimals':{var options={intlOptions:{maximumFractionDigits:2,minimumFractionDigits:2}};return Object.assign({},formatNumberByParts(value,options),{formatted:formatNumber(value,options)});}case'humanize':{var formatted=formatNumber(value,{intlOptions:{notation:'compact'}});return {formatted:formatted};}default:{var _formatted=formatNumber(value,{intlOptions:{maximumFractionDigits:0,roundingMode:'floor'}});return {formatted:_formatted};}}}catch(err){return {formatted:`${value}`};}};var _Amount=function _Amount(_ref4){var value=_ref4.value,_ref4$suffix=_ref4.suffix,suffix=_ref4$suffix===void 0?'decimals':_ref4$suffix,_ref4$type=_ref4.type,type=_ref4$type===void 0?'body':_ref4$type,_ref4$size=_ref4.size,size=_ref4$size===void 0?'medium':_ref4$size,_ref4$weight=_ref4.weight,weight=_ref4$weight===void 0?'regular':_ref4$weight,_ref4$isAffixSubtle=_ref4.isAffixSubtle,isAffixSubtle=_ref4$isAffixSubtle===void 0?true:_ref4$isAffixSubtle,_ref4$isStrikethrough=_ref4.isStrikethrough,isStrikethrough=_ref4$isStrikethrough===void 0?false:_ref4$isStrikethrough,color=_ref4.color,_ref4$currencyIndicat=_ref4.currencyIndicator,currencyIndicator=_ref4$currencyIndicat===void 0?'currency-symbol':_ref4$currencyIndicat,_ref4$currency=_ref4.currency,currency=_ref4$currency===void 0?'INR':_ref4$currency,testID=_ref4.testID,styledProps=_objectWithoutProperties(_ref4,_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 isPrefixSymbol,currencySymbol;try{var byParts=formatNumberByParts(value,{currency:currency});isPrefixSymbol=byParts.isPrefixSymbol;currencySymbol=byParts.currency;}catch(err){isPrefixSymbol=true;currencySymbol=currency;}var currencyPosition=isPrefixSymbol?'left':'right';var renderedValue=formatAmountWithSuffix({suffix:suffix,value:value});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({display:isReactNative?'flex':'inline-flex',flexDirection:"row"},metaAttribute({name:MetaConstants.Amount,testID:testID}),getStyledProps(styledProps),{children:jsxs(BaseBox,{display:isReactNative?'flex':'inline-flex',alignItems:"baseline",flexDirection:"row",position:"relative",children:[currencyPosition==='left'&&jsx(BaseText,{marginRight:"spacing.1",fontWeight:weight,fontSize:currencyFontSize,color:amountValueColor,as:isReactNative?undefined:'span',opacity:isAffixSubtle?opacity[8]: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[8]:1,children:currencySymbolOrCode}),isStrikethrough&&jsx(BaseBox,{borderBottomColor:amountValueColor,borderBottomWidth:type==='body'?'thin':'thicker',borderBottomStyle:"solid",position:"absolute",width:"100%",top:"50%"})]})}));};var Amount=assignWithoutSideEffects(_Amount,{displayName:'Amount',componentId:'Amount'});
|
|
24
25
|
|
|
25
|
-
export { Amount,
|
|
26
|
+
export { Amount, formatAmountWithSuffix };
|
|
26
27
|
//# 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","roundedValue","Math","floor","Number","toFixed","addCommas","amountValue","currency","arguments","length","locale","toLocaleString","minimumFractionDigits","getHumanizedAmount","_ref3","_ref3$denominationPos","denominationPosition","abbreviations","getCurrencyAbbreviations","abbreviation","find","abbr","formattedAmountValue","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","__DEV__","throwBladeError","message","moduleName","bodySizes","objectKeysWithType","body","includes","displaySizes","display","headingSizes","heading","currencySymbolOrCode","currencyIndicatorMapping","currencyPosition","currencyPositionMapping","renderedValue","_getTextColorProps","currencyFontSize","BaseBox","Object","assign","flexDirection","metaAttribute","name","MetaConstants","Amount","getStyledProps","alignItems","position","marginRight","marginLeft","borderBottomColor","borderBottomWidth","borderBottomStyle","width","top","assignWithoutSideEffects","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,QAAA,CAAA,MAAA,CAAA,MAAA,CAAA,QAAA,CAAA,eAAA,CAAA,iBAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,UAAA,CAAA,QAAA,CAAA,CA6EA,IAAMA,iBAAiB,CAAG,SAApBA,iBAAiBA,CAAAC,IAAA,CAA+D,CAAA,IAAzDC,KAAK,CAAAD,IAAA,CAALC,KAAK,CAChC,IAAMC,KAAiB,CAAG,CACxBC,gBAAgB,CAAE,0BACpB,CAAC,CACD,GAAI,CAACF,KAAK,CAAE,OAAOC,KAAK,CACxBA,KAAK,CAACC,gBAAgB,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O,CAChB,CAAC,CACDuF,gBAAgB,GAAK,OAAO,EAC3BvE,GAAA,CAACC,QAAQ,CAAA,CACPuF,UAAU,CAAC,WAAW,CACtBrF,UAAU,CAAErB,MAAO,CACnBoB,QAAQ,CAAEyE,gBAAiB,CAC3BxG,KAAK,CAAEE,gBAAiB,CACxBkC,EAAE,CAAEtB,aAAa,CAAGuB,SAAS,CAAG,MAAO,CACvCC,OAAO,CAAE1B,aAAa,CAAG0B,OAAO,CAAC,CAAC,CAAC,CAAG,CAAE,CAAAV,QAAA,CAEvCsE,oBAAoB,CACb,CACX,CACApB,eAAe,EACdjD,GAAA,CAAC4E,OAAO,CAAA,CAENa,iBAAiB,CAAEpH,gBAAiB,CACpCqH,iBAAiB,CAAE9G,IAAI,GAAK,MAAM,CAAG,MAAM,CAAG,SAAU,CACxD+G,iBAAiB,CAAC,OAAO,CACzBL,QAAQ,CAAC,UAAU,CACnBM,KAAK,CAAC,MAAM,CACZC,GAAG,CAAC,KAAK,CACV,CACF,CACM,CAAA,CAAC,EACH,CAAC,CAEd,CAAC,CAEK,IAAAV,MAAM,CAAGW,wBAAwB,CAACrD,OAAO,CAAE,CAC/CsD,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 { 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","Object","assign","formatNumberByParts","formatNumber","notation","roundingMode","err","_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","__DEV__","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":";;;;;;;;;;;;;;;;;;;;;;;AACA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,QAAA,CAAA,MAAA,CAAA,MAAA,CAAA,QAAA,CAAA,eAAA,CAAA,iBAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,UAAA,CAAA,QAAA,CAAA,CA0EA,IAAMA,iBAAiB,CAAG,SA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tBtF,gBAAgB,CAAEA,gBAAiB,CACnCO,IAAI,CAAEA,IAAK,CACXE,MAAM,CAAEA,MAAO,CACfJ,IAAI,CAAEA,IAAK,CACXK,aAAa,CAAEA,aAAc,CAC7BC,MAAM,CAAEA,MAAO,CACfqD,QAAQ,CAAEA,QAAS,CACpB,CAAC,CACDqB,gBAAgB,GAAK,OAAO,EAC3B7D,GAAA,CAACC,QAAQ,CACP0E,CAAAA,UAAU,CAAC,WAAW,CACtBxE,UAAU,CAAElB,MAAO,CACnBiB,QAAQ,CAAE8D,gBAAiB,CAC3B1F,KAAK,CAAEE,gBAAiB,CACxB+B,EAAE,CAAEnB,aAAa,CAAGoB,SAAS,CAAG,MAAO,CACvCE,OAAO,CAAExB,aAAa,CAAGwB,OAAO,CAAC,CAAC,CAAC,CAAG,CAAE,CAAAX,QAAA,CAEvCgE,oBAAoB,CACb,CACX,CACA3B,eAAe,EACdpC,GAAA,CAACiE,OAAO,CAAA,CAENW,iBAAiB,CAAEpG,gBAAiB,CACpCqG,iBAAiB,CAAE9F,IAAI,GAAK,MAAM,CAAG,MAAM,CAAG,SAAU,CACxD+F,iBAAiB,CAAC,OAAO,CACzBL,QAAQ,CAAC,UAAU,CACnBM,KAAK,CAAC,MAAM,CACZC,GAAG,CAAC,KAAK,CACV,CACF,EACM,CAAC,CAAA,CACH,CAAC,CAEd,CAAC,CAEK,IAAAV,MAAM,CAAGW,wBAAwB,CAACrD,OAAO,CAAE,CAC/CsD,WAAW,CAAE,QAAQ,CACrBC,WAAW,CAAE,QACf,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var normalAmountSizes={body:{xsmall:25,small:75,medium:100,large:200},heading:{small:300,medium:400,large:500,xlarge:600,'2xlarge':700},display:{small:800,medium:900,large:1000,xlarge:1100}};var subtleFontSizes={body:{xsmall:normalAmountSizes.body.xsmall,small:normalAmountSizes.body.xsmall,medium:normalAmountSizes.body.xsmall,large:normalAmountSizes.body.small},heading:{small:normalAmountSizes.body.small,medium:normalAmountSizes.body.medium,large:normalAmountSizes.body.large,xlarge:normalAmountSizes.heading.medium,'2xlarge':normalAmountSizes.heading.large},display:{small:normalAmountSizes.heading.xlarge,medium:normalAmountSizes.heading['2xlarge'],large:normalAmountSizes.heading['2xlarge'],xlarge:normalAmountSizes.display.small}};var amountLineHeights={body:{xsmall:25,small:75,medium:100,large:200},heading:{small:300,medium:400,large:500,xlarge:600,'2xlarge':700},display:{small:800,medium:900,large:1000,xlarge:1100}};
|
|
1
|
+
var normalAmountSizes={body:{xsmall:25,small:75,medium:100,large:200},heading:{small:300,medium:400,large:500,xlarge:600,'2xlarge':700},display:{small:800,medium:900,large:1000,xlarge:1100}};var subtleFontSizes={body:{xsmall:normalAmountSizes.body.xsmall,small:normalAmountSizes.body.xsmall,medium:normalAmountSizes.body.xsmall,large:normalAmountSizes.body.small},heading:{small:normalAmountSizes.body.small,medium:normalAmountSizes.body.medium,large:normalAmountSizes.body.large,xlarge:normalAmountSizes.heading.medium,'2xlarge':normalAmountSizes.heading.large},display:{small:normalAmountSizes.heading.xlarge,medium:normalAmountSizes.heading['2xlarge'],large:normalAmountSizes.heading['2xlarge'],xlarge:normalAmountSizes.display.small}};var amountLineHeights={body:{xsmall:25,small:75,medium:100,large:200},heading:{small:300,medium:400,large:500,xlarge:600,'2xlarge':700},display:{small:800,medium:900,large:1000,xlarge:1100}};
|
|
2
2
|
|
|
3
|
-
export { amountLineHeights,
|
|
3
|
+
export { amountLineHeights, normalAmountSizes, subtleFontSizes };
|
|
4
4
|
//# sourceMappingURL=amountTokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amountTokens.js","sources":["../../../../../src/components/Amount/amountTokens.ts"],"sourcesContent":["import type { FontSize, Typography } from '~tokens/global';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\n\ntype AmountSizes = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | '2xlarge';\n\ntype AmountDisplayProps = {\n type?: 'display';\n size?: Extract<AmountSizes, 'small' | 'medium' | 'large' | 'xlarge'>;\n weight?: Extract<BaseTextProps['fontWeight'], 'regular' | 'medium' | 'semibold'>;\n};\n\ntype AmountHeadingProps = {\n type?: 'heading';\n size?: Extract<AmountSizes, 'small' | 'medium' | 'large' | 'xlarge' | '2xlarge'>;\n weight?: Extract<BaseTextProps['fontWeight'], 'regular' | 'semibold'>;\n};\n\ntype AmountBodyProps = {\n type?: 'body';\n size?: Extract<AmountSizes, 'xsmall' | 'small' | 'medium' | 'large'>;\n weight?: Extract<BaseTextProps['fontWeight'], 'regular' | 'medium' | 'semibold'>;\n};\n\ntype AmountTypeProps = AmountDisplayProps | AmountHeadingProps | AmountBodyProps;\n\nconst normalAmountSizes: Record<\n 'body' | 'heading' | 'display',\n Partial<Record<NonNullable<AmountTypeProps['size']>, keyof FontSize>>\n> = {\n body: {\n xsmall: 25,\n small: 75,\n medium: 100,\n large: 200,\n },\n heading: {\n small: 300,\n medium: 400,\n large: 500,\n xlarge: 600,\n '2xlarge': 700,\n },\n display: {\n small: 800,\n medium: 900,\n large: 1000,\n xlarge: 1100,\n },\n};\n\nconst subtleFontSizes: Record<\n 'body' | 'heading' | 'display',\n Partial<Record<NonNullable<AmountTypeProps['size']>, keyof FontSize>>\n> = {\n body: {\n xsmall: normalAmountSizes.body.xsmall,\n small: normalAmountSizes.body.xsmall,\n medium: normalAmountSizes.body.xsmall,\n large: normalAmountSizes.body.small,\n },\n heading: {\n small: normalAmountSizes.body.small,\n medium: normalAmountSizes.body.medium,\n large: normalAmountSizes.body.large,\n xlarge: normalAmountSizes.heading.medium,\n '2xlarge': normalAmountSizes.heading.large,\n },\n display: {\n small: normalAmountSizes.heading.xlarge,\n medium: normalAmountSizes.heading['2xlarge'],\n large: normalAmountSizes.heading['2xlarge'],\n xlarge: normalAmountSizes.display.small,\n },\n};\n\nconst amountLineHeights: Record<\n 'body' | 'heading' | 'display',\n Partial<Record<NonNullable<AmountTypeProps['size']>, keyof Typography['lineHeights']>>\n> = {\n body: {\n xsmall: 25,\n small: 75,\n medium: 100,\n large: 200,\n },\n heading: {\n small: 300,\n medium: 400,\n large: 500,\n xlarge: 600,\n '2xlarge': 700,\n },\n display: {\n small: 800,\n medium: 900,\n large: 1000,\n xlarge: 1100,\n },\n};\n\n// All the supported currency codes are taken from Razorpay's Merchant Dashboard codebase\nconst currencyIndicatorMapping = {\n AED: { 'currency-symbol': 'د.إ', 'currency-code': 'AED' },\n ALL: { 'currency-symbol': 'Lek', 'currency-code': 'ALL' },\n AMD: { 'currency-symbol': '֏', 'currency-code': 'AMD' },\n ARS: { 'currency-symbol': 'ARS', 'currency-code': 'ARS' },\n AUD: { 'currency-symbol': 'A$', 'currency-code': 'AUD' },\n AWG: { 'currency-symbol': 'Afl.', 'currency-code': 'AWG' },\n BBD: { 'currency-symbol': '$', 'currency-code': 'BBD' },\n BDT: { 'currency-symbol': '৳', 'currency-code': 'BDT' },\n BMD: { 'currency-symbol': '$', 'currency-code': 'BMD' },\n BND: { 'currency-symbol': 'BND', 'currency-code': 'BND' },\n BOB: { 'currency-symbol': 'Bs', 'currency-code': 'BOB' },\n BSD: { 'currency-symbol': 'B$', 'currency-code': 'BSD' },\n BWP: { 'currency-symbol': 'P', 'currency-code': 'BWP' },\n BZD: { 'currency-symbol': 'BZ$', 'currency-code': 'BZD' },\n CAD: { 'currency-symbol': 'C$', 'currency-code': 'CAD' },\n CHF: { 'currency-symbol': 'CHf', 'currency-code': 'CHF' },\n CNY: { 'currency-symbol': '¥', 'currency-code': 'CNY' },\n COP: { 'currency-symbol': 'COL$', 'currency-code': 'COP' },\n CRC: { 'currency-symbol': '₡', 'currency-code': 'CRC' },\n CUP: { 'currency-symbol': '$MN', 'currency-code': 'CUP' },\n CZK: { 'currency-symbol': 'Kč', 'currency-code': 'CZK' },\n DKK: { 'currency-symbol': 'DKK', 'currency-code': 'DKK' },\n DOP: { 'currency-symbol': 'RD$', 'currency-code': 'DOP' },\n DZD: { 'currency-symbol': 'د.ج', 'currency-code': 'DZD' },\n EGP: { 'currency-symbol': 'E£', 'currency-code': 'EGP' },\n ETB: { 'currency-symbol': 'ብር', 'currency-code': 'ETB' },\n EUR: { 'currency-symbol': '€', 'currency-code': 'EUR' },\n FJD: { 'currency-symbol': 'FJ$', 'currency-code': 'FJD' },\n GBP: { 'currency-symbol': '£', 'currency-code': 'GBP' },\n GHS: { 'currency-symbol': 'GH₵', 'currency-code': 'GHS' },\n GIP: { 'currency-symbol': 'GIP', 'currency-code': 'GIP' },\n GMD: { 'currency-symbol': 'D', 'currency-code': 'GMD' },\n GTQ: { 'currency-symbol': 'Q', 'currency-code': 'GTQ' },\n GYD: { 'currency-symbol': 'G$', 'currency-code': 'GYD' },\n HKD: { 'currency-symbol': 'HK$', 'currency-code': 'HKD' },\n HNL: { 'currency-symbol': 'HNL', 'currency-code': 'HNL' },\n HRK: { 'currency-symbol': 'kn', 'currency-code': 'HRK' },\n HTG: { 'currency-symbol': 'G', 'currency-code': 'HTG' },\n HUF: { 'currency-symbol': 'Ft', 'currency-code': 'HUF' },\n IDR: { 'currency-symbol': 'Rp', 'currency-code': 'IDR' },\n ILS: { 'currency-symbol': '₪', 'currency-code': 'ILS' },\n INR: { 'currency-symbol': '₹', 'currency-code': 'INR' },\n JMD: { 'currency-symbol': 'J$', 'currency-code': 'JMD' },\n KES: { 'currency-symbol': 'Ksh', 'currency-code': 'KES' },\n KGS: { 'currency-symbol': 'Лв', 'currency-code': 'KGS' },\n KHR: { 'currency-symbol': '៛', 'currency-code': 'KHR' },\n KYD: { 'currency-symbol': 'CI$', 'currency-code': 'KYD' },\n KZT: { 'currency-symbol': '₸', 'currency-code': 'KZT' },\n LAK: { 'currency-symbol': '₭', 'currency-code': 'LAK' },\n LKR: { 'currency-symbol': 'රු', 'currency-code': 'LKR' },\n LRD: { 'currency-symbol': 'L$', 'currency-code': 'LRD' },\n LSL: { 'currency-symbol': 'LSL', 'currency-code': 'LSL' },\n MAD: { 'currency-symbol': 'د.م.', 'currency-code': 'MAD' },\n MDL: { 'currency-symbol': 'MDL', 'currency-code': 'MDL' },\n MKD: { 'currency-symbol': 'ден', 'currency-code': 'MKD' },\n MMK: { 'currency-symbol': 'MMK', 'currency-code': 'MMK' },\n MNT: { 'currency-symbol': '₮', 'currency-code': 'MNT' },\n MOP: { 'currency-symbol': 'MOP$', 'currency-code': 'MOP' },\n MUR: { 'currency-symbol': '₨', 'currency-code': 'MUR' },\n MVR: { 'currency-symbol': 'Rf', 'currency-code': 'MVR' },\n MWK: { 'currency-symbol': 'MK', 'currency-code': 'MWK' },\n MXN: { 'currency-symbol': 'Mex$', 'currency-code': 'MXN' },\n MYR: { 'currency-symbol': 'RM', 'currency-code': 'MYR' },\n NAD: { 'currency-symbol': 'N$', 'currency-code': 'NAD' },\n NGN: { 'currency-symbol': '₦', 'currency-code': 'NGN' },\n NIO: { 'currency-symbol': 'NIO', 'currency-code': 'NIO' },\n NOK: { 'currency-symbol': 'NOK', 'currency-code': 'NOK' },\n NPR: { 'currency-symbol': 'रू', 'currency-code': 'NPR' },\n NZD: { 'currency-symbol': 'NZ$', 'currency-code': 'NZD' },\n PEN: { 'currency-symbol': 'S/', 'currency-code': 'PEN' },\n PGK: { 'currency-symbol': 'PGK', 'currency-code': 'PGK' },\n PHP: { 'currency-symbol': '₱', 'currency-code': 'PHP' },\n PKR: { 'currency-symbol': '₨', 'currency-code': 'PKR' },\n QAR: { 'currency-symbol': 'QR', 'currency-code': 'QAR' },\n RUB: { 'currency-symbol': '₽', 'currency-code': 'RUB' },\n SAR: { 'currency-symbol': 'SR', 'currency-code': 'SAR' },\n SCR: { 'currency-symbol': 'SRe', 'currency-code': 'SCR' },\n SEK: { 'currency-symbol': 'SEK', 'currency-code': 'SEK' },\n SGD: { 'currency-symbol': 'S$', 'currency-code': 'SGD' },\n SLL: { 'currency-symbol': 'Le', 'currency-code': 'SLL' },\n SOS: { 'currency-symbol': 'Sh.so.', 'currency-code': 'SOS' },\n SSP: { 'currency-symbol': 'SS£', 'currency-code': 'SSP' },\n SVC: { 'currency-symbol': '₡', 'currency-code': 'SVC' },\n SZL: { 'currency-symbol': 'E', 'currency-code': 'SZL' },\n THB: { 'currency-symbol': '฿', 'currency-code': 'THB' },\n TTD: { 'currency-symbol': 'TT$', 'currency-code': 'TTD' },\n TZS: { 'currency-symbol': 'Sh', 'currency-code': 'TZS' },\n USD: { 'currency-symbol': '$', 'currency-code': 'USD' },\n UYU: { 'currency-symbol': '$U', 'currency-code': 'UYU' },\n UZS: { 'currency-symbol': \"so'm\", 'currency-code': 'UZS' },\n YER: { 'currency-symbol': '﷼', 'currency-code': 'YER' },\n ZAR: { 'currency-symbol': 'R', 'currency-code': 'ZAR' },\n KWD: { 'currency-symbol': 'د.ك', 'currency-code': 'KWD' },\n BHD: { 'currency-symbol': 'د.ب.', 'currency-code': 'BHD' },\n OMR: { 'currency-symbol': 'ر.ع.', 'currency-code': 'OMR' },\n};\n\ntype CurrencyAbbreviation = {\n value: number;\n symbol: string;\n};\n\ntype Currency = keyof typeof currencyIndicatorMapping;\n\nconst getCurrencyAbbreviations = (currency: Currency): CurrencyAbbreviation[] => {\n if (currency === 'INR') {\n return [\n { value: 1e7, symbol: 'Cr' },\n { value: 1e5, symbol: 'L' },\n { value: 1e3, symbol: 'k' },\n ];\n }\n\n return [\n { value: 1e9, symbol: 'B' },\n { value: 1e6, symbol: 'M' },\n { value: 1e3, symbol: 'K' },\n ];\n};\n\nconst currencyPositionMapping: Record<string, string> = {\n DZD: 'right',\n BHD: 'right',\n OMR: 'right',\n KWD: 'right',\n};\n\nexport {\n subtleFontSizes,\n normalAmountSizes,\n amountLineHeights,\n currencyPositionMapping,\n currencyIndicatorMapping,\n getCurrencyAbbreviations,\n};\n\nexport type { Currency, AmountBodyProps, AmountDisplayProps, AmountHeadingProps, AmountTypeProps };\n"],"names":["normalAmountSizes","body","xsmall","small","medium","large","heading","xlarge","display","subtleFontSizes","amountLineHeights","currencyIndicatorMapping","AED","ALL","AMD","ARS","AUD","AWG","BBD","BDT","BMD","BND","BOB","BSD","BWP","BZD","CAD","CHF","CNY","COP","CRC","CUP","CZK","DKK","DOP","DZD","EGP","ETB","EUR","FJD","GBP","GHS","GIP","GMD","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","JMD","KES","KGS","KHR","KYD","KZT","LAK","LKR","LRD","LSL","MAD","MDL","MKD","MMK","MNT","MOP","MUR","MVR","MWK","MXN","MYR","NAD","NGN","NIO","NOK","NPR","NZD","PEN","PGK","PHP","PKR","QAR","RUB","SAR","SCR","SEK","SGD","SLL","SOS","SSP","SVC","SZL","THB","TTD","TZS","USD","UYU","UZS","YER","ZAR","KWD","BHD","OMR","getCurrencyAbbreviations","currency","value","symbol","currencyPositionMapping"],"mappings":"AAyBM,IAAAA,iBAGL,CAAG,CACFC,IAAI,CAAE,CACJC,MAAM,CAAE,EAAE,CACVC,KAAK,CAAE,EAAE,CACTC,MAAM,CAAE,GAAG,CACXC,KAAK,CAAE,GACT,CAAC,CACDC,OAAO,CAAE,CACPH,KAAK,CAAE,GAAG,CACVC,MAAM,CAAE,GAAG,CACXC,KAAK,CAAE,GAAG,CACVE,MAAM,CAAE,GAAG,CACX,SAAS,CAAE,GACb,CAAC,CACDC,OAAO,CAAE,CACPL,KAAK,CAAE,GAAG,CACVC,MAAM,CAAE,GAAG,CACXC,KAAK,CAAE,IAAI,CACXE,MAAM,CAAE,IACV,CACF,EAEM,IAAAE,eAGL,CAAG,CACFR,IAAI,CAAE,CACJC,MAAM,CAAEF,iBAAiB,CAACC,IAAI,CAACC,MAAM,CACrCC,KAAK,CAAEH,iBAAiB,CAACC,IAAI,CAACC,MAAM,CACpCE,MAAM,CAAEJ,iBAAiB,CAACC,IAAI,CAACC,MAAM,CACrCG,KAAK,CAAEL,iBAAiB,CAACC,IAAI,CAACE,KAChC,CAAC,CACDG,OAAO,CAAE,CACPH,KAAK,CAAEH,iBAAiB,CAACC,IAAI,CAACE,KAAK,CACnCC,MAAM,CAA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,EAEM,IAAAC,uBAA+C,CAAG,CACtD5E,GAAG,CAAE,OAAO,CACZsE,GAAG,CAAE,OAAO,CACZC,GAAG,CAAE,OAAO,CACZF,GAAG,CAAE,OACP;;;;"}
|
|
1
|
+
{"version":3,"file":"amountTokens.js","sources":["../../../../../src/components/Amount/amountTokens.ts"],"sourcesContent":["import type { FontSize, Typography } from '~tokens/global';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\n\ntype AmountSizes = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | '2xlarge';\n\ntype AmountDisplayProps = {\n type?: 'display';\n size?: Extract<AmountSizes, 'small' | 'medium' | 'large' | 'xlarge'>;\n weight?: Extract<BaseTextProps['fontWeight'], 'regular' | 'medium' | 'semibold'>;\n};\n\ntype AmountHeadingProps = {\n type?: 'heading';\n size?: Extract<AmountSizes, 'small' | 'medium' | 'large' | 'xlarge' | '2xlarge'>;\n weight?: Extract<BaseTextProps['fontWeight'], 'regular' | 'semibold'>;\n};\n\ntype AmountBodyProps = {\n type?: 'body';\n size?: Extract<AmountSizes, 'xsmall' | 'small' | 'medium' | 'large'>;\n weight?: Extract<BaseTextProps['fontWeight'], 'regular' | 'medium' | 'semibold'>;\n};\n\ntype AmountTypeProps = AmountDisplayProps | AmountHeadingProps | AmountBodyProps;\n\nconst normalAmountSizes: Record<\n 'body' | 'heading' | 'display',\n Partial<Record<NonNullable<AmountTypeProps['size']>, keyof FontSize>>\n> = {\n body: {\n xsmall: 25,\n small: 75,\n medium: 100,\n large: 200,\n },\n heading: {\n small: 300,\n medium: 400,\n large: 500,\n xlarge: 600,\n '2xlarge': 700,\n },\n display: {\n small: 800,\n medium: 900,\n large: 1000,\n xlarge: 1100,\n },\n};\n\nconst subtleFontSizes: Record<\n 'body' | 'heading' | 'display',\n Partial<Record<NonNullable<AmountTypeProps['size']>, keyof FontSize>>\n> = {\n body: {\n xsmall: normalAmountSizes.body.xsmall,\n small: normalAmountSizes.body.xsmall,\n medium: normalAmountSizes.body.xsmall,\n large: normalAmountSizes.body.small,\n },\n heading: {\n small: normalAmountSizes.body.small,\n medium: normalAmountSizes.body.medium,\n large: normalAmountSizes.body.large,\n xlarge: normalAmountSizes.heading.medium,\n '2xlarge': normalAmountSizes.heading.large,\n },\n display: {\n small: normalAmountSizes.heading.xlarge,\n medium: normalAmountSizes.heading['2xlarge'],\n large: normalAmountSizes.heading['2xlarge'],\n xlarge: normalAmountSizes.display.small,\n },\n};\n\nconst amountLineHeights: Record<\n 'body' | 'heading' | 'display',\n Partial<Record<NonNullable<AmountTypeProps['size']>, keyof Typography['lineHeights']>>\n> = {\n body: {\n xsmall: 25,\n small: 75,\n medium: 100,\n large: 200,\n },\n heading: {\n small: 300,\n medium: 400,\n large: 500,\n xlarge: 600,\n '2xlarge': 700,\n },\n display: {\n small: 800,\n medium: 900,\n large: 1000,\n xlarge: 1100,\n },\n};\n\nexport { subtleFontSizes, normalAmountSizes, amountLineHeights };\n\nexport type { AmountBodyProps, AmountDisplayProps, AmountHeadingProps, AmountTypeProps };\n"],"names":["normalAmountSizes","body","xsmall","small","medium","large","heading","xlarge","display","subtleFontSizes","amountLineHeights"],"mappings":"AAyBM,IAAAA,iBAGL,CAAG,CACFC,IAAI,CAAE,CACJC,MAAM,CAAE,EAAE,CACVC,KAAK,CAAE,EAAE,CACTC,MAAM,CAAE,GAAG,CACXC,KAAK,CAAE,GACT,CAAC,CACDC,OAAO,CAAE,CACPH,KAAK,CAAE,GAAG,CACVC,MAAM,CAAE,GAAG,CACXC,KAAK,CAAE,GAAG,CACVE,MAAM,CAAE,GAAG,CACX,SAAS,CAAE,GACb,CAAC,CACDC,OAAO,CAAE,CACPL,KAAK,CAAE,GAAG,CACVC,MAAM,CAAE,GAAG,CACXC,KAAK,CAAE,IAAI,CACXE,MAAM,CAAE,IACV,CACF,EAEM,IAAAE,eAGL,CAAG,CACFR,IAAI,CAAE,CACJC,MAAM,CAAEF,iBAAiB,CAACC,IAAI,CAACC,MAAM,CACrCC,KAAK,CAAEH,iBAAiB,CAACC,IAAI,CAACC,MAAM,CACpCE,MAAM,CAAEJ,iBAAiB,CAACC,IAAI,CAACC,MAAM,CACrCG,KAAK,CAAEL,iBAAiB,CAACC,IAAI,CAACE,KAChC,CAAC,CACDG,OAAO,CAAE,CACPH,KAAK,CAAEH,iBAAiB,CAACC,IAAI,CAACE,KAAK,CACnCC,MAAM,CAAEJ,iBAAiB,CAACC,IAAI,CAACG,MAAM,CACrCC,KAAK,CAAEL,iBAAiB,CAACC,IAAI,CAACI,KAAK,CACnCE,MAAM,CAAEP,iBAAiB,CAACM,OAAO,CAACF,MAAM,CACxC,SAAS,CAAEJ,iBAAiB,CAACM,OAAO,CAACD,KACvC,CAAC,CACDG,OAAO,CAAE,CACPL,KAAK,CAAEH,iBAAiB,CAACM,OAAO,CAACC,MAAM,CACvCH,MAAM,CAAEJ,iBAAiB,CAACM,OAAO,CAAC,SAAS,CAAC,CAC5CD,KAAK,CAAEL,iBAAiB,CAACM,OAAO,CAAC,SAAS,CAAC,CAC3CC,MAAM,CAAEP,iBAAiB,CAACQ,OAAO,CAACL,KACpC,CACF,EAEM,IAAAO,iBAGL,CAAG,CACFT,IAAI,CAAE,CACJC,MAAM,CAAE,EAAE,CACVC,KAAK,CAAE,EAAE,CACTC,MAAM,CAAE,GAAG,CACXC,KAAK,CAAE,GACT,CAAC,CACDC,OAAO,CAAE,CACPH,KAAK,CAAE,GAAG,CACVC,MAAM,CAAE,GAAG,CACXC,KAAK,CAAE,GAAG,CACVE,MAAM,CAAE,GAAG,CACX,SAAS,CAAE,GACb,CAAC,CACDC,OAAO,CAAE,CACPL,KAAK,CAAE,GAAG,CACVC,MAAM,CAAE,GAAG,CACXC,KAAK,CAAE,IAAI,CACXE,MAAM,CAAE,IACV,CACF;;;;"}
|
|
@@ -21,7 +21,7 @@ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
|
21
21
|
import { useControllableState } from '../../utils/useControllable.js';
|
|
22
22
|
import { jsx } from 'react/jsx-runtime';
|
|
23
23
|
|
|
24
|
-
var _excluded=["children","isOpen","onOpenChange","selectionType","testID"];var validDropdownChildren=[dropdownComponentIds.triggers.SelectInput,dropdownComponentIds.triggers.DropdownButton,dropdownComponentIds.triggers.DropdownLink,dropdownComponentIds.DropdownOverlay,dropdownComponentIds.triggers.AutoComplete,ComponentIds.BottomSheet];var _Dropdown=function _Dropdown(_ref){var children=_ref.children,isOpenControlled=_ref.isOpen,onOpenChange=_ref.onOpenChange,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState([]),_React$useState2=_slicedToArray(_React$useState,2),options=_React$useState2[0],setOptions=_React$useState2[1];var _React$useState3=React__default.useState([]),_React$useState4=_slicedToArray(_React$useState3,2),filteredValues=_React$useState4[0],setFilteredValues=_React$useState4[1];var _React$useState5=React__default.useState([]),_React$useState6=_slicedToArray(_React$useState5,2),selectedIndices=_React$useState6[0],setSelectedIndices=_React$useState6[1];var _React$useState7=React__default.useState([]),_React$useState8=_slicedToArray(_React$useState7,2),controlledValueIndices=_React$useState8[0],setControlledValueIndices=_React$useState8[1];var _React$useState9=React__default.useState(-1),_React$useState10=_slicedToArray(_React$useState9,2),activeIndex=_React$useState10[0],setActiveIndex=_React$useState10[1];var _React$useState11=React__default.useState(-1),_React$useState12=_slicedToArray(_React$useState11,2),activeTagIndex=_React$useState12[0],setActiveTagIndex=_React$useState12[1];var _React$useState13=React__default.useState(false),_React$useState14=_slicedToArray(_React$useState13,2),shouldIgnoreBlurAnimation=_React$useState14[0],setShouldIgnoreBlurAnimation=_React$useState14[1];var _React$useState15=React__default.useState(false),_React$useState16=_slicedToArray(_React$useState15,2),hasFooterAction=_React$useState16[0],setHasFooterAction=_React$useState16[1];var _React$useState17=React__default.useState(false),_React$useState18=_slicedToArray(_React$useState17,2),hasAutoCompleteInBottomSheetHeader=_React$useState18[0],setHasAutoCompleteInBottomSheetHeader=_React$useState18[1];var _React$useState19=React__default.useState(false),_React$useState20=_slicedToArray(_React$useState19,2),isKeydownPressed=_React$useState20[0],setIsKeydownPressed=_React$useState20[1];var _React$useState21=React__default.useState(0),_React$useState22=_slicedToArray(_React$useState21,2),changeCallbackTriggerer=_React$useState22[0],setChangeCallbackTriggerer=_React$useState22[1];var _React$useState23=React__default.useState(false),_React$useState24=_slicedToArray(_React$useState23,2),isControlled=_React$useState24[0],setIsControlled=_React$useState24[1];var _React$useState25=React__default.useState(false),_React$useState26=_slicedToArray(_React$useState25,2),dropdownHasBottomSheet=_React$useState26[0],setDropdownHasBottomSheet=_React$useState26[1];var triggererWrapperRef=React__default.useRef(null);var triggererRef=React__default.useRef(null);var actionListItemRef=React__default.useRef(null);var dropdownTriggerer=React__default.useRef();var isTagDismissedRef=React__default.useRef({value:false});var visibleTagsCountRef=React__default.useRef({value:0});var dropdownContainerRef=React__default.useRef(null);var dropdownBaseId=useId('dropdown');var isDropdownOpenRef=React__default.useRef(isOpenControlled);var _useControllableState=useControllableState({value:isOpenControlled,defaultValue:false,onChange:function onChange(isOpenControlledValue){isDropdownOpenRef.current=isOpenControlledValue;onOpenChange==null?void 0:onOpenChange(isOpenControlledValue);}}),_useControllableState2=_slicedToArray(_useControllableState,2),isDropdownOpen=_useControllableState2[0],setIsDropdownOpen=_useControllableState2[1];isDropdownOpenRef.current=isDropdownOpen;var setIsOpen=function setIsOpen(isOpenValue){isDropdownOpenRef.current=isOpenValue;setIsDropdownOpen(function(){return isOpenValue;});};var close=React__default.useCallback(function(){setActiveTagIndex(-1);setIsOpen(false);},[]);React__default.Children.map(children,function(child){if(React__default.isValidElement(child)){if(__DEV__){var _getComponentId;if(!validDropdownChildren.includes((_getComponentId=getComponentId(child))!=null?_getComponentId:'')){throwBladeError({message:`Dropdown can only have one of following elements as children - \n\n ${validDropdownChildren.join(', ')} \n\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,moduleName:'Dropdown'});}}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SelectInput)){dropdownTriggerer.current='SelectInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.DropdownButton)){dropdownTriggerer.current='DropdownButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.AutoComplete)){dropdownTriggerer.current='AutoComplete';}}});var contextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,controlledValueIndices:controlledValueIndices,setControlledValueIndices:setControlledValueIndices,options:options,setOptions:setOptions,filteredValues:filteredValues,setFilteredValues:setFilteredValues,activeIndex:activeIndex,setActiveIndex:setActiveIndex,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,visibleTagsCountRef:visibleTagsCountRef,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation:setShouldIgnoreBlurAnimation,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,dropdownBaseId:dropdownBaseId,triggererRef:triggererRef,triggererWrapperRef:triggererWrapperRef,actionListItemRef:actionListItemRef,selectionType:selectionType,hasFooterAction:hasFooterAction,setHasFooterAction:setHasFooterAction,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setHasAutoCompleteInBottomSheetHeader:setHasAutoCompleteInBottomSheetHeader,dropdownTriggerer:dropdownTriggerer.current,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,setIsControlled:setIsControlled,isTagDismissedRef:isTagDismissedRef};},[isDropdownOpen,isOpenControlled,selectedIndices,controlledValueIndices,options,filteredValues,activeIndex,activeTagIndex,shouldIgnoreBlurAnimation,selectionType,hasFooterAction,isKeydownPressed,changeCallbackTriggerer,isControlled]);var BottomSheetAndDropdownGlueContextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,dropdownHasBottomSheet:dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setDropdownHasBottomSheet:setDropdownHasBottomSheet,onBottomSheetDismiss:close};},[dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader,isDropdownOpen,close]);React__default.useEffect(function(){if(!isReactNative()){var dropdown=dropdownContainerRef.current;var documentClickHandler=function documentClickHandler(e){var _isTagDismissedRef$cu,_isTagDismissedRef$cu2;var target=e.target;if(!target||!dropdown){return;}var isOutsideClick=!dropdown.contains(target)&&!((_isTagDismissedRef$cu=isTagDismissedRef.current)!=null&&_isTagDismissedRef$cu.value);var isDropdownOpenState=isDropdownOpenRef.current;if(isOutsideClick&&isDropdownOpenState){close();}if((_isTagDismissedRef$cu2=isTagDismissedRef.current)!=null&&_isTagDismissedRef$cu2.value){isTagDismissedRef.current.value=false;}};var documentFocusHandler=function documentFocusHandler(e){var target=e.relatedTarget;setActiveIndex(-1);if(!dropdown||!target){return;}if(!dropdown.contains(target)){close();}};document.addEventListener('click',documentClickHandler);document.addEventListener('focusout',documentFocusHandler);return function(){document.removeEventListener('click',documentClickHandler);document.removeEventListener('focusout',documentFocusHandler);};}return undefined;},[]);return jsx(BottomSheetAndDropdownGlueContext.Provider,{value:BottomSheetAndDropdownGlueContextValue,children:jsx(DropdownContext.Provider,{value:contextValue,children:jsx(BaseBox,Object.assign({ref:dropdownContainerRef},metaAttribute({name:MetaConstants.Dropdown,testID:testID}),getStyledProps(styledProps),{children:jsx(BaseBox,{position:"relative",textAlign:'left',children:children})}))})});};var Dropdown=assignWithoutSideEffects(_Dropdown,{componentId:dropdownComponentIds.Dropdown});
|
|
24
|
+
var _excluded=["children","isOpen","onOpenChange","selectionType","testID"];var validDropdownChildren=[dropdownComponentIds.triggers.SelectInput,dropdownComponentIds.triggers.DropdownButton,dropdownComponentIds.triggers.DropdownLink,dropdownComponentIds.DropdownOverlay,dropdownComponentIds.triggers.AutoComplete,ComponentIds.BottomSheet];var _Dropdown=function _Dropdown(_ref){var children=_ref.children,isOpenControlled=_ref.isOpen,onOpenChange=_ref.onOpenChange,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState([]),_React$useState2=_slicedToArray(_React$useState,2),options=_React$useState2[0],setOptions=_React$useState2[1];var _React$useState3=React__default.useState([]),_React$useState4=_slicedToArray(_React$useState3,2),filteredValues=_React$useState4[0],setFilteredValues=_React$useState4[1];var _React$useState5=React__default.useState([]),_React$useState6=_slicedToArray(_React$useState5,2),selectedIndices=_React$useState6[0],setSelectedIndices=_React$useState6[1];var _React$useState7=React__default.useState([]),_React$useState8=_slicedToArray(_React$useState7,2),controlledValueIndices=_React$useState8[0],setControlledValueIndices=_React$useState8[1];var _React$useState9=React__default.useState(-1),_React$useState10=_slicedToArray(_React$useState9,2),activeIndex=_React$useState10[0],setActiveIndex=_React$useState10[1];var _React$useState11=React__default.useState(-1),_React$useState12=_slicedToArray(_React$useState11,2),activeTagIndex=_React$useState12[0],setActiveTagIndex=_React$useState12[1];var _React$useState13=React__default.useState(false),_React$useState14=_slicedToArray(_React$useState13,2),shouldIgnoreBlurAnimation=_React$useState14[0],setShouldIgnoreBlurAnimation=_React$useState14[1];var _React$useState15=React__default.useState(false),_React$useState16=_slicedToArray(_React$useState15,2),hasFooterAction=_React$useState16[0],setHasFooterAction=_React$useState16[1];var _React$useState17=React__default.useState(false),_React$useState18=_slicedToArray(_React$useState17,2),hasAutoCompleteInBottomSheetHeader=_React$useState18[0],setHasAutoCompleteInBottomSheetHeader=_React$useState18[1];var _React$useState19=React__default.useState(false),_React$useState20=_slicedToArray(_React$useState19,2),isKeydownPressed=_React$useState20[0],setIsKeydownPressed=_React$useState20[1];var _React$useState21=React__default.useState(0),_React$useState22=_slicedToArray(_React$useState21,2),changeCallbackTriggerer=_React$useState22[0],setChangeCallbackTriggerer=_React$useState22[1];var _React$useState23=React__default.useState(false),_React$useState24=_slicedToArray(_React$useState23,2),isControlled=_React$useState24[0],setIsControlled=_React$useState24[1];var _React$useState25=React__default.useState(false),_React$useState26=_slicedToArray(_React$useState25,2),dropdownHasBottomSheet=_React$useState26[0],setDropdownHasBottomSheet=_React$useState26[1];var triggererWrapperRef=React__default.useRef(null);var triggererRef=React__default.useRef(null);var actionListItemRef=React__default.useRef(null);var dropdownTriggerer=React__default.useRef();var isTagDismissedRef=React__default.useRef({value:false});var visibleTagsCountRef=React__default.useRef({value:0});var dropdownContainerRef=React__default.useRef(null);var dropdownBaseId=useId('dropdown');var isDropdownOpenRef=React__default.useRef(isOpenControlled);var _useControllableState=useControllableState({value:isOpenControlled,defaultValue:false,onChange:function onChange(isOpenControlledValue){isDropdownOpenRef.current=isOpenControlledValue;onOpenChange==null?void 0:onOpenChange(isOpenControlledValue);}}),_useControllableState2=_slicedToArray(_useControllableState,2),isDropdownOpen=_useControllableState2[0],setIsDropdownOpen=_useControllableState2[1];isDropdownOpenRef.current=isDropdownOpen;var setIsOpen=function setIsOpen(isOpenValue){isDropdownOpenRef.current=isOpenValue;setIsDropdownOpen(function(){return isOpenValue;});};var close=React__default.useCallback(function(){setActiveTagIndex(-1);setIsOpen(false);},[]);React__default.Children.map(children,function(child){if(React__default.isValidElement(child)){if(__DEV__){var _getComponentId;if(!validDropdownChildren.includes((_getComponentId=getComponentId(child))!=null?_getComponentId:'')){throwBladeError({message:`Dropdown can only have one of following elements as children - \n\n ${validDropdownChildren.join(', ')} \n\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,moduleName:'Dropdown'});}}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SelectInput)){dropdownTriggerer.current='SelectInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.DropdownButton)){dropdownTriggerer.current='DropdownButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.AutoComplete)){dropdownTriggerer.current='AutoComplete';}}});var contextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,controlledValueIndices:controlledValueIndices,setControlledValueIndices:setControlledValueIndices,options:options,setOptions:setOptions,filteredValues:filteredValues,setFilteredValues:setFilteredValues,activeIndex:activeIndex,setActiveIndex:setActiveIndex,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,visibleTagsCountRef:visibleTagsCountRef,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation:setShouldIgnoreBlurAnimation,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,dropdownBaseId:dropdownBaseId,triggererRef:triggererRef,triggererWrapperRef:triggererWrapperRef,actionListItemRef:actionListItemRef,selectionType:selectionType,hasFooterAction:hasFooterAction,setHasFooterAction:setHasFooterAction,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setHasAutoCompleteInBottomSheetHeader:setHasAutoCompleteInBottomSheetHeader,dropdownTriggerer:dropdownTriggerer.current,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,setIsControlled:setIsControlled,isTagDismissedRef:isTagDismissedRef};},[isDropdownOpen,isOpenControlled,selectedIndices,controlledValueIndices,options,filteredValues,activeIndex,activeTagIndex,shouldIgnoreBlurAnimation,selectionType,hasFooterAction,isKeydownPressed,changeCallbackTriggerer,isControlled]);var BottomSheetAndDropdownGlueContextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,dropdownHasBottomSheet:dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setDropdownHasBottomSheet:setDropdownHasBottomSheet,onBottomSheetDismiss:close};},[dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader,isDropdownOpen,close]);React__default.useEffect(function(){if(!isReactNative()){var dropdown=dropdownContainerRef.current;var documentClickHandler=function documentClickHandler(e){var _isTagDismissedRef$cu,_isTagDismissedRef$cu2;var target=e.target;if(!target||!dropdown){return;}var isOutsideClick=!dropdown.contains(target)&&!((_isTagDismissedRef$cu=isTagDismissedRef.current)!=null&&_isTagDismissedRef$cu.value)&&document.body.contains(target);var isDropdownOpenState=isDropdownOpenRef.current;if(isOutsideClick&&isDropdownOpenState){close();}if((_isTagDismissedRef$cu2=isTagDismissedRef.current)!=null&&_isTagDismissedRef$cu2.value){isTagDismissedRef.current.value=false;}};var documentFocusHandler=function documentFocusHandler(e){var target=e.relatedTarget;setActiveIndex(-1);if(!dropdown||!target){return;}if(!dropdown.contains(target)){close();}};document.addEventListener('click',documentClickHandler);document.addEventListener('focusout',documentFocusHandler);return function(){document.removeEventListener('click',documentClickHandler);document.removeEventListener('focusout',documentFocusHandler);};}return undefined;},[]);return jsx(BottomSheetAndDropdownGlueContext.Provider,{value:BottomSheetAndDropdownGlueContextValue,children:jsx(DropdownContext.Provider,{value:contextValue,children:jsx(BaseBox,Object.assign({ref:dropdownContainerRef},metaAttribute({name:MetaConstants.Dropdown,testID:testID}),getStyledProps(styledProps),{children:jsx(BaseBox,{position:"relative",textAlign:'left',children:children})}))})});};var Dropdown=assignWithoutSideEffects(_Dropdown,{componentId:dropdownComponentIds.Dropdown});
|
|
25
25
|
|
|
26
26
|
export { Dropdown };
|
|
27
27
|
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sources":["../../../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { DropdownContext } from './useDropdown';\nimport type { DropdownContextType } from './useDropdown';\nimport type { DropdownProps } from './types';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { useId } from '~utils/useId';\nimport { ComponentIds as bottomSheetComponentIds } from '~components/BottomSheet/componentIds';\nimport { BottomSheetAndDropdownGlueContext } from '~components/BottomSheet/BottomSheetContext';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { isReactNative } from '~utils';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { ContainerElementType } from '~utils/types';\nimport { useControllableState } from '~utils/useControllable';\n\nconst validDropdownChildren = [\n dropdownComponentIds.triggers.SelectInput,\n dropdownComponentIds.triggers.DropdownButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\n];\n\n/**\n * ### Dropdown component\n *\n * Dropdown component is generic component that controls the dropdown functionality.\n * It can be used with multiple triggers and mostly contains ActionList component inside it\n *\n * ---\n *\n * #### Usage\n *\n * ```jsx\n * <Dropdown selectionType=\"single\">\n * <SelectInput />\n * <DropdownOverlay>\n * <ActionList>\n * <ActionListItem />\n * <ActionListItem />\n * </ActionList>\n * </DropdownOverlay>\n * </Dropdown>\n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-select--with-single-select Dropdown Documentation}\n */\nconst _Dropdown = ({\n children,\n isOpen: isOpenControlled,\n onOpenChange,\n selectionType = 'single',\n testID,\n ...styledProps\n}: DropdownProps): React.ReactElement => {\n const [options, setOptions] = React.useState<DropdownContextType['options']>([]);\n const [filteredValues, setFilteredValues] = React.useState<string[]>([]);\n const [selectedIndices, setSelectedIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [controlledValueIndices, setControlledValueIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n const [activeTagIndex, setActiveTagIndex] = React.useState(-1);\n const [shouldIgnoreBlurAnimation, setShouldIgnoreBlurAnimation] = React.useState(false);\n const [hasFooterAction, setHasFooterAction] = React.useState(false);\n const [\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n ] = React.useState(false);\n const [isKeydownPressed, setIsKeydownPressed] = React.useState(false);\n const [changeCallbackTriggerer, setChangeCallbackTriggerer] = React.useState<\n DropdownContextType['changeCallbackTriggerer']\n >(0);\n const [isControlled, setIsControlled] = React.useState(false);\n // keep track if dropdown contains bottomsheet\n const [dropdownHasBottomSheet, setDropdownHasBottomSheet] = React.useState(false);\n\n /**\n * In inputs, actual input is smaller than the visible input wrapper.\n * You can set this reference in such cases so floating ui calculations happen correctly\n * */\n const triggererWrapperRef = React.useRef<ContainerElementType>(null);\n const triggererRef = React.useRef<HTMLButtonElement>(null);\n const actionListItemRef = React.useRef<HTMLDivElement>(null);\n const dropdownTriggerer = React.useRef<DropdownContextType['dropdownTriggerer']>();\n const isTagDismissedRef = React.useRef<{ value: boolean } | null>({ value: false });\n const visibleTagsCountRef = React.useRef<{ value: number }>({ value: 0 });\n const dropdownContainerRef = React.useRef<HTMLDivElement>(null);\n\n const dropdownBaseId = useId('dropdown');\n const isDropdownOpenRef = React.useRef(isOpenControlled);\n\n const [isDropdownOpen, setIsDropdownOpen] = useControllableState({\n value: isOpenControlled,\n defaultValue: false,\n onChange: (isOpenControlledValue) => {\n isDropdownOpenRef.current = isOpenControlledValue;\n onOpenChange?.(isOpenControlledValue);\n },\n });\n\n isDropdownOpenRef.current = isDropdownOpen;\n\n const setIsOpen = (isOpenValue: boolean): void => {\n isDropdownOpenRef.current = isOpenValue;\n setIsDropdownOpen(() => isOpenValue);\n };\n\n const close = React.useCallback(() => {\n setActiveTagIndex(-1);\n setIsOpen(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n if (__DEV__) {\n if (!validDropdownChildren.includes(getComponentId(child) ?? '')) {\n throwBladeError({\n message: `Dropdown can only have one of following elements as children - \\n\\n ${validDropdownChildren.join(\n ', ',\n )} \\n\\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,\n moduleName: 'Dropdown',\n });\n }\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SelectInput)) {\n dropdownTriggerer.current = 'SelectInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.DropdownButton)) {\n dropdownTriggerer.current = 'DropdownButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.AutoComplete)) {\n dropdownTriggerer.current = 'AutoComplete';\n }\n }\n });\n\n const contextValue = React.useMemo<DropdownContextType>(\n () => ({\n isOpen: isDropdownOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n controlledValueIndices,\n setControlledValueIndices,\n options,\n setOptions,\n filteredValues,\n setFilteredValues,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n shouldIgnoreBlurAnimation,\n setShouldIgnoreBlurAnimation,\n isKeydownPressed,\n setIsKeydownPressed,\n dropdownBaseId,\n triggererRef,\n triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n dropdownTriggerer: dropdownTriggerer.current,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setIsControlled,\n isTagDismissedRef,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n isDropdownOpen,\n isOpenControlled,\n selectedIndices,\n controlledValueIndices,\n options,\n filteredValues,\n activeIndex,\n activeTagIndex,\n shouldIgnoreBlurAnimation,\n selectionType,\n hasFooterAction,\n isKeydownPressed,\n changeCallbackTriggerer,\n isControlled,\n ],\n );\n\n const BottomSheetAndDropdownGlueContextValue = React.useMemo((): BottomSheetAndDropdownGlueContext => {\n return {\n isOpen: isDropdownOpen,\n dropdownHasBottomSheet,\n hasAutoCompleteInBottomSheetHeader,\n setDropdownHasBottomSheet,\n // This is the dismiss function which will be injected into the BottomSheet\n // Basically <BottomSheet onDismiss={onBottomSheetDismiss} />\n onBottomSheetDismiss: close,\n };\n }, [dropdownHasBottomSheet, hasAutoCompleteInBottomSheetHeader, isDropdownOpen, close]);\n\n React.useEffect((): (() => void) | undefined => {\n if (!isReactNative()) {\n const dropdown = dropdownContainerRef.current;\n\n const documentClickHandler = (e: MouseEvent): void => {\n const target = e.target as HTMLDivElement;\n\n if (!target || !dropdown) {\n return;\n }\n\n const isOutsideClick = !dropdown.contains(target) && !isTagDismissedRef.current?.value;\n\n const isDropdownOpenState = isDropdownOpenRef.current;\n if (isOutsideClick && isDropdownOpenState) {\n close();\n }\n\n if (isTagDismissedRef.current?.value) {\n isTagDismissedRef.current.value = false;\n }\n };\n\n const documentFocusHandler = (e: FocusEvent): void => {\n const target = e.relatedTarget as HTMLDivElement;\n setActiveIndex(-1);\n\n if (!dropdown || !target) {\n return;\n }\n\n if (!dropdown.contains(target)) {\n close();\n }\n };\n\n document.addEventListener('click', documentClickHandler);\n document.addEventListener('focusout', documentFocusHandler);\n\n return (): void => {\n document.removeEventListener('click', documentClickHandler);\n document.removeEventListener('focusout', documentFocusHandler);\n };\n }\n\n return undefined;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <BottomSheetAndDropdownGlueContext.Provider value={BottomSheetAndDropdownGlueContextValue}>\n <DropdownContext.Provider value={contextValue}>\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={dropdownContainerRef as any}\n {...metaAttribute({ name: MetaConstants.Dropdown, testID })}\n {...getStyledProps(styledProps)}\n >\n <BaseBox position=\"relative\" textAlign={'left' as never}>\n {children}\n </BaseBox>\n </BaseBox>\n </DropdownContext.Provider>\n </BottomSheetAndDropdownGlueContext.Provider>\n );\n};\n\nconst Dropdown = assignWithoutSideEffects(_Dropdown, {\n componentId: dropdownComponentIds.Dropdown,\n});\n\nexport { Dropdown };\n"],"names":["validDropdownChildren","dropdownComponentIds","triggers","SelectInput","DropdownButton","DropdownLink","DropdownOverlay","AutoComplete","bottomSheetComponentIds","BottomSheet","_Dropdown","_ref","children","isOpenControlled","isOpen","onOpenChange","_ref$selectionType","selectionType","testID","styledProps","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","options","setOptions","_React$useState3","_React$useState4","filteredValues","setFilteredValues","_React$useState5","_React$useState6","selectedIndices","setSelectedIndices","_React$useState7","_React$useState8","controlledValueIndices","setControlledValueIndices","_React$useState9","_React$useState10","activeIndex","setActiveIndex","_React$useState11","_React$useState12","activeTagIndex","setActiveTagIndex","_React$useState13","_React$useState14","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","_React$useState15","_React$useState16","hasFooterAction","setHasFooterAction","_React$useState17","_React$useState18","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","_React$useState19","_React$useState20","isKeydownPressed","setIsKeydownPressed","_React$useState21","_React$useState22","changeCallbackTriggerer","setChangeCallbackTriggerer","_React$useState23","_React$useState24","isControlled","setIsControlled","_React$useState25","_React$useState26","dropdownHasBottomSheet","setDropdownHasBottomSheet","triggererWrapperRef","useRef","triggererRef","actionListItemRef","dropdownTriggerer","isTagDismissedRef","value","visibleTagsCountRef","dropdownContainerRef","dropdownBaseId","useId","isDropdownOpenRef","_useControllableState","useControllableState","defaultValue","onChange","isOpenControlledValue","current","_useControllableState2","isDropdownOpen","setIsDropdownOpen","setIsOpen","isOpenValue","close","useCallback","Children","map","child","isValidElement","__DEV__","_getComponentId","includes","getComponentId","throwBladeError","message","join","moduleName","isValidAllowedChildren","contextValue","useMemo","BottomSheetAndDropdownGlueContextValue","onBottomSheetDismiss","useEffect","isReactNative","dropdown","documentClickHandler","e","_isTagDismissedRef$cu","_isTagDismissedRef$cu2","target","isOutsideClick","contains","isDropdownOpenState","documentFocusHandler","relatedTarget","document","addEventListener","removeEventListener","undefined","_jsx","BottomSheetAndDropdownGlueContext","Provider","DropdownContext","BaseBox","Object","assign","ref","metaAttribute","name","MetaConstants","Dropdown","getStyledProps","position","textAlign","assign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x"],"sourcesContent":["import React from 'react';\nimport { DropdownContext } from './useDropdown';\nimport type { DropdownContextType } from './useDropdown';\nimport type { DropdownProps } from './types';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { useId } from '~utils/useId';\nimport { ComponentIds as bottomSheetComponentIds } from '~components/BottomSheet/componentIds';\nimport { BottomSheetAndDropdownGlueContext } from '~components/BottomSheet/BottomSheetContext';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { isReactNative } from '~utils';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { ContainerElementType } from '~utils/types';\nimport { useControllableState } from '~utils/useControllable';\n\nconst validDropdownChildren = [\n dropdownComponentIds.triggers.SelectInput,\n dropdownComponentIds.triggers.DropdownButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\n];\n\n/**\n * ### Dropdown component\n *\n * Dropdown component is generic component that controls the dropdown functionality.\n * It can be used with multiple triggers and mostly contains ActionList component inside it\n *\n * ---\n *\n * #### Usage\n *\n * ```jsx\n * <Dropdown selectionType=\"single\">\n * <SelectInput />\n * <DropdownOverlay>\n * <ActionList>\n * <ActionListItem />\n * <ActionListItem />\n * </ActionList>\n * </DropdownOverlay>\n * </Dropdown>\n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-select--with-single-select Dropdown Documentation}\n */\nconst _Dropdown = ({\n children,\n isOpen: isOpenControlled,\n onOpenChange,\n selectionType = 'single',\n testID,\n ...styledProps\n}: DropdownProps): React.ReactElement => {\n const [options, setOptions] = React.useState<DropdownContextType['options']>([]);\n const [filteredValues, setFilteredValues] = React.useState<string[]>([]);\n const [selectedIndices, setSelectedIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [controlledValueIndices, setControlledValueIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n const [activeTagIndex, setActiveTagIndex] = React.useState(-1);\n const [shouldIgnoreBlurAnimation, setShouldIgnoreBlurAnimation] = React.useState(false);\n const [hasFooterAction, setHasFooterAction] = React.useState(false);\n const [\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n ] = React.useState(false);\n const [isKeydownPressed, setIsKeydownPressed] = React.useState(false);\n const [changeCallbackTriggerer, setChangeCallbackTriggerer] = React.useState<\n DropdownContextType['changeCallbackTriggerer']\n >(0);\n const [isControlled, setIsControlled] = React.useState(false);\n // keep track if dropdown contains bottomsheet\n const [dropdownHasBottomSheet, setDropdownHasBottomSheet] = React.useState(false);\n\n /**\n * In inputs, actual input is smaller than the visible input wrapper.\n * You can set this reference in such cases so floating ui calculations happen correctly\n * */\n const triggererWrapperRef = React.useRef<ContainerElementType>(null);\n const triggererRef = React.useRef<HTMLButtonElement>(null);\n const actionListItemRef = React.useRef<HTMLDivElement>(null);\n const dropdownTriggerer = React.useRef<DropdownContextType['dropdownTriggerer']>();\n const isTagDismissedRef = React.useRef<{ value: boolean } | null>({ value: false });\n const visibleTagsCountRef = React.useRef<{ value: number }>({ value: 0 });\n const dropdownContainerRef = React.useRef<HTMLDivElement>(null);\n\n const dropdownBaseId = useId('dropdown');\n const isDropdownOpenRef = React.useRef(isOpenControlled);\n\n const [isDropdownOpen, setIsDropdownOpen] = useControllableState({\n value: isOpenControlled,\n defaultValue: false,\n onChange: (isOpenControlledValue) => {\n isDropdownOpenRef.current = isOpenControlledValue;\n onOpenChange?.(isOpenControlledValue);\n },\n });\n\n isDropdownOpenRef.current = isDropdownOpen;\n\n const setIsOpen = (isOpenValue: boolean): void => {\n isDropdownOpenRef.current = isOpenValue;\n setIsDropdownOpen(() => isOpenValue);\n };\n\n const close = React.useCallback(() => {\n setActiveTagIndex(-1);\n setIsOpen(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n if (__DEV__) {\n if (!validDropdownChildren.includes(getComponentId(child) ?? '')) {\n throwBladeError({\n message: `Dropdown can only have one of following elements as children - \\n\\n ${validDropdownChildren.join(\n ', ',\n )} \\n\\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,\n moduleName: 'Dropdown',\n });\n }\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SelectInput)) {\n dropdownTriggerer.current = 'SelectInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.DropdownButton)) {\n dropdownTriggerer.current = 'DropdownButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.AutoComplete)) {\n dropdownTriggerer.current = 'AutoComplete';\n }\n }\n });\n\n const contextValue = React.useMemo<DropdownContextType>(\n () => ({\n isOpen: isDropdownOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n controlledValueIndices,\n setControlledValueIndices,\n options,\n setOptions,\n filteredValues,\n setFilteredValues,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n shouldIgnoreBlurAnimation,\n setShouldIgnoreBlurAnimation,\n isKeydownPressed,\n setIsKeydownPressed,\n dropdownBaseId,\n triggererRef,\n triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n dropdownTriggerer: dropdownTriggerer.current,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setIsControlled,\n isTagDismissedRef,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n isDropdownOpen,\n isOpenControlled,\n selectedIndices,\n controlledValueIndices,\n options,\n filteredValues,\n activeIndex,\n activeTagIndex,\n shouldIgnoreBlurAnimation,\n selectionType,\n hasFooterAction,\n isKeydownPressed,\n changeCallbackTriggerer,\n isControlled,\n ],\n );\n\n const BottomSheetAndDropdownGlueContextValue = React.useMemo((): BottomSheetAndDropdownGlueContext => {\n return {\n isOpen: isDropdownOpen,\n dropdownHasBottomSheet,\n hasAutoCompleteInBottomSheetHeader,\n setDropdownHasBottomSheet,\n // This is the dismiss function which will be injected into the BottomSheet\n // Basically <BottomSheet onDismiss={onBottomSheetDismiss} />\n onBottomSheetDismiss: close,\n };\n }, [dropdownHasBottomSheet, hasAutoCompleteInBottomSheetHeader, isDropdownOpen, close]);\n\n React.useEffect((): (() => void) | undefined => {\n if (!isReactNative()) {\n const dropdown = dropdownContainerRef.current;\n\n const documentClickHandler = (e: MouseEvent): void => {\n const target = e.target as HTMLDivElement;\n\n if (!target || !dropdown) {\n return;\n }\n\n const isOutsideClick =\n !dropdown.contains(target) &&\n !isTagDismissedRef.current?.value &&\n document.body.contains(target);\n\n const isDropdownOpenState = isDropdownOpenRef.current;\n if (isOutsideClick && isDropdownOpenState) {\n close();\n }\n\n if (isTagDismissedRef.current?.value) {\n isTagDismissedRef.current.value = false;\n }\n };\n\n const documentFocusHandler = (e: FocusEvent): void => {\n const target = e.relatedTarget as HTMLDivElement;\n setActiveIndex(-1);\n\n if (!dropdown || !target) {\n return;\n }\n\n if (!dropdown.contains(target)) {\n close();\n }\n };\n\n document.addEventListener('click', documentClickHandler);\n document.addEventListener('focusout', documentFocusHandler);\n\n return (): void => {\n document.removeEventListener('click', documentClickHandler);\n document.removeEventListener('focusout', documentFocusHandler);\n };\n }\n\n return undefined;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <BottomSheetAndDropdownGlueContext.Provider value={BottomSheetAndDropdownGlueContextValue}>\n <DropdownContext.Provider value={contextValue}>\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={dropdownContainerRef as any}\n {...metaAttribute({ name: MetaConstants.Dropdown, testID })}\n {...getStyledProps(styledProps)}\n >\n <BaseBox position=\"relative\" textAlign={'left' as never}>\n {children}\n </BaseBox>\n </BaseBox>\n </DropdownContext.Provider>\n </BottomSheetAndDropdownGlueContext.Provider>\n );\n};\n\nconst Dropdown = assignWithoutSideEffects(_Dropdown, {\n componentId: dropdownComponentIds.Dropdown,\n});\n\nexport { Dropdown };\n"],"names":["validDropdownChildren","dropdownComponentIds","triggers","SelectInput","DropdownButton","DropdownLink","DropdownOverlay","AutoComplete","bottomSheetComponentIds","BottomSheet","_Dropdown","_ref","children","isOpenControlled","isOpen","onOpenChange","_ref$selectionType","selectionType","testID","styledProps","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","options","setOptions","_React$useState3","_React$useState4","filteredValues","setFilteredValues","_React$useState5","_React$useState6","selectedIndices","setSelectedIndices","_React$useState7","_React$useState8","controlledValueIndices","setControlledValueIndices","_React$useState9","_React$useState10","activeIndex","setActiveIndex","_React$useState11","_React$useState12","activeTagIndex","setActiveTagIndex","_React$useState13","_React$useState14","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","_React$useState15","_React$useState16","hasFooterAction","setHasFooterAction","_React$useState17","_React$useState18","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","_React$useState19","_React$useState20","isKeydownPressed","setIsKeydownPressed","_React$useState21","_React$useState22","changeCallbackTriggerer","setChangeCallbackTriggerer","_React$useState23","_React$useState24","isControlled","setIsControlled","_React$useState25","_React$useState26","dropdownHasBottomSheet","setDropdownHasBottomSheet","triggererWrapperRef","useRef","triggererRef","actionListItemRef","dropdownTriggerer","isTagDismissedRef","value","visibleTagsCountRef","dropdownContainerRef","dropdownBaseId","useId","isDropdownOpenRef","_useControllableState","useControllableState","defaultValue","onChange","isOpenControlledValue","current","_useControllableState2","isDropdownOpen","setIsDropdownOpen","setIsOpen","isOpenValue","close","useCallback","Children","map","child","isValidElement","__DEV__","_getComponentId","includes","getComponentId","throwBladeError","message","join","moduleName","isValidAllowedChildren","contextValue","useMemo","BottomSheetAndDropdownGlueContextValue","onBottomSheetDismiss","useEffect","isReactNative","dropdown","documentClickHandler","e","_isTagDismissedRef$cu","_isTagDismissedRef$cu2","target","isOutsideClick","contains","document","body","isDropdownOpenState","documentFocusHandler","relatedTarget","addEventListener","removeEventListener","undefined","_jsx","BottomSheetAndDropdownGlueContext","Provider","DropdownContext","BaseBox","Object","assign","ref","metaAttribute","name","MetaConstants","Dropdown","getStyledProps","position","textAlign","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,QAAA,CAAA,cAAA,CAAA,eAAA,CAAA,QAAA,CAAA,CAkBA,IAAMA,qBAAqB,CAAG,CAC5BC,oBAAoB,CAACC,QAAQ,CAACC,WAAW,CACzCF,oBAAoB,CAACC,QAAQ,CAACE,cAAc,CAC5CH,oBAAoB,CAACC,QAAQ,CAACG,YAAY,CAC1CJ,oBAAoB,CAACK,eAAe,CACpCL,oBAAoB,CAACC,QAAQ,CAACK,YAAY,CAC1CC,YAAuB,CAACC,WAAW,CACpC,CA4BD,IAAMC,SAAS,CAAG,SAAZA,SAASA,CAAAC,IAAA,CAO0B,CANvC,IAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACAC,gBAAgB,CAAAF,IAAA,CAAxBG,MAAM,CACNC,YAAY,CAAAJ,IAAA,CAAZI,YAAY,CAAAC,kBAAA,CAAAL,IAAA,CACZM,aAAa,CAAbA,aAAa,CAAAD,kBAAA,UAAG,QAAQ,CAAAA,kBAAA,CACxBE,MAAM,CAAAP,IAAA,CAANO,MAAM,CACHC,WAAW,CAAAC,wBAAA,CAAAT,IAAA,CAAAU,SAAA,CAAA,CAEd,IAAAC,eAAA,CAA8BC,cAAK,CAACC,QAAQ,CAAiC,EAAE,CAAC,CAAAC,gBAAA,CAAAC,cAAA,CAAAJ,eAAA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