@trafilea/afrodita-components 6.54.6 → 6.54.7

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/index.d.ts CHANGED
@@ -114,19 +114,19 @@ interface PriceLabelProps {
114
114
  }
115
115
  declare const PriceLabel: react__default.FC<PriceLabelProps>;
116
116
 
117
- declare type Props$2 = PriceLabelProps & {
117
+ declare type Props$3 = PriceLabelProps & {
118
118
  savingsDisplay?: boolean;
119
119
  pricePerItem?: string;
120
120
  hasRoundedSavings?: boolean;
121
121
  };
122
- declare const PriceLabelV2: react__default.FC<Props$2>;
122
+ declare const PriceLabelV2: react__default.FC<Props$3>;
123
123
 
124
- declare type Props$1 = PriceLabelProps & {
124
+ declare type Props$2 = PriceLabelProps & {
125
125
  savingsDisplay?: boolean;
126
126
  itemsQuantity?: number;
127
127
  packUnitPrice?: string;
128
128
  };
129
- declare const PriceLabelV3: react__default.FC<Props$1>;
129
+ declare const PriceLabelV3: react__default.FC<Props$2>;
130
130
 
131
131
  interface PriceLabelV5Props {
132
132
  finalPrice: string | number;
@@ -225,8 +225,8 @@ declare type ToggleProps = {
225
225
 
226
226
  declare const ToggleComponent: FC<ToggleProps>;
227
227
 
228
- declare type Props = Omit<IconProps$1, 'name'>;
229
- declare type IconComponent = react__default.FC<Props>;
228
+ declare type Props$1 = Omit<IconProps$1, 'name'>;
229
+ declare type IconComponent = react__default.FC<Props$1>;
230
230
 
231
231
  declare const Add: IconComponent;
232
232
 
@@ -4465,10 +4465,12 @@ declare const buildImageUrl: BuildImageUrl;
4465
4465
  */
4466
4466
  declare const decimalFormat: (number: number) => string;
4467
4467
 
4468
- declare const formatPrice: (value: number, { locale, currency }?: {
4469
- locale?: string | undefined;
4470
- currency?: string | undefined;
4471
- }) => string;
4468
+ interface Props {
4469
+ locale?: string;
4470
+ currency?: string;
4471
+ decimals?: number;
4472
+ }
4473
+ declare const formatPrice: (value: number, { locale, currency, decimals }?: Props) => string;
4472
4474
 
4473
4475
  declare const getSrcSet: (imgLink: string, ...breakpoints: number[]) => string;
4474
4476
 
@@ -3115,15 +3115,15 @@ var localeOverrideByCurrency = {
3115
3115
  };
3116
3116
  var formatPrice = function (value, _a) {
3117
3117
  var _b, _c;
3118
- var _d = _a === void 0 ? {} : _a, _e = _d.locale, locale = _e === void 0 ? 'en-US' : _e, _f = _d.currency, currency = _f === void 0 ? 'USD' : _f;
3119
- var _g = value.toFixed(3).split('.'), integer = _g[0], fraction = _g[1];
3118
+ var _d = _a === void 0 ? {} : _a, _e = _d.locale, locale = _e === void 0 ? 'en-US' : _e, _f = _d.currency, currency = _f === void 0 ? 'USD' : _f, _g = _d.decimals, decimals = _g === void 0 ? 3 : _g;
3119
+ var _h = value.toFixed(decimals).split('.'), integer = _h[0], fraction = _h[1];
3120
3120
  // this prevents `Intl.NumberFormat` from rounding the number
3121
- var valueToFormat = parseFloat("".concat(integer, ".").concat((_b = fraction === null || fraction === void 0 ? void 0 : fraction.slice(0, 2)) !== null && _b !== void 0 ? _b : 0));
3121
+ var valueToFormat = parseFloat("".concat(integer, ".").concat((_b = fraction === null || fraction === void 0 ? void 0 : fraction.slice(0, decimals - 1)) !== null && _b !== void 0 ? _b : 0));
3122
3122
  var overridedLocale = (_c = localeOverrideByCurrency[currency]) !== null && _c !== void 0 ? _c : locale;
3123
3123
  var result = new Intl.NumberFormat(overridedLocale, {
3124
3124
  style: 'currency',
3125
3125
  currency: currency,
3126
- maximumFractionDigits: 3,
3126
+ maximumFractionDigits: decimals,
3127
3127
  }).format(valueToFormat);
3128
3128
  if (currency === 'SGD') {
3129
3129
  // intlFormat does not support singapure currency
package/build/index.js CHANGED
@@ -3141,15 +3141,15 @@ var localeOverrideByCurrency = {
3141
3141
  };
3142
3142
  var formatPrice = function (value, _a) {
3143
3143
  var _b, _c;
3144
- var _d = _a === void 0 ? {} : _a, _e = _d.locale, locale = _e === void 0 ? 'en-US' : _e, _f = _d.currency, currency = _f === void 0 ? 'USD' : _f;
3145
- var _g = value.toFixed(3).split('.'), integer = _g[0], fraction = _g[1];
3144
+ var _d = _a === void 0 ? {} : _a, _e = _d.locale, locale = _e === void 0 ? 'en-US' : _e, _f = _d.currency, currency = _f === void 0 ? 'USD' : _f, _g = _d.decimals, decimals = _g === void 0 ? 3 : _g;
3145
+ var _h = value.toFixed(decimals).split('.'), integer = _h[0], fraction = _h[1];
3146
3146
  // this prevents `Intl.NumberFormat` from rounding the number
3147
- var valueToFormat = parseFloat("".concat(integer, ".").concat((_b = fraction === null || fraction === void 0 ? void 0 : fraction.slice(0, 2)) !== null && _b !== void 0 ? _b : 0));
3147
+ var valueToFormat = parseFloat("".concat(integer, ".").concat((_b = fraction === null || fraction === void 0 ? void 0 : fraction.slice(0, decimals - 1)) !== null && _b !== void 0 ? _b : 0));
3148
3148
  var overridedLocale = (_c = localeOverrideByCurrency[currency]) !== null && _c !== void 0 ? _c : locale;
3149
3149
  var result = new Intl.NumberFormat(overridedLocale, {
3150
3150
  style: 'currency',
3151
3151
  currency: currency,
3152
- maximumFractionDigits: 3,
3152
+ maximumFractionDigits: decimals,
3153
3153
  }).format(valueToFormat);
3154
3154
  if (currency === 'SGD') {
3155
3155
  // intlFormat does not support singapure currency
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Trafilea's Design System",
4
4
  "author": "Trafilea",
5
5
  "repository": "https://github.com/trafilea/afrodita-components",
6
- "version": "6.54.6",
6
+ "version": "6.54.7",
7
7
  "private": false,
8
8
  "main": "build/index.js",
9
9
  "style": "build/index.css",