@razorpay/blade 10.17.2 → 10.17.3

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.
@@ -404,7 +404,7 @@ var getActionListItemRole = function getActionListItemRole(dropdownTriggerer, hr
404
404
  return 'option';
405
405
  };
406
406
 
407
- var componentIds = {
407
+ var componentIds$1 = {
408
408
  ActionList: 'ActionList',
409
409
  ActionListItem: 'ActionListItem',
410
410
  ActionListItemBadge: 'ActionListItemBadge',
@@ -455,10 +455,10 @@ var getActionListSectionPosition = function getActionListSectionPosition(childre
455
455
  });
456
456
 
457
457
  // Reading the last `ActionListSection` component's index
458
- var lastActionListSectionIndex = childComponentIdArray.lastIndexOf(componentIds.ActionListSection);
458
+ var lastActionListSectionIndex = childComponentIdArray.lastIndexOf(componentIds$1.ActionListSection);
459
459
 
460
460
  // Checking if there is any `ActionListItem` present after `ActionListSection`
461
- var isActionListItemPresentAfterSection = childComponentIdArray.slice(lastActionListSectionIndex).includes(componentIds.ActionListItem);
461
+ var isActionListItemPresentAfterSection = childComponentIdArray.slice(lastActionListSectionIndex).includes(componentIds$1.ActionListItem);
462
462
  return {
463
463
  isActionListItemPresentAfterSection: isActionListItemPresentAfterSection,
464
464
  lastActionListSectionIndex: lastActionListSectionIndex
@@ -535,7 +535,7 @@ var getActionListProperties = function getActionListProperties(children) {
535
535
  // Looping through ActionListItems to add index to them and get an options array for moving focus between items
536
536
  var childrenWithId = React__default.Children.map(children, function (child, index) {
537
537
  if ( /*#__PURE__*/React__default.isValidElement(child)) {
538
- if (isValidAllowedChildren(child, componentIds.ActionListSection)) {
538
+ if (isValidAllowedChildren(child, componentIds$1.ActionListSection)) {
539
539
  var shouldHideDivider = index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;
540
540
  var sectionChildValues = [];
541
541
  return /*#__PURE__*/React__default.cloneElement(child, {
@@ -543,7 +543,7 @@ var getActionListProperties = function getActionListProperties(children) {
543
543
  children: React__default.Children.map(child.props.children, function (childInSection) {
544
544
  currentSection = child.props.title;
545
545
  sectionChildValues.push(childInSection.props.value);
546
- if (isValidAllowedChildren(childInSection, componentIds.ActionListItem)) {
546
+ if (isValidAllowedChildren(childInSection, componentIds$1.ActionListItem)) {
547
547
  return getActionListItemWithId(childInSection, shouldHideDivider);
548
548
  }
549
549
  return childInSection;
@@ -553,7 +553,7 @@ var getActionListProperties = function getActionListProperties(children) {
553
553
  _sectionChildValues: sectionChildValues
554
554
  });
555
555
  }
556
- if (isValidAllowedChildren(child, componentIds.ActionListItem)) {
556
+ if (isValidAllowedChildren(child, componentIds$1.ActionListItem)) {
557
557
  return getActionListItemWithId(child, true);
558
558
  }
559
559
  }
@@ -14133,8 +14133,8 @@ var _ActionList = function _ActionList(_ref) {
14133
14133
  *
14134
14134
  */
14135
14135
  var ActionList = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.memo(_ActionList), {
14136
- displayName: componentIds.ActionList,
14137
- componentId: componentIds.ActionList
14136
+ displayName: componentIds$1.ActionList,
14137
+ componentId: componentIds$1.ActionList
14138
14138
  });
14139
14139
 
14140
14140
  var getBaseActionListItemStyles = function getBaseActionListItemStyles(props) {
@@ -15716,7 +15716,7 @@ var _ActionListSection = function _ActionListSection(_ref) {
15716
15716
  }));
15717
15717
  };
15718
15718
  var ActionListSection = /*#__PURE__*/assignWithoutSideEffects(_ActionListSection, {
15719
- componentId: componentIds.ActionListSection
15719
+ componentId: componentIds$1.ActionListSection
15720
15720
  });
15721
15721
  var _ActionListItemIcon = function _ActionListItemIcon(_ref2) {
15722
15722
  var icon = _ref2.icon;
@@ -15732,7 +15732,7 @@ var _ActionListItemIcon = function _ActionListItemIcon(_ref2) {
15732
15732
  });
15733
15733
  };
15734
15734
  var ActionListItemIcon = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemIcon, {
15735
- componentId: componentIds.ActionListItemIcon
15735
+ componentId: componentIds$1.ActionListItemIcon
15736
15736
  });
15737
15737
  var _ActionListItemBadgeGroup = function _ActionListItemBadgeGroup(_ref3) {
15738
15738
  var children = _ref3.children;
@@ -15744,7 +15744,7 @@ var _ActionListItemBadgeGroup = function _ActionListItemBadgeGroup(_ref3) {
15744
15744
  });
15745
15745
  };
15746
15746
  var ActionListItemBadgeGroup = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemBadgeGroup, {
15747
- componentId: componentIds.ActionListItemBadgeGroup
15747
+ componentId: componentIds$1.ActionListItemBadgeGroup
15748
15748
  });
15749
15749
  var _ActionListItemBadge = function _ActionListItemBadge(props) {
15750
15750
  return /*#__PURE__*/jsx(Badge, _objectSpread$1v({
@@ -15753,7 +15753,7 @@ var _ActionListItemBadge = function _ActionListItemBadge(props) {
15753
15753
  }, props));
15754
15754
  };
15755
15755
  var ActionListItemBadge = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemBadge, {
15756
- componentId: componentIds.ActionListItemBadge
15756
+ componentId: componentIds$1.ActionListItemBadge
15757
15757
  });
15758
15758
  var _ActionListItemText = function _ActionListItemText(_ref4) {
15759
15759
  var children = _ref4.children;
@@ -15768,7 +15768,7 @@ var _ActionListItemText = function _ActionListItemText(_ref4) {
15768
15768
  });
15769
15769
  };
15770
15770
  var ActionListItemText = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemText, {
15771
- componentId: componentIds.ActionListItemText
15771
+ componentId: componentIds$1.ActionListItemText
15772
15772
  });
15773
15773
  var makeActionListItemClickable = function makeActionListItemClickable(clickHandler) {
15774
15774
  if (isReactNative$4()) {
@@ -15975,8 +15975,8 @@ var _ActionListItem = function _ActionListItem(props) {
15975
15975
  });
15976
15976
  };
15977
15977
  var ActionListItem = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.memo(_ActionListItem), {
15978
- componentId: componentIds.ActionListItem,
15979
- displayName: componentIds.ActionListItem
15978
+ componentId: componentIds$1.ActionListItem,
15979
+ displayName: componentIds$1.ActionListItem
15980
15980
  });
15981
15981
 
15982
15982
  var _ActionListItemAsset = function _ActionListItemAsset(props) {
@@ -15988,7 +15988,7 @@ var _ActionListItemAsset = function _ActionListItemAsset(props) {
15988
15988
  });
15989
15989
  };
15990
15990
  var ActionListItemAsset = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemAsset, {
15991
- componentId: componentIds.ActionListItemAsset
15991
+ componentId: componentIds$1.ActionListItemAsset
15992
15992
  });
15993
15993
 
15994
15994
  var MAX_WIDTH$2 = size[584];
@@ -17435,15 +17435,6 @@ var useVerifyInsideCard = function useVerifyInsideCard(componentName) {
17435
17435
  React__default.useContext(CardContext);
17436
17436
  return true;
17437
17437
  };
17438
-
17439
- /**
17440
- * Verify if the passed childrens are only of allowedComponents list
17441
- */
17442
- var useVerifyAllowedComponents = function useVerifyAllowedComponents(children, componentName, allowedComponents) {
17443
- React__default.Children.forEach(children, function (child) {
17444
- child && allowedComponents.includes(getComponentId(child));
17445
- });
17446
- };
17447
17438
  var CardProvider = function CardProvider(_ref) {
17448
17439
  var children = _ref.children;
17449
17440
  return /*#__PURE__*/jsx(CardContext.Provider, {
@@ -17566,6 +17557,15 @@ var CardRoot = function CardRoot(_ref2) {
17566
17557
  }));
17567
17558
  };
17568
17559
 
17560
+ /**
17561
+ * Verify if the passed childrens are only of allowedComponents list
17562
+ */
17563
+ var useVerifyAllowedChildren = function useVerifyAllowedChildren(props) {
17564
+ props.children;
17565
+ props.componentName;
17566
+ props.allowedComponents;
17567
+ };
17568
+
17569
17569
  var _excluded$y = ["children", "surfaceLevel", "elevation", "testID", "padding", "width", "height", "onClick", "isSelected", "accessibilityLabel", "shouldScaleOnHover", "onHover", "href", "target", "rel", "as"];
17570
17570
  function ownKeys$1n(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; }
17571
17571
  function _objectSpread$1m(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1n(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1n(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -17611,7 +17611,11 @@ var Card = function Card(_ref) {
17611
17611
  _React$useState2 = _slicedToArray(_React$useState, 2),
17612
17612
  isFocused = _React$useState2[0],
17613
17613
  setIsFocused = _React$useState2[1];
17614
- useVerifyAllowedComponents(children, 'Card', [ComponentIds$1.CardHeader, ComponentIds$1.CardBody, ComponentIds$1.CardFooter]);
17614
+ useVerifyAllowedChildren({
17615
+ children: children,
17616
+ componentName: 'Card',
17617
+ allowedComponents: [ComponentIds$1.CardHeader, ComponentIds$1.CardBody, ComponentIds$1.CardFooter]
17618
+ });
17615
17619
  var linkOverlayProps = _objectSpread$1m(_objectSpread$1m(_objectSpread$1m({}, metaAttribute({
17616
17620
  name: CARD_LINK_OVERLAY_ID
17617
17621
  })), makeAccessible({
@@ -18038,7 +18042,11 @@ var _CardHeader = function _CardHeader(_ref2) {
18038
18042
  var children = _ref2.children,
18039
18043
  testID = _ref2.testID;
18040
18044
  useVerifyInsideCard();
18041
- useVerifyAllowedComponents(children, 'CardHeader', [ComponentIds$1.CardHeaderLeading, ComponentIds$1.CardHeaderTrailing]);
18045
+ useVerifyAllowedChildren({
18046
+ children: children,
18047
+ componentName: 'CardHeader',
18048
+ allowedComponents: [ComponentIds$1.CardHeaderLeading, ComponentIds$1.CardHeaderTrailing]
18049
+ });
18042
18050
  return /*#__PURE__*/jsxs(BaseBox, _objectSpread$1h(_objectSpread$1h({
18043
18051
  marginBottom: "spacing.7"
18044
18052
  }, metaAttribute({
@@ -18122,7 +18130,11 @@ var _CardFooter = function _CardFooter(_ref) {
18122
18130
  testID = _ref.testID;
18123
18131
  var isMobile = useIsMobile();
18124
18132
  useVerifyInsideCard();
18125
- useVerifyAllowedComponents(children, 'CardFooter', [ComponentIds$1.CardFooterLeading, ComponentIds$1.CardFooterTrailing]);
18133
+ useVerifyAllowedChildren({
18134
+ children: children,
18135
+ componentName: 'CardFooter',
18136
+ allowedComponents: [ComponentIds$1.CardFooterLeading, ComponentIds$1.CardFooterTrailing]
18137
+ });
18126
18138
  var footerChildrensArray = React__default.Children.toArray(children);
18127
18139
 
18128
18140
  // the reason why we are checking for actions here is, because we want the footerTrailing
@@ -18865,6 +18877,9 @@ var getCarouselItemId = function getCarouselItemId(containerId, index) {
18865
18877
  };
18866
18878
 
18867
18879
  var CAROUSEL_AUTOPLAY_INTERVAL = 6000;
18880
+ var componentIds = {
18881
+ CarouselItem: 'CarouselItem'
18882
+ };
18868
18883
 
18869
18884
  /**
18870
18885
  * Hook to run an effect on dependencies change after the component has *mounted*.
@@ -19083,6 +19098,11 @@ var Carousel = function Carousel(_ref4) {
19083
19098
  var containerRef = React__default.useRef(null);
19084
19099
  var isMobile = platform === 'onMobile';
19085
19100
  var id = useId('carousel');
19101
+ useVerifyAllowedChildren({
19102
+ componentName: 'Carousel',
19103
+ allowedComponents: [componentIds.CarouselItem],
19104
+ children: children
19105
+ });
19086
19106
  var _React$useState9 = React__default.useState(
19087
19107
  // on mobile we do not want to render the overlay
19088
19108
  isMobile ? true : !shouldAddStartEndSpacing),
@@ -19377,7 +19397,7 @@ var StyledCarouselItem = /*#__PURE__*/styled(BaseBox).withConfig({
19377
19397
  marginLeft: shouldHaveStartSpacing ? '100%' : 0
19378
19398
  });
19379
19399
  });
19380
- var CarouselItem = function CarouselItem(_ref2) {
19400
+ var _CarouselItem = function _CarouselItem(_ref2) {
19381
19401
  var children = _ref2.children,
19382
19402
  shouldHaveStartSpacing = _ref2.shouldHaveStartSpacing,
19383
19403
  shouldHaveEndSpacing = _ref2.shouldHaveEndSpacing,
@@ -19411,6 +19431,9 @@ var CarouselItem = function CarouselItem(_ref2) {
19411
19431
  children: children
19412
19432
  }));
19413
19433
  };
19434
+ var CarouselItem = /*#__PURE__*/assignWithoutSideEffects(_CarouselItem, {
19435
+ componentId: componentIds.CarouselItem
19436
+ });
19414
19437
 
19415
19438
  var ChipGroupContext = /*#__PURE__*/React__default.createContext({});
19416
19439
  var ChipGroupProvider = ChipGroupContext.Provider;
@@ -29457,7 +29480,7 @@ var _BottomSheetBody = function _BottomSheetBody(_ref) {
29457
29480
  React__default.useEffect(function () {
29458
29481
  setBottomSheetHasActionList(false);
29459
29482
  React__default.Children.forEach(children, function (child) {
29460
- if (isValidAllowedChildren(child, componentIds.ActionList)) {
29483
+ if (isValidAllowedChildren(child, componentIds$1.ActionList)) {
29461
29484
  setBottomSheetHasActionList(true);
29462
29485
  }
29463
29486
  });