@razorpay/blade 6.7.0 → 7.0.0

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.
@@ -3592,7 +3592,7 @@ var fontWeight = {
3592
3592
  300: 18,
3593
3593
  400: 20,
3594
3594
  500: 22,
3595
- 600: 25,
3595
+ 600: 24,
3596
3596
  700: 28,
3597
3597
  800: 32,
3598
3598
  900: 36,
@@ -3601,15 +3601,18 @@ var fontWeight = {
3601
3601
  weight: _objectSpread$5j({}, fontWeight)
3602
3602
  },
3603
3603
  lineHeights: {
3604
- s: 16,
3605
- m: 16,
3606
- l: 20,
3607
- xl: 24,
3608
- '2xl': 24,
3609
- '3xl': 28,
3610
- '4xl': 40,
3611
- '5xl': 42,
3612
- '6xl': 60
3604
+ 0: 0,
3605
+ 25: 14,
3606
+ 50: 16,
3607
+ 75: 18,
3608
+ 100: 20,
3609
+ 200: 24,
3610
+ 300: 24,
3611
+ 400: 28,
3612
+ 500: 32,
3613
+ 600: 40,
3614
+ 700: 40,
3615
+ 800: 48
3613
3616
  } // letterSpacings: {},
3614
3617
 
3615
3618
  },
@@ -3617,33 +3620,36 @@ var fontWeight = {
3617
3620
  fonts: {
3618
3621
  family: _objectSpread$5j({}, fontFamily),
3619
3622
  size: {
3620
- 10: 10,
3621
- 25: 11,
3623
+ 10: 9,
3624
+ 25: 10,
3622
3625
  50: 11,
3623
3626
  75: 12,
3624
- 100: 15,
3625
- 200: 17,
3626
- 300: 18,
3627
- 400: 20,
3628
- 500: 22,
3629
- 600: 22,
3627
+ 100: 14,
3628
+ 200: 16,
3629
+ 300: 16,
3630
+ 400: 18,
3631
+ 500: 20,
3632
+ 600: 20,
3630
3633
  700: 24,
3631
3634
  800: 28,
3632
- 900: 29,
3633
- 1000: 29
3635
+ 900: 32,
3636
+ 1000: 32
3634
3637
  },
3635
3638
  weight: _objectSpread$5j({}, fontWeight)
3636
3639
  },
3637
3640
  lineHeights: {
3638
- s: 16,
3639
- m: 18,
3640
- l: 24,
3641
- xl: 28,
3642
- '2xl': 24,
3643
- '3xl': 28,
3644
- '4xl': 32,
3645
- '5xl': 30,
3646
- '6xl': 40
3641
+ 0: 0,
3642
+ 25: 14,
3643
+ 50: 16,
3644
+ 75: 18,
3645
+ 100: 20,
3646
+ 200: 20,
3647
+ 300: 24,
3648
+ 400: 24,
3649
+ 500: 28,
3650
+ 600: 32,
3651
+ 700: 40,
3652
+ 800: 40
3647
3653
  } // letterSpacings: {},
3648
3654
 
3649
3655
  }
@@ -5202,7 +5208,7 @@ var getBaseTextStyles = function getBaseTextStyles(_ref) {
5202
5208
  _ref$textDecorationLi = _ref.textDecorationLine,
5203
5209
  textDecorationLine = _ref$textDecorationLi === void 0 ? 'none' : _ref$textDecorationLi,
5204
5210
  _ref$lineHeight = _ref.lineHeight,
5205
- lineHeight = _ref$lineHeight === void 0 ? 'l' : _ref$lineHeight,
5211
+ lineHeight = _ref$lineHeight === void 0 ? 100 : _ref$lineHeight,
5206
5212
  textAlign = _ref.textAlign,
5207
5213
  theme = _ref.theme;
5208
5214
  var textColor = get_1(theme.colors, color);
@@ -5536,7 +5542,7 @@ var getProps$3 = function getProps(_ref) {
5536
5542
  fontSize: 600,
5537
5543
  fontWeight: 'bold',
5538
5544
  fontStyle: 'normal',
5539
- lineHeight: '4xl',
5545
+ lineHeight: 700,
5540
5546
  fontFamily: 'text',
5541
5547
  accessibilityProps: isPlatformWeb ? {} : {
5542
5548
  role: 'heading'
@@ -5547,15 +5553,19 @@ var getProps$3 = function getProps(_ref) {
5547
5553
 
5548
5554
  if (size === 'small') {
5549
5555
  props.fontSize = 600;
5550
- props.lineHeight = '4xl';
5556
+ props.lineHeight = 500;
5551
5557
  props.as = isPlatformWeb ? 'h3' : undefined;
5552
5558
  } else if (size === 'medium') {
5553
5559
  props.fontSize = 700;
5554
- props.lineHeight = '4xl';
5560
+ props.lineHeight = 600;
5555
5561
  props.as = isPlatformWeb ? 'h2' : undefined;
5556
5562
  } else if (size === 'large') {
5563
+ props.fontSize = 800;
5564
+ props.lineHeight = 700;
5565
+ props.as = isPlatformWeb ? 'h1' : undefined;
5566
+ } else if (size === 'xlarge') {
5557
5567
  props.fontSize = 1000;
5558
- props.lineHeight = '6xl';
5568
+ props.lineHeight = 800;
5559
5569
  props.as = isPlatformWeb ? 'h1' : undefined;
5560
5570
  }
5561
5571
 
@@ -5604,7 +5614,7 @@ var getProps$2 = function getProps(_ref) {
5604
5614
  fontSize: 200,
5605
5615
  fontWeight: weight !== null && weight !== void 0 ? weight : 'bold',
5606
5616
  fontStyle: 'normal',
5607
- lineHeight: 'xl',
5617
+ lineHeight: 300,
5608
5618
  fontFamily: 'text',
5609
5619
  accessibilityProps: isPlatformWeb ? {} : {
5610
5620
  role: 'heading'
@@ -5616,15 +5626,15 @@ var getProps$2 = function getProps(_ref) {
5616
5626
  if (variant === 'regular') {
5617
5627
  if (!size || size === 'small') {
5618
5628
  props.fontSize = 200;
5619
- props.lineHeight = '2xl';
5629
+ props.lineHeight = 300;
5620
5630
  props.as = isPlatformWeb ? 'h6' : undefined;
5621
5631
  } else if (size === 'medium') {
5622
5632
  props.fontSize = 300;
5623
- props.lineHeight = '3xl';
5633
+ props.lineHeight = 200;
5624
5634
  props.as = isPlatformWeb ? 'h5' : undefined;
5625
5635
  } else if (size === 'large') {
5626
5636
  props.fontSize = 400;
5627
- props.lineHeight = '3xl';
5637
+ props.lineHeight = 400;
5628
5638
  props.as = isPlatformWeb ? 'h4' : undefined;
5629
5639
  }
5630
5640
  } else if (variant === 'subheading') {
@@ -5637,7 +5647,7 @@ var getProps$2 = function getProps(_ref) {
5637
5647
  }
5638
5648
 
5639
5649
  props.fontSize = 75;
5640
- props.lineHeight = 's';
5650
+ props.lineHeight = 50;
5641
5651
  props.as = isPlatformWeb ? 'h6' : undefined;
5642
5652
  }
5643
5653
 
@@ -5692,7 +5702,7 @@ var getTextProps = function getTextProps(_ref) {
5692
5702
  fontSize: 100,
5693
5703
  fontWeight: weight !== null && weight !== void 0 ? weight : 'regular',
5694
5704
  fontStyle: 'normal',
5695
- lineHeight: 'l',
5705
+ lineHeight: 100,
5696
5706
  fontFamily: 'text',
5697
5707
  forwardedAs: isPlatformWeb ? 'p' : undefined,
5698
5708
  componentName: 'text',
@@ -5701,26 +5711,35 @@ var getTextProps = function getTextProps(_ref) {
5701
5711
  };
5702
5712
 
5703
5713
  if (variant === 'body') {
5714
+ if (size === 'xsmall') {
5715
+ props.fontSize = 25;
5716
+ props.lineHeight = 50;
5717
+ }
5718
+
5704
5719
  if (size === 'small') {
5705
5720
  props.fontSize = 75;
5706
- props.lineHeight = 's';
5721
+ props.lineHeight = 50;
5707
5722
  }
5708
5723
 
5709
- if (size === 'xsmall') {
5710
- props.fontSize = 25;
5711
- props.lineHeight = 's';
5724
+ if (size === 'medium') {
5725
+ props.fontSize = 100;
5726
+ props.lineHeight = 100;
5712
5727
  }
5713
- } else if (variant === 'caption') {
5714
- if (size === 'xsmall') {
5715
- throw new Error("[Blade: Text]: size cannot be 'xsmall' when variant is 'caption'");
5728
+
5729
+ if (size === 'large') {
5730
+ props.fontSize = 200;
5731
+ props.lineHeight = 300;
5716
5732
  }
5733
+ }
5717
5734
 
5718
- if (size === 'small') {
5719
- throw new Error("[Blade: Text]: size cannot be 'small' when variant is 'caption'");
5735
+ if (variant === 'caption') {
5736
+ if (size === 'medium') {
5737
+ props.fontSize = 50;
5738
+ props.lineHeight = 50;
5739
+ } else {
5740
+ throw new Error("[Blade: Text]: size cannot be '".concat(size, "' when variant is 'caption'"));
5720
5741
  }
5721
5742
 
5722
- props.fontSize = 50;
5723
- props.lineHeight = 's';
5724
5743
  props.fontStyle = 'italic';
5725
5744
  }
5726
5745
 
@@ -5787,7 +5806,7 @@ var Text = function Text(_ref3) {
5787
5806
  }));
5788
5807
  };
5789
5808
 
5790
- var _excluded$4H = ["children", "size", "testID"];
5809
+ var _excluded$4H = ["children", "size", "weight", "testID"];
5791
5810
 
5792
5811
  function ownKeys$55(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5793
5812
 
@@ -5795,13 +5814,22 @@ function _objectSpread$55(target) { for (var i = 1; i < arguments.length; i++) {
5795
5814
  var platformType = getPlatformType();
5796
5815
  var isPlatformWeb = platformType === 'browser' || platformType === 'node';
5797
5816
 
5798
- var getCodeFontSize = function getCodeFontSize(size) {
5817
+ var getCodeFontSizeAndLineHeight = function getCodeFontSizeAndLineHeight(size) {
5799
5818
  switch (size) {
5800
5819
  case 'medium':
5801
- return 100;
5820
+ return {
5821
+ fontSize: 75,
5822
+ lineHeight: 75
5823
+ };
5824
+
5825
+ case 'small':
5826
+ return {
5827
+ fontSize: 25,
5828
+ lineHeight: 25
5829
+ };
5802
5830
 
5803
5831
  default:
5804
- return 75;
5832
+ throw new Error("[Blade Code]: Unexpected size: ".concat(size));
5805
5833
  }
5806
5834
  };
5807
5835
 
@@ -5815,9 +5843,8 @@ var CodeContainer = /*#__PURE__*/styled(BaseBox).withConfig({
5815
5843
  backgroundColor: props.theme.colors.brand.gray.a50.lowContrast,
5816
5844
  borderRadius: props.theme.border.radius.medium,
5817
5845
  display: isPlatformWeb ? 'inline-block' : undefined,
5818
- // Removing the line height of container to remove extra surrounding space in background
5819
- // The text itself will still have the normal lineHeight
5820
- lineHeight: makeTypographySize(props.theme.typography.lineHeights.s)
5846
+ verticalAlign: 'middle',
5847
+ lineHeight: makeTypographySize(props.theme.typography.lineHeights[0])
5821
5848
  };
5822
5849
  });
5823
5850
  /**
@@ -5851,9 +5878,15 @@ var Code = function Code(_ref) {
5851
5878
  var children = _ref.children,
5852
5879
  _ref$size = _ref.size,
5853
5880
  size = _ref$size === void 0 ? 'small' : _ref$size,
5881
+ _ref$weight = _ref.weight,
5882
+ weight = _ref$weight === void 0 ? 'regular' : _ref$weight,
5854
5883
  testID = _ref.testID,
5855
5884
  styledProps = _objectWithoutProperties(_ref, _excluded$4H);
5856
5885
 
5886
+ var _getCodeFontSizeAndLi = getCodeFontSizeAndLineHeight(size),
5887
+ fontSize = _getCodeFontSizeAndLi.fontSize,
5888
+ lineHeight = _getCodeFontSizeAndLi.lineHeight;
5889
+
5857
5890
  return /*#__PURE__*/jsx(CodeContainer, _objectSpread$55(_objectSpread$55(_objectSpread$55({
5858
5891
  size: size,
5859
5892
  as: isPlatformWeb ? 'span' : undefined
@@ -5864,8 +5897,10 @@ var Code = function Code(_ref) {
5864
5897
  children: /*#__PURE__*/jsx(BaseText, {
5865
5898
  color: "surface.text.subtle.lowContrast",
5866
5899
  fontFamily: "code",
5867
- fontSize: getCodeFontSize(size),
5900
+ fontSize: fontSize,
5901
+ fontWeight: weight,
5868
5902
  as: isPlatformWeb ? 'code' : undefined,
5903
+ lineHeight: lineHeight,
5869
5904
  children: children
5870
5905
  })
5871
5906
  }));
@@ -16629,7 +16664,7 @@ var HintText = function HintText(_ref) {
16629
16664
  as: isReactNative ? undefined : 'span',
16630
16665
  color: color,
16631
16666
  fontSize: 50,
16632
- lineHeight: "s",
16667
+ lineHeight: 50,
16633
16668
  fontStyle: "italic",
16634
16669
  fontFamily: "text",
16635
16670
  children: children
@@ -16771,7 +16806,7 @@ var FormLabel = function FormLabel(_ref) {
16771
16806
 
16772
16807
  if (necessityIndicator === 'required') {
16773
16808
  necessityLabel = /*#__PURE__*/jsx(BaseText, {
16774
- lineHeight: "s",
16809
+ lineHeight: 100,
16775
16810
  fontFamily: "text",
16776
16811
  fontStyle: "normal",
16777
16812
  fontSize: 75,
@@ -16866,8 +16901,8 @@ var SelectorTitle = function SelectorTitle(_ref) {
16866
16901
  _ref$size = _ref.size,
16867
16902
  size = _ref$size === void 0 ? 'medium' : _ref$size;
16868
16903
  var lineHeight = {
16869
- small: 's',
16870
- medium: 'l'
16904
+ small: 50,
16905
+ medium: 100
16871
16906
  };
16872
16907
  var fontSize = {
16873
16908
  small: 75,
@@ -16896,7 +16931,7 @@ var SelectorSupportText = function SelectorSupportText(_ref) {
16896
16931
  as: isReactNative ? undefined : 'span',
16897
16932
  color: "surface.text.muted.lowContrast",
16898
16933
  fontSize: 50,
16899
- lineHeight: "s",
16934
+ lineHeight: 50,
16900
16935
  fontStyle: "italic",
16901
16936
  fontFamily: "text",
16902
16937
  children: children
@@ -18152,10 +18187,10 @@ var typography = {
18152
18187
  }
18153
18188
  },
18154
18189
  lineHeights: {
18155
- xsmall: 's',
18156
- small: 's',
18157
- medium: 'l',
18158
- large: 'm'
18190
+ xsmall: 50,
18191
+ small: 50,
18192
+ medium: 100,
18193
+ large: 300
18159
18194
  }
18160
18195
  };
18161
18196
  var minHeight = {
@@ -18949,6 +18984,18 @@ var getProps = function getProps(_ref2) {
18949
18984
  target = _ref2.target,
18950
18985
  size = _ref2.size;
18951
18986
  var isButton = variant === 'button';
18987
+ var textSizes = {
18988
+ fontSize: {
18989
+ small: 75,
18990
+ medium: 100,
18991
+ large: 200
18992
+ },
18993
+ lineHeight: {
18994
+ small: 50,
18995
+ medium: 100,
18996
+ large: 300
18997
+ }
18998
+ };
18952
18999
  var props = {
18953
19000
  as: isButton ? 'button' : 'a',
18954
19001
  textDecorationLine: !isButton && currentInteraction !== 'default' ? 'underline' : 'none',
@@ -18961,8 +19008,8 @@ var getProps = function getProps(_ref2) {
18961
19008
  isDisabled: isDisabled,
18962
19009
  isVisited: isVisited
18963
19010
  }),
18964
- fontSize: size === 'medium' ? 100 : 75,
18965
- lineHeight: size === 'medium' ? 'l' : 's',
19011
+ fontSize: textSizes.fontSize[size],
19012
+ lineHeight: textSizes.lineHeight[size],
18966
19013
  iconSize: size,
18967
19014
  iconPadding: children !== null && children !== void 0 && children.trim() ? 'spacing.2' : 'spacing.0',
18968
19015
  textColor: getColorToken({
@@ -21186,7 +21233,8 @@ var getBaseInputStyles = function getBaseInputStyles(_ref2) {
21186
21233
  interactionElement = _ref2.interactionElement,
21187
21234
  suffix = _ref2.suffix,
21188
21235
  trailingIcon = _ref2.trailingIcon,
21189
- textAlign = _ref2.textAlign;
21236
+ textAlign = _ref2.textAlign,
21237
+ isTextArea = _ref2.isTextArea;
21190
21238
 
21191
21239
  var _getInputVisualsToBeR = getInputVisualsToBeRendered({
21192
21240
  leadingIcon: leadingIcon,
@@ -21218,7 +21266,8 @@ var getBaseInputStyles = function getBaseInputStyles(_ref2) {
21218
21266
  paddingLeft: hasLeadingIcon || hasPrefix ? makeSpace(theme.spacing[3]) : makeSpace(theme.spacing[4]),
21219
21267
  paddingRight: hasInteractionElement || hasSuffix || hasTrailingIcon ? makeSpace(theme.spacing[3]) : makeSpace(theme.spacing[4]),
21220
21268
  textAlign: textAlign,
21221
- width: '100%'
21269
+ width: '100%',
21270
+ height: isTextArea ? undefined : makeSpace(size[36])
21222
21271
  }, isReactNative ? {} : {
21223
21272
  resize: 'none'
21224
21273
  });
@@ -21240,7 +21289,8 @@ var getWebInputStyles = function getWebInputStyles(props) {
21240
21289
  interactionElement: props.interactionElement,
21241
21290
  suffix: props.suffix,
21242
21291
  trailingIcon: props.trailingIcon,
21243
- textAlign: props.textAlign
21292
+ textAlign: props.textAlign,
21293
+ isTextArea: props.isTextArea
21244
21294
  })), {}, {
21245
21295
  outline: 'none',
21246
21296
  border: 'none',
@@ -23148,14 +23198,16 @@ var listItemBulletMarginRight = {
23148
23198
  };
23149
23199
  var listItemBulletMarginTop = {
23150
23200
  // We need hard-coded non-tokenized spacing for bullet alignment in List
23201
+ // These size mappings can be found in here:
23202
+ // figma.com/file/jubmQL9Z8V7881ayUD95ps/Blade---Payment-Light?node-id=23239-466987&t=easqqrPtzgMwCEtn-0
23151
23203
  unordered: {
23152
23204
  onDesktop: {
23153
23205
  small: makeSize(6),
23154
- medium: 'spacing.3'
23206
+ medium: makeSize(7)
23155
23207
  },
23156
23208
  onMobile: {
23157
23209
  small: makeSize(6),
23158
- medium: makeSize(10)
23210
+ medium: makeSize(7)
23159
23211
  }
23160
23212
  },
23161
23213
  unorderedWithIcon: {
@@ -23165,7 +23217,7 @@ var listItemBulletMarginTop = {
23165
23217
  },
23166
23218
  onMobile: {
23167
23219
  small: 'spacing.2',
23168
- medium: makeSize(6)
23220
+ medium: 'spacing.1'
23169
23221
  }
23170
23222
  },
23171
23223
  ordered: {
@@ -23186,7 +23238,7 @@ var listItemBulletMarginTop = {
23186
23238
  },
23187
23239
  onMobile: {
23188
23240
  small: makeSize(0),
23189
- medium: 'spacing.1'
23241
+ medium: makeSize(0)
23190
23242
  }
23191
23243
  }
23192
23244
  };
@@ -24790,6 +24842,18 @@ var amountFontSizes = {
24790
24842
  'title-small': 600,
24791
24843
  'title-medium': 700
24792
24844
  };
24845
+ var amountLineHeights = {
24846
+ 'body-small': 50,
24847
+ 'body-small-bold': 50,
24848
+ 'body-medium': 100,
24849
+ 'body-medium-bold': 100,
24850
+ 'heading-small': 300,
24851
+ 'heading-small-bold': 300,
24852
+ 'heading-large': 400,
24853
+ 'heading-large-bold': 400,
24854
+ 'title-small': 500,
24855
+ 'title-medium': 600
24856
+ };
24793
24857
  var currencyPrefixMapping = {
24794
24858
  INR: {
24795
24859
  'currency-symbol': '₹',
@@ -24866,6 +24930,7 @@ var AmountValue = function AmountValue(_ref2) {
24866
24930
  children: [/*#__PURE__*/jsxs(BaseText, {
24867
24931
  fontSize: amountFontSizes[size],
24868
24932
  fontWeight: valueForWeight,
24933
+ lineHeight: amountLineHeights[size],
24869
24934
  color: amountValueColor,
24870
24935
  as: isReactNative ? undefined : 'span',
24871
24936
  children: [integer, "."]