@razorpay/blade 8.6.0 → 8.7.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.
@@ -3944,6 +3944,7 @@ var getBaseActionListStyles = function getBaseActionListStyles(props) {
3944
3944
  backgroundColor: backgroundColor,
3945
3945
  borderWidth: isInBottomSheet ? undefined : theme.border.width.thin,
3946
3946
  borderColor: theme.colors.surface.border.normal.lowContrast,
3947
+ borderStyle: isInBottomSheet ? undefined : 'solid',
3947
3948
  borderRadius: makeSize(theme.border.radius.medium),
3948
3949
  boxShadow: isInBottomSheet || isReactNative$4() ? undefined : castWebType(theme.elevation.midRaised)
3949
3950
  };
@@ -5863,7 +5864,7 @@ var BaseText = function BaseText(_ref2) {
5863
5864
  }));
5864
5865
  };
5865
5866
 
5866
- var _excluded$4N = ["size", "type", "contrast", "children", "testID"];
5867
+ var _excluded$4N = ["size", "type", "contrast", "color", "children", "testID"];
5867
5868
 
5868
5869
  function ownKeys$5m(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; }
5869
5870
 
@@ -5873,11 +5874,12 @@ var getProps$3 = function getProps(_ref) {
5873
5874
  var size = _ref.size,
5874
5875
  type = _ref.type,
5875
5876
  contrast = _ref.contrast,
5877
+ color = _ref.color,
5876
5878
  testID = _ref.testID;
5877
5879
  var isPlatformWeb = getPlatformType() === 'browser' || getPlatformType() === 'node';
5878
5880
  var colorContrast = contrast ? "".concat(contrast, "Contrast") : 'lowContrast';
5879
5881
  var props = {
5880
- color: "surface.text.".concat(type !== null && type !== void 0 ? type : 'normal', ".").concat(colorContrast),
5882
+ color: color !== null && color !== void 0 ? color : "surface.text.".concat(type !== null && type !== void 0 ? type : 'normal', ".").concat(colorContrast),
5881
5883
  fontSize: 600,
5882
5884
  fontWeight: 'bold',
5883
5885
  fontStyle: 'normal',
@@ -5918,6 +5920,7 @@ var Title = function Title(_ref2) {
5918
5920
  type = _ref2$type === void 0 ? 'normal' : _ref2$type,
5919
5921
  _ref2$contrast = _ref2.contrast,
5920
5922
  contrast = _ref2$contrast === void 0 ? 'low' : _ref2$contrast,
5923
+ color = _ref2.color,
5921
5924
  children = _ref2.children,
5922
5925
  testID = _ref2.testID,
5923
5926
  styledProps = _objectWithoutProperties$1(_ref2, _excluded$4N);
@@ -5926,6 +5929,7 @@ var Title = function Title(_ref2) {
5926
5929
  size: size,
5927
5930
  type: type,
5928
5931
  contrast: contrast,
5932
+ color: color,
5929
5933
  testID: testID
5930
5934
  });
5931
5935
  return /*#__PURE__*/jsx(BaseText, _objectSpread$5l(_objectSpread$5l(_objectSpread$5l({}, props), getStyledProps(styledProps)), {}, {
@@ -5933,7 +5937,7 @@ var Title = function Title(_ref2) {
5933
5937
  }));
5934
5938
  };
5935
5939
 
5936
- var _excluded$4M = ["variant", "size", "type", "weight", "contrast", "children", "testID", "textAlign"];
5940
+ var _excluded$4M = ["variant", "size", "type", "weight", "contrast", "color", "children", "testID", "textAlign"];
5937
5941
 
5938
5942
  function ownKeys$5l(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; }
5939
5943
 
@@ -5945,11 +5949,12 @@ var getProps$2 = function getProps(_ref) {
5945
5949
  type = _ref.type,
5946
5950
  weight = _ref.weight,
5947
5951
  contrast = _ref.contrast,
5952
+ color = _ref.color,
5948
5953
  testID = _ref.testID;
5949
5954
  var isPlatformWeb = getPlatformType() === 'browser' || getPlatformType() === 'node';
5950
5955
  var colorContrast = contrast ? "".concat(contrast, "Contrast") : 'lowContrast';
5951
5956
  var props = {
5952
- color: "surface.text.".concat(type !== null && type !== void 0 ? type : 'normal', ".").concat(colorContrast),
5957
+ color: color !== null && color !== void 0 ? color : "surface.text.".concat(type !== null && type !== void 0 ? type : 'normal', ".").concat(colorContrast),
5953
5958
  fontSize: 200,
5954
5959
  fontWeight: weight !== null && weight !== void 0 ? weight : 'bold',
5955
5960
  fontStyle: 'normal',
@@ -6003,6 +6008,7 @@ var Heading = function Heading(_ref2) {
6003
6008
  weight = _ref2$weight === void 0 ? 'bold' : _ref2$weight,
6004
6009
  _ref2$contrast = _ref2.contrast,
6005
6010
  contrast = _ref2$contrast === void 0 ? 'low' : _ref2$contrast,
6011
+ color = _ref2.color,
6006
6012
  children = _ref2.children,
6007
6013
  testID = _ref2.testID,
6008
6014
  textAlign = _ref2.textAlign,
@@ -6013,6 +6019,7 @@ var Heading = function Heading(_ref2) {
6013
6019
  size: size,
6014
6020
  type: type,
6015
6021
  weight: weight,
6022
+ color: color,
6016
6023
  contrast: contrast,
6017
6024
  testID: testID
6018
6025
  });
@@ -6034,13 +6041,14 @@ var getTextProps = function getTextProps(_ref) {
6034
6041
  type = _ref.type,
6035
6042
  weight = _ref.weight,
6036
6043
  size = _ref.size,
6044
+ color = _ref.color,
6037
6045
  contrast = _ref.contrast,
6038
6046
  testID = _ref.testID,
6039
6047
  textAlign = _ref.textAlign;
6040
6048
  var isPlatformWeb = getPlatformType() === 'browser' || getPlatformType() === 'node';
6041
6049
  var colorContrast = contrast ? "".concat(contrast, "Contrast") : 'lowContrast';
6042
6050
  var props = {
6043
- color: "surface.text.".concat(type !== null && type !== void 0 ? type : 'normal', ".").concat(colorContrast),
6051
+ color: color !== null && color !== void 0 ? color : "surface.text.".concat(type !== null && type !== void 0 ? type : 'normal', ".").concat(colorContrast),
6044
6052
  fontSize: 100,
6045
6053
  fontWeight: weight !== null && weight !== void 0 ? weight : 'regular',
6046
6054
  fontStyle: 'normal',
@@ -6129,19 +6137,18 @@ var _Text = function _Text(_ref3) {
6129
6137
  textAlign = _ref3.textAlign,
6130
6138
  styledProps = _objectWithoutProperties$1(_ref3, _excluded$4L);
6131
6139
 
6132
- var props = _objectSpread$5j(_objectSpread$5j({
6140
+ var props = _objectSpread$5j({
6133
6141
  truncateAfterLines: truncateAfterLines
6134
6142
  }, getTextProps({
6135
6143
  variant: variant,
6136
6144
  type: type,
6137
6145
  weight: weight,
6146
+ color: color,
6138
6147
  size: size,
6139
6148
  contrast: contrast,
6140
6149
  testID: testID,
6141
6150
  textAlign: textAlign
6142
- })), color ? {
6143
- color: color
6144
- } : {});
6151
+ }));
6145
6152
 
6146
6153
  return /*#__PURE__*/jsx(StyledText, _objectSpread$5j(_objectSpread$5j(_objectSpread$5j({}, props), getStyledProps(styledProps)), {}, {
6147
6154
  children: children
@@ -6153,7 +6160,7 @@ var Text = /*#__PURE__*/assignWithoutSideEffects(_Text, {
6153
6160
  componentId: 'Text'
6154
6161
  });
6155
6162
 
6156
- var _excluded$4K = ["children", "size", "weight", "testID"];
6163
+ var _excluded$4K = ["children", "size", "weight", "isHighlighted", "color", "testID"];
6157
6164
 
6158
6165
  function ownKeys$5j(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; }
6159
6166
 
@@ -6187,7 +6194,7 @@ var CodeContainer = /*#__PURE__*/styled(BaseBox).withConfig({
6187
6194
  var padding = "".concat(makeSpace(props.theme.spacing[0]), " ").concat(makeSpace(props.theme.spacing[2]));
6188
6195
  return {
6189
6196
  padding: padding,
6190
- backgroundColor: props.theme.colors.brand.gray.a50.lowContrast,
6197
+ backgroundColor: props.isHighlighted ? props.theme.colors.brand.gray.a100.lowContrast : undefined,
6191
6198
  borderRadius: props.theme.border.radius.medium,
6192
6199
  display: isPlatformWeb ? 'inline-block' : 'flex',
6193
6200
  alignSelf: isPlatformWeb ? undefined : 'center',
@@ -6195,6 +6202,25 @@ var CodeContainer = /*#__PURE__*/styled(BaseBox).withConfig({
6195
6202
  lineHeight: makeTypographySize(props.theme.typography.lineHeights[0])
6196
6203
  };
6197
6204
  });
6205
+
6206
+ var getCodeColor = function getCodeColor(_ref) {
6207
+ var isHighlighted = _ref.isHighlighted,
6208
+ color = _ref.color;
6209
+
6210
+ if (isHighlighted) {
6211
+ if (color) {
6212
+ throw new Error('[Blade: Code]: `color` prop cannot be used without `isHighlighted={false}`');
6213
+ }
6214
+
6215
+ return 'surface.text.subtle.lowContrast';
6216
+ }
6217
+
6218
+ if (color) {
6219
+ return color;
6220
+ }
6221
+
6222
+ return 'surface.text.normal.lowContrast';
6223
+ };
6198
6224
  /**
6199
6225
  * Code component can be used for displaying token, variable names, or inlined code snippets.
6200
6226
  *
@@ -6214,36 +6240,47 @@ var CodeContainer = /*#__PURE__*/styled(BaseBox).withConfig({
6214
6240
  * In React Native, you would have to align it using flex to make sure the Code and the surrounding text is correctly aligned
6215
6241
  *
6216
6242
  * ```tsx
6217
- * <BaseBox flexWrap="wrap" flexDirection="row" alignItems="flex-start">
6243
+ * <Box flexWrap="wrap" flexDirection="row" alignItems="flex-start">
6218
6244
  * <Text>Lorem ipsum </Text>
6219
6245
  * <Code>SENTRY_TOKEN</Code>
6220
6246
  * <Text> normal text</Text>
6221
- * </BaseBox>
6247
+ * </Box>
6222
6248
  * ```
6223
6249
  */
6224
6250
 
6225
- var Code = function Code(_ref) {
6226
- var children = _ref.children,
6227
- _ref$size = _ref.size,
6228
- size = _ref$size === void 0 ? 'small' : _ref$size,
6229
- _ref$weight = _ref.weight,
6230
- weight = _ref$weight === void 0 ? 'regular' : _ref$weight,
6231
- testID = _ref.testID,
6232
- styledProps = _objectWithoutProperties$1(_ref, _excluded$4K);
6251
+
6252
+ var Code = function Code(_ref2) {
6253
+ var children = _ref2.children,
6254
+ _ref2$size = _ref2.size,
6255
+ size = _ref2$size === void 0 ? 'small' : _ref2$size,
6256
+ _ref2$weight = _ref2.weight,
6257
+ weight = _ref2$weight === void 0 ? 'regular' : _ref2$weight,
6258
+ _ref2$isHighlighted = _ref2.isHighlighted,
6259
+ isHighlighted = _ref2$isHighlighted === void 0 ? true : _ref2$isHighlighted,
6260
+ color = _ref2.color,
6261
+ testID = _ref2.testID,
6262
+ styledProps = _objectWithoutProperties$1(_ref2, _excluded$4K);
6233
6263
 
6234
6264
  var _getCodeFontSizeAndLi = getCodeFontSizeAndLineHeight(size),
6235
6265
  fontSize = _getCodeFontSizeAndLi.fontSize,
6236
6266
  lineHeight = _getCodeFontSizeAndLi.lineHeight;
6237
6267
 
6268
+ var codeTextColor = React__default.useMemo(function () {
6269
+ return getCodeColor({
6270
+ isHighlighted: isHighlighted,
6271
+ color: color
6272
+ });
6273
+ }, [isHighlighted, color]);
6238
6274
  return /*#__PURE__*/jsx(CodeContainer, _objectSpread$5i(_objectSpread$5i(_objectSpread$5i({
6239
6275
  size: size,
6276
+ isHighlighted: isHighlighted,
6240
6277
  as: isPlatformWeb ? 'span' : undefined
6241
6278
  }, metaAttribute({
6242
6279
  name: MetaConstants.Code,
6243
6280
  testID: testID
6244
6281
  })), getStyledProps(styledProps)), {}, {
6245
6282
  children: /*#__PURE__*/jsx(BaseText, {
6246
- color: "surface.text.subtle.lowContrast",
6283
+ color: codeTextColor,
6247
6284
  fontFamily: "code",
6248
6285
  fontSize: fontSize,
6249
6286
  fontWeight: weight,