{"version":3,"file":"index.BRBbTPoz.js","sources":["../../../../../../../node_modules/@babylon/ui-kit-base/components/text/price-with-currency/styled.js","../../../../../../../node_modules/@babylon/ui-kit-base/components/text/price-with-currency/index.js"],"sourcesContent":["import styled from 'styled-components';\n\nconst Price = /*#__PURE__*/ styled.span.withConfig({\n displayName: \"Price\"\n})([\n `--price-font-size:100%;`,\n `;font-size:var(--price-font-size);font-size:max(15px,var(--price-font-size));line-height:100%;`\n], ({ $size = 0 })=>$size > 5 && '--price-font-size: 80%;');\nconst Currency = /*#__PURE__*/ styled.span.withConfig({\n displayName: \"Currency\"\n})([\n `--currency-font-size:80%;&.small{--currency-font-size:70%;}font-size:var(--currency-font-size);font-size:max(13px,var(--currency-font-size));`\n]);\n\nexport { Currency, Price };\n","import { jsx } from 'react/jsx-runtime';\nimport { formatPriceToParts } from '@babylon/ui-kit-helpers/currency';\nimport { genKey } from '@babylon/ui-kit-helpers/keys';\nimport React from 'react';\nimport { Currency, Price } from './styled.js';\n\n// Types to check\nconst types = [\n 'integer',\n 'group',\n 'decimal'\n];\nconst PriceWithCurrency = ({ props, className })=>{\n const { price = 0, currency = 'EUR', locale = 'es', minimumFractionDigits = 0 } = props ?? {};\n const priceParts = formatPriceToParts(price, currency, locale, minimumFractionDigits);\n // Var to check not currency price length\n let priceLenghtWithoutCurrency = 0;\n // Formatted price with the currency\n const priceFormatted = priceParts.map(({ type, value }, index)=>{\n if (types.includes(type)) priceLenghtWithoutCurrency += value.length;\n switch(type){\n case 'currency':\n {\n const currencyClassName = `currency ${value.length >= 3 ? 'small' : ''}`.trim();\n return /*#__PURE__*/ jsx(Currency, {\n className: currencyClassName,\n children: value\n }, genKey(`${index}`));\n }\n case 'fraction':\n return /*#__PURE__*/ jsx(Currency, {\n children: value\n }, genKey(`${index}`));\n // Removes white spaces between price and currency\n case 'literal':\n return null;\n default:\n return /*#__PURE__*/ jsx(React.Fragment, {\n children: value\n }, genKey(`${index}`));\n }\n });\n return /*#__PURE__*/ jsx(Price, {\n className: className,\n $size: priceLenghtWithoutCurrency,\n children: priceFormatted\n });\n};\n\nexport { PriceWithCurrency as default };\n"],"names":["Price","styled","$size","Currency","types","PriceWithCurrency","props","className","price","currency","locale","minimumFractionDigits","priceParts","formatPriceToParts","priceLenghtWithoutCurrency","priceFormatted","type","value","index","currencyClassName","jsx","genKey","React"],"mappings":"sEAEA,MAAMA,EAAsBC,EAAO,KAAK,WAAW,CAC/C,YAAa,OACjB,CAAC,EAAE,CACC,0BACA,gGACJ,EAAG,CAAC,CAAE,MAAAC,EAAQ,CAAC,IAAKA,EAAQ,GAAK,yBAAyB,EACpDC,EAAyBF,EAAO,KAAK,WAAW,CAClD,YAAa,UACjB,CAAC,EAAE,CACC,+IACJ,CAAC,ECLKG,EAAQ,CACV,UACA,QACA,SACJ,EACMC,EAAoB,CAAC,CAAE,MAAAC,EAAO,UAAAC,KAAc,CAC9C,KAAM,CAAE,MAAAC,EAAQ,EAAG,SAAAC,EAAW,MAAO,OAAAC,EAAS,KAAM,sBAAAC,EAAwB,GAAML,GAAS,CAAA,EACrFM,EAAaC,EAAmBL,EAAOC,EAAUC,EAAQC,CAAqB,EAEpF,IAAIG,EAA6B,EAEjC,MAAMC,EAAiBH,EAAW,IAAI,CAAC,CAAE,KAAAI,EAAM,MAAAC,CAAO,EAAEC,IAAQ,CAE5D,OADId,EAAM,SAASY,CAAI,IAAGF,GAA8BG,EAAM,QACvDD,EAAI,CACP,IAAK,WACD,CACI,MAAMG,EAAoB,YAAYF,EAAM,QAAU,EAAI,QAAU,EAAE,GAAG,OACzE,OAAqBG,EAAAA,IAAIjB,EAAU,CAC/B,UAAWgB,EACX,SAAUF,CACb,EAAEI,EAAO,GAAGH,CAAK,EAAE,CAAC,CACxB,CACL,IAAK,WACD,OAAqBE,EAAAA,IAAIjB,EAAU,CAC/B,SAAUc,CACb,EAAEI,EAAO,GAAGH,CAAK,EAAE,CAAC,EAEzB,IAAK,UACD,OAAO,KACX,QACI,OAAqBE,EAAG,IAACE,EAAM,SAAU,CACrC,SAAUL,CACb,EAAEI,EAAO,GAAGH,CAAK,EAAE,CAAC,CAC5B,CACT,CAAK,EACD,OAAqBE,EAAAA,IAAIpB,EAAO,CAC5B,UAAWO,EACX,MAAOO,EACP,SAAUC,CAClB,CAAK,CACL","x_google_ignoreList":[0,1]}