@razorpay/blade 10.15.0 → 10.15.2

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.
@@ -14317,6 +14317,7 @@ var getCheckboxIconWrapperStyles = function getCheckboxIconWrapperStyles(_ref) {
14317
14317
  display: 'flex',
14318
14318
  alignItems: 'center',
14319
14319
  justifyContent: 'center',
14320
+ flexShrink: 0,
14320
14321
  width: makeSpace(checkboxSizes.icon[size].width),
14321
14322
  height: makeSpace(checkboxSizes.icon[size].height),
14322
14323
  borderWidth: makeBorderSize(theme.border.width.thick),
@@ -15197,7 +15198,6 @@ var _Checkbox = function _Checkbox(_ref, ref) {
15197
15198
  flexDirection: "column",
15198
15199
  children: [/*#__PURE__*/jsxs(BaseBox, {
15199
15200
  display: "flex",
15200
- alignItems: "center",
15201
15201
  flexDirection: "row",
15202
15202
  children: [/*#__PURE__*/jsx(SelectorInput, {
15203
15203
  hoverTokens: checkboxHoverTokens,
@@ -15728,14 +15728,6 @@ var _ActionListItemText = function _ActionListItemText(_ref4) {
15728
15728
  var ActionListItemText = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemText, {
15729
15729
  componentId: componentIds.ActionListItemText
15730
15730
  });
15731
- var ActionListCheckboxWrapper = /*#__PURE__*/styled(BaseBox).withConfig({
15732
- displayName: "ActionListItem__ActionListCheckboxWrapper",
15733
- componentId: "m6qdwa-1"
15734
- })(function (_props) {
15735
- return {
15736
- pointerEvents: 'none'
15737
- };
15738
- });
15739
15731
  var makeActionListItemClickable = function makeActionListItemClickable(clickHandler) {
15740
15732
  if (isReactNative$4()) {
15741
15733
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error
@@ -15772,8 +15764,9 @@ var _ActionListItemBody = function _ActionListItemBody(_ref5) {
15772
15764
  children: selectionType === 'multiple' ?
15773
15765
  /*#__PURE__*/
15774
15766
  // Adding aria-hidden because the listbox item in multiselect in itself explains the behaviour so announcing checkbox is unneccesary and just a nice UI tweak for us
15775
- jsx(ActionListCheckboxWrapper, _objectSpread$1q(_objectSpread$1q({
15776
- hasDescription: Boolean(description)
15767
+ jsx(BaseBox, _objectSpread$1q(_objectSpread$1q({
15768
+ pointerEvents: "none",
15769
+ paddingRight: "spacing.2"
15777
15770
  }, makeAccessible({
15778
15771
  hidden: true
15779
15772
  })), {}, {
@@ -15960,15 +15953,15 @@ var MAX_WIDTH$2 = size[584];
15960
15953
  var getCommonStyles = function getCommonStyles(props) {
15961
15954
  var theme = props.theme,
15962
15955
  contrastType = props.contrastType,
15963
- intent = props.intent,
15956
+ color = props.color,
15964
15957
  isFullWidth = props.isFullWidth,
15965
15958
  isDesktop = props.isDesktop;
15966
15959
  var feedbackColors = theme.colors.feedback;
15967
15960
  return {
15968
- background: feedbackColors.background[intent][contrastType],
15961
+ background: feedbackColors.background[color][contrastType],
15969
15962
  padding: isFullWidth ? "".concat(makeSpace(theme.spacing[4]), " ").concat(makeSpace(theme.spacing[5])) : "".concat(makeSpace(theme.spacing[3]), " ").concat(makeSpace(theme.spacing[3]), " ").concat(makeSpace(theme.spacing[4]), " ").concat(makeSpace(theme.spacing[3])),
15970
15963
  borderRadius: makeBorderSize(isFullWidth ? theme.border.radius.none : theme.border.radius.medium),
15971
- borderColor: feedbackColors.border[intent][contrastType],
15964
+ borderColor: feedbackColors.border[color][contrastType],
15972
15965
  borderWidth: makeBorderSize(isFullWidth ? theme.border.width.none : theme.border.width.thin),
15973
15966
  borderStyle: 'solid',
15974
15967
  display: 'flex',
@@ -17227,7 +17220,8 @@ var Alert = function Alert(_ref) {
17227
17220
  var contrastType = "".concat(contrast, "Contrast");
17228
17221
  var iconSize = isFullWidth ? 'large' : 'medium';
17229
17222
  var textSize = isFullWidth ? 'medium' : 'small';
17230
- var Icon = intentIconMap[intent];
17223
+ var alertColor = color !== null && color !== void 0 ? color : intent;
17224
+ var Icon = intentIconMap[alertColor];
17231
17225
  var iconOffset = 'spacing.1';
17232
17226
 
17233
17227
  // certain special cases below needs special care for near perfect alignment
@@ -17252,7 +17246,7 @@ var Alert = function Alert(_ref) {
17252
17246
  marginTop: iconOffset,
17253
17247
  display: "flex",
17254
17248
  children: /*#__PURE__*/jsx(Icon, {
17255
- color: "feedback.icon.".concat(intent, ".").concat(contrastType),
17249
+ color: "feedback.icon.".concat(alertColor, ".").concat(contrastType),
17256
17250
  size: iconSize
17257
17251
  })
17258
17252
  });
@@ -17285,7 +17279,7 @@ var Alert = function Alert(_ref) {
17285
17279
  children: /*#__PURE__*/jsx(BaseButton, {
17286
17280
  size: textSize,
17287
17281
  onClick: actions.primary.onClick,
17288
- color: color || intent,
17282
+ color: alertColor,
17289
17283
  variant: contrast === 'high' ? 'primary' : 'secondary',
17290
17284
  children: actions.primary.text
17291
17285
  })
@@ -17310,7 +17304,7 @@ var Alert = function Alert(_ref) {
17310
17304
  display: isReactNative$3 ? castNativeType('flex') : castWebType('inline-flex'),
17311
17305
  children: /*#__PURE__*/jsx(BaseLink, _objectSpread$1j(_objectSpread$1j({
17312
17306
  size: textSize,
17313
- color: contrast === 'high' ? 'white' : intent
17307
+ color: contrast === 'high' ? 'white' : alertColor
17314
17308
  }, secondaryActionParams), {}, {
17315
17309
  children: actions.secondary.text
17316
17310
  }))
@@ -17346,8 +17340,8 @@ var Alert = function Alert(_ref) {
17346
17340
  }) : null;
17347
17341
  var a11yProps = makeAccessible(_objectSpread$1j({
17348
17342
  // React Native doesn't has status as role
17349
- role: isReactNative$3 || intent === 'negative' || intent === 'notice' ? 'alert' : 'status'
17350
- }, intent === 'notice' && {
17343
+ role: isReactNative$3 || alertColor === 'negative' || alertColor === 'notice' ? 'alert' : 'status'
17344
+ }, alertColor === 'notice' && {
17351
17345
  liveRegion: 'polite'
17352
17346
  }));
17353
17347
  if (!isVisible) {
@@ -17358,7 +17352,7 @@ var Alert = function Alert(_ref) {
17358
17352
  testID: testID
17359
17353
  })), getStyledProps(styledProps)), {}, {
17360
17354
  children: /*#__PURE__*/jsxs(StyledAlert, {
17361
- intent: intent,
17355
+ color: alertColor,
17362
17356
  contrastType: contrastType,
17363
17357
  isFullWidth: isFullWidth,
17364
17358
  isDesktop: isDesktop,
@@ -21316,7 +21310,7 @@ var _StyledBaseInput = function _StyledBaseInput(_ref, ref) {
21316
21310
  }, commonProps), props), accessibilityProps), {}, {
21317
21311
  value: props.value,
21318
21312
  children: /*#__PURE__*/jsx(Text, {
21319
- type: props.value ? 'subtle' : 'placeholder',
21313
+ type: props.value && !isDisabled ? 'subtle' : 'placeholder',
21320
21314
  truncateAfterLines: 1,
21321
21315
  textAlign: props.textAlign,
21322
21316
  children: props.value ? props.value : props.placeholder
@@ -21589,7 +21583,8 @@ var BaseInputTagSlot = function BaseInputTagSlot(_ref3) {
21589
21583
  handleOnInputClick = _ref3.handleOnInputClick,
21590
21584
  isDropdownTrigger = _ref3.isDropdownTrigger,
21591
21585
  visibleTagsCountRef = _ref3.visibleTagsCountRef,
21592
- labelPrefix = _ref3.labelPrefix;
21586
+ labelPrefix = _ref3.labelPrefix,
21587
+ isDisabled = _ref3.isDisabled;
21593
21588
  var hasTags = tags && tags.length > 0;
21594
21589
  var slotRef = React__default.useRef(null);
21595
21590
  var visibleTagsCount = useVisibleTagsCount({
@@ -21658,6 +21653,7 @@ var BaseInputTagSlot = function BaseInputTagSlot(_ref3) {
21658
21653
  setShouldIgnoreBlurAnimation === null || setShouldIgnoreBlurAnimation === void 0 ? void 0 : setShouldIgnoreBlurAnimation(false);
21659
21654
  },
21660
21655
  children: [visibleTags, tags && !showAllTags && invisibleTagsCount ? /*#__PURE__*/jsx(Text, {
21656
+ type: isDisabled ? 'placeholder' : 'normal',
21661
21657
  alignSelf: "center",
21662
21658
  marginY: "spacing.2",
21663
21659
  marginRight: "spacing.4",
@@ -22091,6 +22087,7 @@ var BaseInput = /*#__PURE__*/React__default.forwardRef(function (_ref11, ref) {
22091
22087
  }), /*#__PURE__*/jsx(BaseInputTagSlot, {
22092
22088
  renderAs: as,
22093
22089
  tags: tags,
22090
+ isDisabled: isDisabled,
22094
22091
  showAllTags: showAllTagsWithAnimation,
22095
22092
  setFocusOnInput: function setFocusOnInput() {
22096
22093
  if (ref && !isReactNative && 'current' in ref) {
@@ -23031,22 +23028,32 @@ var _OTPInput = function _OTPInput(_ref, incomingRef) {
23031
23028
  };
23032
23029
  var OTPInput = /*#__PURE__*/React__default.forwardRef(_OTPInput);
23033
23030
 
23031
+ var Chevron = function Chevron(props) {
23032
+ var iconColor = "surface.text.".concat(props.isDisabled ? 'placeholder' : 'normal', ".lowContrast");
23033
+ return /*#__PURE__*/jsxs(Fragment, {
23034
+ children: [/*#__PURE__*/jsx(ChevronDownIcon, {
23035
+ display: props.isOpen ? 'none' : 'flex',
23036
+ size: "medium",
23037
+ color: iconColor
23038
+ }), /*#__PURE__*/jsx(ChevronUpIcon, {
23039
+ display: props.isOpen ? 'flex' : 'none',
23040
+ size: "medium",
23041
+ color: iconColor
23042
+ })]
23043
+ });
23044
+ };
23045
+
23034
23046
  var InputChevronIcon = function InputChevronIcon(props) {
23035
- return /*#__PURE__*/jsxs(BaseBox, {
23047
+ return /*#__PURE__*/jsx(BaseBox, {
23036
23048
  display: "flex",
23037
23049
  height: "100%",
23038
23050
  justifyContent: "center",
23039
23051
  alignItems: "center",
23040
23052
  onClick: props.onClick,
23041
- children: [/*#__PURE__*/jsx(ChevronDownIcon, {
23042
- display: props.isOpen ? 'none' : 'flex',
23043
- color: "surface.text.normal.lowContrast",
23044
- size: "medium"
23045
- }), /*#__PURE__*/jsx(ChevronUpIcon, {
23046
- display: props.isOpen ? 'flex' : 'none',
23047
- color: "surface.text.normal.lowContrast",
23048
- size: "medium"
23049
- })]
23053
+ children: /*#__PURE__*/jsx(Chevron, {
23054
+ isOpen: props.isOpen,
23055
+ isDisabled: props.isDisabled
23056
+ })
23050
23057
  });
23051
23058
  };
23052
23059
 
@@ -23196,6 +23203,7 @@ var AnimatedTagContainer = /*#__PURE__*/styled(BaseBox).withConfig({
23196
23203
  var AnimatedTag = function AnimatedTag(_ref) {
23197
23204
  var children = _ref.children,
23198
23205
  currentTagIndex = _ref.currentTagIndex,
23206
+ isDisabled = _ref.isDisabled,
23199
23207
  activeTagIndex = _ref.activeTagIndex,
23200
23208
  onDismiss = _ref.onDismiss;
23201
23209
  var _React$useState = React__default.useState(true),
@@ -23225,6 +23233,7 @@ var AnimatedTag = function AnimatedTag(_ref) {
23225
23233
  },
23226
23234
  marginRight: "spacing.3",
23227
23235
  marginY: "spacing.2",
23236
+ isDisabled: isDisabled,
23228
23237
  children: children
23229
23238
  })
23230
23239
  });
@@ -23233,6 +23242,7 @@ var AnimatedTag = function AnimatedTag(_ref) {
23233
23242
  var getTagsGroup = function getTagsGroup(_ref) {
23234
23243
  var tags = _ref.tags,
23235
23244
  activeTagIndex = _ref.activeTagIndex,
23245
+ isDisabled = _ref.isDisabled,
23236
23246
  onDismiss = _ref.onDismiss;
23237
23247
  return tags.map(function (tagName, tagIndex) {
23238
23248
  return /*#__PURE__*/jsx(AnimatedTag, {
@@ -23240,6 +23250,7 @@ var getTagsGroup = function getTagsGroup(_ref) {
23240
23250
  onDismiss: onDismiss,
23241
23251
  currentTagIndex: tagIndex,
23242
23252
  tagsLength: tags.length,
23253
+ isDisabled: isDisabled,
23243
23254
  children: tagName
23244
23255
  }, tagName);
23245
23256
  });
@@ -23419,9 +23430,11 @@ var _BaseDropdownInputTrigger = function _BaseDropdownInputTrigger(props, ref) {
23419
23430
  }
23420
23431
  return getTagsGroup({
23421
23432
  tags: selectedIndices.map(function (selectedIndex) {
23422
- return options[selectedIndex].title;
23433
+ var _options$selectedInde;
23434
+ return (_options$selectedInde = options[selectedIndex]) === null || _options$selectedInde === void 0 ? void 0 : _options$selectedInde.title;
23423
23435
  }),
23424
23436
  activeTagIndex: activeTagIndex,
23437
+ isDisabled: props.isDisabled,
23425
23438
  onDismiss: function onDismiss(_ref) {
23426
23439
  var tagIndex = _ref.tagIndex;
23427
23440
  if (isTagDismissedRef.current) {
@@ -23487,7 +23500,13 @@ var _BaseDropdownInputTrigger = function _BaseDropdownInputTrigger(props, ref) {
23487
23500
  autoFocus: props.autoFocus // eslint-disable-line jsx-a11y/no-autofocus
23488
23501
  ,
23489
23502
  value: getValue(),
23490
- onClick: props.onTriggerClick,
23503
+ onClick: function onClick(e) {
23504
+ var _props$onTriggerClick;
23505
+ if (props.isDisabled) {
23506
+ return;
23507
+ }
23508
+ (_props$onTriggerClick = props.onTriggerClick) === null || _props$onTriggerClick === void 0 ? void 0 : _props$onTriggerClick.call(props, e);
23509
+ },
23491
23510
  onFocus: props.onFocus,
23492
23511
  onBlur: function onBlur(_ref2) {
23493
23512
  var _props$onBlur;
@@ -23525,6 +23544,7 @@ var _BaseDropdownInputTrigger = function _BaseDropdownInputTrigger(props, ref) {
23525
23544
  onTriggerClick();
23526
23545
  }
23527
23546
  },
23547
+ isDisabled: props.isDisabled,
23528
23548
  isOpen: isOpen
23529
23549
  })
23530
23550
  });
@@ -23726,7 +23746,10 @@ var useAutoComplete = function useAutoComplete(_ref) {
23726
23746
  name: props.name,
23727
23747
  value: displayText
23728
23748
  });
23729
- setInputValue(displayText !== null && displayText !== void 0 ? displayText : '');
23749
+ // Use displayText as inputValue only if its not controlled by user
23750
+ if (typeof props.value === 'undefined') {
23751
+ setInputValue(displayText !== null && displayText !== void 0 ? displayText : '');
23752
+ }
23730
23753
  }
23731
23754
  (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
23732
23755
  name: props.name,