@caratlogic/design-system 0.1.46 → 0.1.47

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.
@@ -1 +1 @@
1
- {"version":3,"file":"InvoiceComboBox.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/InvoiceComboBox/InvoiceComboBox.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAM3D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAKxE;AAED,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAG3D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAE1D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAM3D"}
1
+ {"version":3,"file":"InvoiceComboBox.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/InvoiceComboBox/InvoiceComboBox.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAG3D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CASxE;AAED,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAG3D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAE1D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAM3D"}
package/dist/index.cjs.js CHANGED
@@ -14041,9 +14041,15 @@ const getCurrencySymbol = (code) => {
14041
14041
  CAD: 'CA$',
14042
14042
  CHF: 'CHF',
14043
14043
  INR: '₹',
14044
+ PLN: 'zł',
14044
14045
  };
14045
14046
  return symbols[c] ?? c;
14046
14047
  };
14048
+ /** Intl prints the bare code for currencies with no English symbol (PLN 1,230.00); use our symbol instead. */
14049
+ const withCurrencySymbol = (formatted, code) => {
14050
+ const symbol = getCurrencySymbol(code);
14051
+ return symbol === code ? formatted : formatted.replace(code, symbol);
14052
+ };
14047
14053
  /**
14048
14054
  * Format currency amount with proper symbol, ensuring USD always shows as "$" not "US$"
14049
14055
  * This normalizes browser inconsistencies in Intl.NumberFormat output
@@ -14067,7 +14073,7 @@ function formatCurrencyAmount(amount, currency, options) {
14067
14073
  if (currencyCode === 'USD' && formatted.includes('US$')) {
14068
14074
  formatted = formatted.replace(/US\$/g, '$');
14069
14075
  }
14070
- return formatted;
14076
+ return withCurrencySymbol(formatted, currencyCode);
14071
14077
  }
14072
14078
  catch (error) {
14073
14079
  // Fallback if currency code is invalid
@@ -44645,17 +44651,15 @@ const WarehouseFilter = ({ getWarehouseList, ...props }) => {
44645
44651
  };
44646
44652
 
44647
44653
  function formatInvoiceLabel(invoice) {
44648
- const amount = new Intl.NumberFormat('en-US', {
44649
- style: 'currency',
44650
- currency: invoice.baseCurrency || 'USD',
44651
- }).format(invoice.totalAmount);
44654
+ const amount = formatCurrency(invoice.totalAmount, invoice.baseCurrency);
44652
44655
  return `${invoice.invoiceNumber} - ${invoice.customer?.contactName || 'N/A'} (${amount})`;
44653
44656
  }
44654
44657
  function formatCurrency(amount, currency) {
44655
- return new Intl.NumberFormat('en-US', {
44658
+ const code = currency || 'USD';
44659
+ return withCurrencySymbol(new Intl.NumberFormat('en-US', {
44656
44660
  style: 'currency',
44657
- currency: currency || 'USD',
44658
- }).format(amount);
44661
+ currency: code,
44662
+ }).format(amount), code);
44659
44663
  }
44660
44664
  /** The currency the invoice was issued in; `baseCurrency` is only its ledger currency. */
44661
44665
  function getInvoiceCurrency(invoice) {