@razorpay/blade 9.5.3 → 9.6.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.
@@ -26102,7 +26102,7 @@ var _Switch = function _Switch(_ref, ref) {
26102
26102
  onKeyDown: handleKeyboardPressedIn,
26103
26103
  onKeyUp: handleKeyboardPressedOut,
26104
26104
  style: {
26105
- cursor: 'pointer'
26105
+ cursor: isDisabled ? 'not-allowed' : 'pointer'
26106
26106
  },
26107
26107
  inputProps: state.isReactNative ? // accessibility label for react-native needs to be added
26108
26108
  // since there is no text children inside Switch
@@ -26406,33 +26406,406 @@ var amountLineHeights = {
26406
26406
  'heading-large-bold': 400,
26407
26407
  'title-small': 500,
26408
26408
  'title-medium': 600
26409
- };
26409
+ }; // All the supported currency codes are taken from Razorpay's Merchant Dashboard codebase
26410
+
26410
26411
  var currencyPrefixMapping = {
26412
+ AED: {
26413
+ 'currency-symbol': 'د.إ',
26414
+ 'currency-code': 'AED'
26415
+ },
26416
+ ALL: {
26417
+ 'currency-symbol': 'Lek',
26418
+ 'currency-code': 'ALL'
26419
+ },
26420
+ AMD: {
26421
+ 'currency-symbol': '֏',
26422
+ 'currency-code': 'AMD'
26423
+ },
26424
+ ARS: {
26425
+ 'currency-symbol': 'ARS',
26426
+ 'currency-code': 'ARS'
26427
+ },
26428
+ AUD: {
26429
+ 'currency-symbol': 'A$',
26430
+ 'currency-code': 'AUD'
26431
+ },
26432
+ AWG: {
26433
+ 'currency-symbol': 'Afl.',
26434
+ 'currency-code': 'AWG'
26435
+ },
26436
+ BBD: {
26437
+ 'currency-symbol': '$',
26438
+ 'currency-code': 'BBD'
26439
+ },
26440
+ BDT: {
26441
+ 'currency-symbol': '৳',
26442
+ 'currency-code': 'BDT'
26443
+ },
26444
+ BMD: {
26445
+ 'currency-symbol': '$',
26446
+ 'currency-code': 'BMD'
26447
+ },
26448
+ BND: {
26449
+ 'currency-symbol': 'BND',
26450
+ 'currency-code': 'BND'
26451
+ },
26452
+ BOB: {
26453
+ 'currency-symbol': 'Bs',
26454
+ 'currency-code': 'BOB'
26455
+ },
26456
+ BSD: {
26457
+ 'currency-symbol': 'B$',
26458
+ 'currency-code': 'BSD'
26459
+ },
26460
+ BWP: {
26461
+ 'currency-symbol': 'P',
26462
+ 'currency-code': 'BWP'
26463
+ },
26464
+ BZD: {
26465
+ 'currency-symbol': 'BZ$',
26466
+ 'currency-code': 'BZD'
26467
+ },
26468
+ CAD: {
26469
+ 'currency-symbol': 'C$',
26470
+ 'currency-code': 'CAD'
26471
+ },
26472
+ CHF: {
26473
+ 'currency-symbol': 'CHf',
26474
+ 'currency-code': 'CHF'
26475
+ },
26476
+ CNY: {
26477
+ 'currency-symbol': '¥',
26478
+ 'currency-code': 'CNY'
26479
+ },
26480
+ COP: {
26481
+ 'currency-symbol': 'COL$',
26482
+ 'currency-code': 'COP'
26483
+ },
26484
+ CRC: {
26485
+ 'currency-symbol': '₡',
26486
+ 'currency-code': 'CRC'
26487
+ },
26488
+ CUP: {
26489
+ 'currency-symbol': '$MN',
26490
+ 'currency-code': 'CUP'
26491
+ },
26492
+ CZK: {
26493
+ 'currency-symbol': 'Kč',
26494
+ 'currency-code': 'CZK'
26495
+ },
26496
+ DKK: {
26497
+ 'currency-symbol': 'DKK',
26498
+ 'currency-code': 'DKK'
26499
+ },
26500
+ DOP: {
26501
+ 'currency-symbol': 'RD$',
26502
+ 'currency-code': 'DOP'
26503
+ },
26504
+ DZD: {
26505
+ 'currency-symbol': 'د.ج',
26506
+ 'currency-code': 'DZD'
26507
+ },
26508
+ EGP: {
26509
+ 'currency-symbol': 'E£',
26510
+ 'currency-code': 'EGP'
26511
+ },
26512
+ ETB: {
26513
+ 'currency-symbol': 'ብር',
26514
+ 'currency-code': 'ETB'
26515
+ },
26516
+ EUR: {
26517
+ 'currency-symbol': '€',
26518
+ 'currency-code': 'EUR'
26519
+ },
26520
+ FJD: {
26521
+ 'currency-symbol': 'FJ$',
26522
+ 'currency-code': 'FJD'
26523
+ },
26524
+ GBP: {
26525
+ 'currency-symbol': '£',
26526
+ 'currency-code': 'GBP'
26527
+ },
26528
+ GHS: {
26529
+ 'currency-symbol': 'GH₵',
26530
+ 'currency-code': 'GHS'
26531
+ },
26532
+ GIP: {
26533
+ 'currency-symbol': 'GIP',
26534
+ 'currency-code': 'GIP'
26535
+ },
26536
+ GMD: {
26537
+ 'currency-symbol': 'D',
26538
+ 'currency-code': 'GMD'
26539
+ },
26540
+ GTQ: {
26541
+ 'currency-symbol': 'Q',
26542
+ 'currency-code': 'GTQ'
26543
+ },
26544
+ GYD: {
26545
+ 'currency-symbol': 'G$',
26546
+ 'currency-code': 'GYD'
26547
+ },
26548
+ HKD: {
26549
+ 'currency-symbol': 'HK$',
26550
+ 'currency-code': 'HKD'
26551
+ },
26552
+ HNL: {
26553
+ 'currency-symbol': 'HNL',
26554
+ 'currency-code': 'HNL'
26555
+ },
26556
+ HRK: {
26557
+ 'currency-symbol': 'kn',
26558
+ 'currency-code': 'HRK'
26559
+ },
26560
+ HTG: {
26561
+ 'currency-symbol': 'G',
26562
+ 'currency-code': 'HTG'
26563
+ },
26564
+ HUF: {
26565
+ 'currency-symbol': 'Ft',
26566
+ 'currency-code': 'HUF'
26567
+ },
26568
+ IDR: {
26569
+ 'currency-symbol': 'Rp',
26570
+ 'currency-code': 'IDR'
26571
+ },
26572
+ ILS: {
26573
+ 'currency-symbol': '₪',
26574
+ 'currency-code': 'ILS'
26575
+ },
26411
26576
  INR: {
26412
26577
  'currency-symbol': '₹',
26413
26578
  'currency-code': 'INR'
26414
26579
  },
26580
+ JMD: {
26581
+ 'currency-symbol': 'J$',
26582
+ 'currency-code': 'JMD'
26583
+ },
26584
+ KES: {
26585
+ 'currency-symbol': 'Ksh',
26586
+ 'currency-code': 'KES'
26587
+ },
26588
+ KGS: {
26589
+ 'currency-symbol': 'Лв',
26590
+ 'currency-code': 'KGS'
26591
+ },
26592
+ KHR: {
26593
+ 'currency-symbol': '៛',
26594
+ 'currency-code': 'KHR'
26595
+ },
26596
+ KYD: {
26597
+ 'currency-symbol': 'CI$',
26598
+ 'currency-code': 'KYD'
26599
+ },
26600
+ KZT: {
26601
+ 'currency-symbol': '₸',
26602
+ 'currency-code': 'KZT'
26603
+ },
26604
+ LAK: {
26605
+ 'currency-symbol': '₭',
26606
+ 'currency-code': 'LAK'
26607
+ },
26608
+ LKR: {
26609
+ 'currency-symbol': 'රු',
26610
+ 'currency-code': 'LKR'
26611
+ },
26612
+ LRD: {
26613
+ 'currency-symbol': 'L$',
26614
+ 'currency-code': 'LRD'
26615
+ },
26616
+ LSL: {
26617
+ 'currency-symbol': 'LSL',
26618
+ 'currency-code': 'LSL'
26619
+ },
26620
+ MAD: {
26621
+ 'currency-symbol': 'د.م.',
26622
+ 'currency-code': 'MAD'
26623
+ },
26624
+ MDL: {
26625
+ 'currency-symbol': 'MDL',
26626
+ 'currency-code': 'MDL'
26627
+ },
26628
+ MKD: {
26629
+ 'currency-symbol': 'ден',
26630
+ 'currency-code': 'MKD'
26631
+ },
26632
+ MMK: {
26633
+ 'currency-symbol': 'MMK',
26634
+ 'currency-code': 'MMK'
26635
+ },
26636
+ MNT: {
26637
+ 'currency-symbol': '₮',
26638
+ 'currency-code': 'MNT'
26639
+ },
26640
+ MOP: {
26641
+ 'currency-symbol': 'MOP$',
26642
+ 'currency-code': 'MOP'
26643
+ },
26644
+ MUR: {
26645
+ 'currency-symbol': '₨',
26646
+ 'currency-code': 'MUR'
26647
+ },
26648
+ MVR: {
26649
+ 'currency-symbol': 'Rf',
26650
+ 'currency-code': 'MVR'
26651
+ },
26652
+ MWK: {
26653
+ 'currency-symbol': 'MK',
26654
+ 'currency-code': 'MWK'
26655
+ },
26656
+ MXN: {
26657
+ 'currency-symbol': 'Mex$',
26658
+ 'currency-code': 'MXN'
26659
+ },
26415
26660
  MYR: {
26416
26661
  'currency-symbol': 'RM',
26417
26662
  'currency-code': 'MYR'
26663
+ },
26664
+ NAD: {
26665
+ 'currency-symbol': 'N$',
26666
+ 'currency-code': 'NAD'
26667
+ },
26668
+ NGN: {
26669
+ 'currency-symbol': '₦',
26670
+ 'currency-code': 'NGN'
26671
+ },
26672
+ NIO: {
26673
+ 'currency-symbol': 'NIO',
26674
+ 'currency-code': 'NIO'
26675
+ },
26676
+ NOK: {
26677
+ 'currency-symbol': 'NOK',
26678
+ 'currency-code': 'NOK'
26679
+ },
26680
+ NPR: {
26681
+ 'currency-symbol': 'रू',
26682
+ 'currency-code': 'NPR'
26683
+ },
26684
+ NZD: {
26685
+ 'currency-symbol': 'NZ$',
26686
+ 'currency-code': 'NZD'
26687
+ },
26688
+ PEN: {
26689
+ 'currency-symbol': 'S/',
26690
+ 'currency-code': 'PEN'
26691
+ },
26692
+ PGK: {
26693
+ 'currency-symbol': 'PGK',
26694
+ 'currency-code': 'PGK'
26695
+ },
26696
+ PHP: {
26697
+ 'currency-symbol': '₱',
26698
+ 'currency-code': 'PHP'
26699
+ },
26700
+ PKR: {
26701
+ 'currency-symbol': '₨',
26702
+ 'currency-code': 'PKR'
26703
+ },
26704
+ QAR: {
26705
+ 'currency-symbol': 'QR',
26706
+ 'currency-code': 'QAR'
26707
+ },
26708
+ RUB: {
26709
+ 'currency-symbol': '₽',
26710
+ 'currency-code': 'RUB'
26711
+ },
26712
+ SAR: {
26713
+ 'currency-symbol': 'SR',
26714
+ 'currency-code': 'SAR'
26715
+ },
26716
+ SCR: {
26717
+ 'currency-symbol': 'SRe',
26718
+ 'currency-code': 'SCR'
26719
+ },
26720
+ SEK: {
26721
+ 'currency-symbol': 'SEK',
26722
+ 'currency-code': 'SEK'
26723
+ },
26724
+ SGD: {
26725
+ 'currency-symbol': 'S$',
26726
+ 'currency-code': 'SGD'
26727
+ },
26728
+ SLL: {
26729
+ 'currency-symbol': 'Le',
26730
+ 'currency-code': 'SLL'
26731
+ },
26732
+ SOS: {
26733
+ 'currency-symbol': 'Sh.so.',
26734
+ 'currency-code': 'SOS'
26735
+ },
26736
+ SSP: {
26737
+ 'currency-symbol': 'SS£',
26738
+ 'currency-code': 'SSP'
26739
+ },
26740
+ SVC: {
26741
+ 'currency-symbol': '₡',
26742
+ 'currency-code': 'SVC'
26743
+ },
26744
+ SZL: {
26745
+ 'currency-symbol': 'E',
26746
+ 'currency-code': 'SZL'
26747
+ },
26748
+ THB: {
26749
+ 'currency-symbol': '฿',
26750
+ 'currency-code': 'THB'
26751
+ },
26752
+ TTD: {
26753
+ 'currency-symbol': 'TT$',
26754
+ 'currency-code': 'TTD'
26755
+ },
26756
+ TZS: {
26757
+ 'currency-symbol': 'Sh',
26758
+ 'currency-code': 'TZS'
26759
+ },
26760
+ USD: {
26761
+ 'currency-symbol': '$',
26762
+ 'currency-code': 'USD'
26763
+ },
26764
+ UYU: {
26765
+ 'currency-symbol': '$U',
26766
+ 'currency-code': 'UYU'
26767
+ },
26768
+ UZS: {
26769
+ 'currency-symbol': "so'm",
26770
+ 'currency-code': 'UZS'
26771
+ },
26772
+ YER: {
26773
+ 'currency-symbol': '﷼',
26774
+ 'currency-code': 'YER'
26775
+ },
26776
+ ZAR: {
26777
+ 'currency-symbol': 'R',
26778
+ 'currency-code': 'ZAR'
26779
+ },
26780
+ KWD: {
26781
+ 'currency-symbol': 'د.ك',
26782
+ 'currency-code': 'KWD'
26783
+ },
26784
+ BHD: {
26785
+ 'currency-symbol': 'د.ب.',
26786
+ 'currency-code': 'BHD'
26787
+ },
26788
+ OMR: {
26789
+ 'currency-symbol': 'ر.ع.',
26790
+ 'currency-code': 'OMR'
26418
26791
  }
26419
26792
  };
26420
- var currencyLocaleMapping = {
26421
- INR: 'en-IN',
26422
- MYR: 'en-MY'
26423
- };
26424
- var currencyAbbreviationsMapping = {
26425
- INR: [{
26426
- value: 1e7,
26427
- symbol: 'Cr'
26428
- }, {
26429
- value: 1e5,
26430
- symbol: 'L'
26431
- }, {
26432
- value: 1e3,
26433
- symbol: 'k'
26434
- }],
26435
- MYR: [{
26793
+
26794
+ var getCurrencyAbbreviations = function getCurrencyAbbreviations(currency) {
26795
+ if (currency === 'INR') {
26796
+ return [{
26797
+ value: 1e7,
26798
+ symbol: 'Cr'
26799
+ }, {
26800
+ value: 1e5,
26801
+ symbol: 'L'
26802
+ }, {
26803
+ value: 1e3,
26804
+ symbol: 'k'
26805
+ }];
26806
+ }
26807
+
26808
+ return [{
26436
26809
  value: 1e9,
26437
26810
  symbol: 'B'
26438
26811
  }, {
@@ -26441,7 +26814,7 @@ var currencyAbbreviationsMapping = {
26441
26814
  }, {
26442
26815
  value: 1e3,
26443
26816
  symbol: 'K'
26444
- }]
26817
+ }];
26445
26818
  };
26446
26819
 
26447
26820
  var _excluded$3 = ["value", "suffix", "size", "isAffixSubtle", "intent", "prefix", "testID", "currency"];
@@ -26516,7 +26889,9 @@ var getFlooredFixed = function getFlooredFixed(value, decimalPlaces) {
26516
26889
  };
26517
26890
  var addCommas = function addCommas(amountValue, currency) {
26518
26891
  var decimalPlaces = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
26519
- var locale = currencyLocaleMapping[currency];
26892
+ // If the currency is 'INR', set the locale to 'en-IN' (Indian English).
26893
+ // Otherwise, set the locale to 'en-US' (U.S. English).
26894
+ var locale = currency === 'INR' ? 'en-IN' : 'en-US';
26520
26895
  return amountValue.toLocaleString(locale, {
26521
26896
  minimumFractionDigits: decimalPlaces
26522
26897
  });
@@ -26528,7 +26903,7 @@ var addCommas = function addCommas(amountValue, currency) {
26528
26903
  */
26529
26904
 
26530
26905
  var getHumanizedAmount = function getHumanizedAmount(amountValue, currency) {
26531
- var abbreviations = currencyAbbreviationsMapping[currency];
26906
+ var abbreviations = getCurrencyAbbreviations(currency);
26532
26907
  var abbreviation = abbreviations.find(function (abbr) {
26533
26908
  return amountValue >= abbr.value;
26534
26909
  });