@razorpay/blade 6.6.2 → 6.6.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.
@@ -5088,7 +5088,7 @@ function _objectSpread$5b(target) { for (var i = 1; i < arguments.length; i++) {
5088
5088
  * ```
5089
5089
  *
5090
5090
  */
5091
- var ActionList = function ActionList(_ref) {
5091
+ var _ActionList = function _ActionList(_ref) {
5092
5092
  var children = _ref.children,
5093
5093
  _ref$surfaceLevel = _ref.surfaceLevel,
5094
5094
  surfaceLevel = _ref$surfaceLevel === void 0 ? 2 : _ref$surfaceLevel,
@@ -5148,6 +5148,8 @@ var ActionList = function ActionList(_ref) {
5148
5148
  }));
5149
5149
  };
5150
5150
 
5151
+ var ActionList = /*#__PURE__*/React__default.memo(_ActionList);
5152
+
5151
5153
  var getBaseActionListItemStyles = function getBaseActionListItemStyles(props) {
5152
5154
  return {
5153
5155
  // @TODO: replace this with outline token when we add
@@ -7162,16 +7164,18 @@ var FileTextIcon = function FileTextIcon(_ref) {
7162
7164
  viewBox: "0 0 24 24",
7163
7165
  fill: "none",
7164
7166
  children: [/*#__PURE__*/jsx(Path, {
7165
- d: "M5 11C4.44772 11 4 11.4477 4 12C4 12.5523 4.44772 13 5 13H13C13.5523 13 14 12.5523 14 12C14 11.4477 13.5523 11 13 11H5Z",
7167
+ d: "M8 12C7.44772 12 7 12.4477 7 13C7 13.5523 7.44772 14 8 14H16C16.5523 14 17 13.5523 17 13C17 12.4477 16.5523 12 16 12H8Z",
7166
7168
  fill: iconColor
7167
7169
  }), /*#__PURE__*/jsx(Path, {
7168
- d: "M4 16C4 15.4477 4.44772 15 5 15H13C13.5523 15 14 15.4477 14 16C14 16.5523 13.5523 17 13 17H5C4.44772 17 4 16.5523 4 16Z",
7170
+ d: "M7 17C7 16.4477 7.44772 16 8 16H16C16.5523 16 17 16.4477 17 17C17 17.5523 16.5523 18 16 18H8C7.44772 18 7 17.5523 7 17Z",
7169
7171
  fill: iconColor
7170
7172
  }), /*#__PURE__*/jsx(Path, {
7171
- d: "M5 7C4.44772 7 4 7.44772 4 8C4 8.55229 4.44772 9 5 9H7C7.55228 9 8 8.55229 8 8C8 7.44772 7.55228 7 7 7H5Z",
7173
+ d: "M8 8C7.44772 8 7 8.44772 7 9C7 9.55229 7.44772 10 8 10H10C10.5523 10 11 9.55229 11 9C11 8.44772 10.5523 8 10 8H8Z",
7172
7174
  fill: iconColor
7173
7175
  }), /*#__PURE__*/jsx(Path, {
7174
- d: "M0 3C0 1.34315 1.34315 0 3 0H11C11.2652 0 11.5196 0.105357 11.7071 0.292893L17.7071 6.29289C17.8946 6.48043 18 6.73478 18 7V19C18 20.6569 16.6569 22 15 22H3C1.34315 22 0 20.6569 0 19V3ZM3 2C2.44772 2 2 2.44772 2 3V19C2 19.5523 2.44772 20 3 20H15C15.5523 20 16 19.5523 16 19V8H11C10.4477 8 10 7.55228 10 7V2H3ZM12 3.41421L14.5858 6H12V3.41421Z",
7176
+ d: "M3 4C3 2.34315 4.34315 1 6 1H14C14.2652 1 14.5196 1.10536 14.7071 1.29289L20.7071 7.29289C20.8946 7.48043 21 7.73478 21 8V20C21 21.6569 19.6569 23 18 23H6C4.34315 23 3 21.6569 3 20V4ZM6 3C5.44772 3 5 3.44772 5 4V20C5 20.5523 5.44772 21 6 21H18C18.5523 21 19 20.5523 19 20V9H14C13.4477 9 13 8.55228 13 8V3H6ZM15 4.41421L17.5858 7H15V4.41421Z",
7177
+ fillRule: "evenodd",
7178
+ clipRule: "evenodd",
7175
7179
  fill: iconColor
7176
7180
  })]
7177
7181
  }));
@@ -17548,6 +17552,68 @@ var makeActionListItemClickable = function makeActionListItemClickable(clickHand
17548
17552
  onClick: clickHandler
17549
17553
  };
17550
17554
  };
17555
+
17556
+ var _ActionListItemBody = function _ActionListItemBody(_ref4) {
17557
+ var selectionType = _ref4.selectionType,
17558
+ intent = _ref4.intent,
17559
+ description = _ref4.description,
17560
+ isDisabled = _ref4.isDisabled,
17561
+ leading = _ref4.leading,
17562
+ trailing = _ref4.trailing,
17563
+ title = _ref4.title,
17564
+ isSelected = _ref4.isSelected;
17565
+ return /*#__PURE__*/jsxs(Fragment, {
17566
+ children: [/*#__PURE__*/jsxs(BaseBox, {
17567
+ display: "flex",
17568
+ justifyContent: "center",
17569
+ flexDirection: "row",
17570
+ alignItems: "center",
17571
+ maxHeight: isReactNative$4() ? undefined : makeSize(size[20]),
17572
+ children: [/*#__PURE__*/jsx(BaseBox, {
17573
+ display: "flex",
17574
+ justifyContent: "center",
17575
+ alignItems: "center",
17576
+ children: selectionType === 'multiple' ?
17577
+ /*#__PURE__*/
17578
+ // 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
17579
+ jsx(ActionListCheckboxWrapper, _objectSpread$H(_objectSpread$H({
17580
+ hasDescription: Boolean(description)
17581
+ }, makeAccessible({
17582
+ hidden: true
17583
+ })), {}, {
17584
+ children: /*#__PURE__*/jsx(Checkbox, {
17585
+ isChecked: isSelected,
17586
+ tabIndex: -1,
17587
+ isDisabled: isDisabled,
17588
+ children: null
17589
+ })
17590
+ })) : leading
17591
+ }), /*#__PURE__*/jsx(BaseBox, {
17592
+ paddingLeft: selectionType === 'multiple' || !leading ? 'spacing.0' : 'spacing.3',
17593
+ paddingRight: "spacing.3",
17594
+ children: /*#__PURE__*/jsx(Text, {
17595
+ truncateAfterLines: 1,
17596
+ color: intent === 'negative' ? 'feedback.text.negative.lowContrast' : getNormalTextColor(isDisabled),
17597
+ children: title
17598
+ })
17599
+ }), /*#__PURE__*/jsx(BaseBox, {
17600
+ marginLeft: "auto",
17601
+ children: trailing
17602
+ })]
17603
+ }), /*#__PURE__*/jsx(BaseBox, {
17604
+ paddingLeft: leading || selectionType === 'multiple' ? 'spacing.7' : undefined,
17605
+ children: description ? /*#__PURE__*/jsx(Text, {
17606
+ color: getNormalTextColor(isDisabled, {
17607
+ isMuted: true
17608
+ }),
17609
+ size: "small",
17610
+ children: description
17611
+ }) : null
17612
+ })]
17613
+ });
17614
+ };
17615
+
17616
+ var ActionListItemBody = /*#__PURE__*/React__default.memo(_ActionListItemBody);
17551
17617
  /**
17552
17618
  * ### ActionListItem
17553
17619
  *
@@ -17567,7 +17633,6 @@ var makeActionListItemClickable = function makeActionListItemClickable(clickHand
17567
17633
  * ```
17568
17634
  */
17569
17635
 
17570
-
17571
17636
  var _ActionListItem = function _ActionListItem(props) {
17572
17637
  var _useDropdown = useDropdown(),
17573
17638
  activeIndex = _useDropdown.activeIndex,
@@ -17598,7 +17663,7 @@ var _ActionListItem = function _ActionListItem(props) {
17598
17663
  intent: props.intent,
17599
17664
  isDisabled: props.isDisabled
17600
17665
  },
17601
- children: /*#__PURE__*/jsxs(StyledActionListItem, _objectSpread$H(_objectSpread$H(_objectSpread$H(_objectSpread$H({
17666
+ children: /*#__PURE__*/jsx(StyledActionListItem, _objectSpread$H(_objectSpread$H(_objectSpread$H(_objectSpread$H({
17602
17667
  as: !isReactNative$4() ? renderOnWebAs : undefined,
17603
17668
  id: "".concat(dropdownBaseId, "-").concat(props._index),
17604
17669
  type: "button",
@@ -17643,58 +17708,21 @@ var _ActionListItem = function _ActionListItem(props) {
17643
17708
  intent: props.intent,
17644
17709
  isSelected: isSelected,
17645
17710
  isKeydownPressed: isKeydownPressed,
17646
- children: [/*#__PURE__*/jsxs(BaseBox, {
17647
- display: "flex",
17648
- justifyContent: "center",
17649
- flexDirection: "row",
17650
- alignItems: "center",
17651
- maxHeight: isReactNative$4() ? undefined : makeSize(size[20]),
17652
- children: [/*#__PURE__*/jsx(BaseBox, {
17653
- display: "flex",
17654
- justifyContent: "center",
17655
- alignItems: "center",
17656
- children: selectionType === 'multiple' ?
17657
- /*#__PURE__*/
17658
- // 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
17659
- jsx(ActionListCheckboxWrapper, _objectSpread$H(_objectSpread$H({
17660
- hasDescription: Boolean(props.description)
17661
- }, makeAccessible({
17662
- hidden: true
17663
- })), {}, {
17664
- children: /*#__PURE__*/jsx(Checkbox, {
17665
- isChecked: isSelected,
17666
- tabIndex: -1,
17667
- isDisabled: props.isDisabled,
17668
- children: null
17669
- })
17670
- })) : props.leading
17671
- }), /*#__PURE__*/jsx(BaseBox, {
17672
- paddingLeft: selectionType === 'multiple' || !props.leading ? 'spacing.0' : 'spacing.3',
17673
- paddingRight: "spacing.3",
17674
- children: /*#__PURE__*/jsx(Text, {
17675
- truncateAfterLines: 1,
17676
- color: props.intent === 'negative' ? 'feedback.text.negative.lowContrast' : getNormalTextColor(props.isDisabled),
17677
- children: props.title
17678
- })
17679
- }), /*#__PURE__*/jsx(BaseBox, {
17680
- marginLeft: "auto",
17681
- children: props.trailing
17682
- })]
17683
- }), /*#__PURE__*/jsx(BaseBox, {
17684
- paddingLeft: props.leading || selectionType === 'multiple' ? 'spacing.7' : undefined,
17685
- children: props.description ? /*#__PURE__*/jsx(Text, {
17686
- color: getNormalTextColor(props.isDisabled, {
17687
- isMuted: true
17688
- }),
17689
- size: "small",
17690
- children: props.description
17691
- }) : null
17692
- })]
17711
+ children: /*#__PURE__*/jsx(ActionListItemBody, {
17712
+ selectionType: selectionType,
17713
+ intent: props.intent,
17714
+ description: props.description,
17715
+ isDisabled: props.isDisabled,
17716
+ leading: props.leading,
17717
+ trailing: props.trailing,
17718
+ title: props.title,
17719
+ isSelected: isSelected
17720
+ })
17693
17721
  }))
17694
17722
  });
17695
17723
  };
17696
17724
 
17697
- var ActionListItem = /*#__PURE__*/assignWithoutSideEffects(_ActionListItem, {
17725
+ var ActionListItem = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.memo(_ActionListItem), {
17698
17726
  componentId: componentIds$1.ActionListItem
17699
17727
  });
17700
17728
 
@@ -20349,7 +20377,7 @@ var _Dropdown = function _Dropdown(_ref) {
20349
20377
  setIsKeydownPressed = _React$useState18[1];
20350
20378
 
20351
20379
  var dropdownBaseId = useId('dropdown');
20352
- var dropdownTriggerer;
20380
+ var dropdownTriggerer = React__default.useRef();
20353
20381
  React__default.Children.map(children, function (child) {
20354
20382
  if ( /*#__PURE__*/React__default.isValidElement(child)) {
20355
20383
  if (!isValidAllowedChildren(child, 'SelectInput') && !isValidAllowedChildren(child, componentIds.DropdownOverlay)) {
@@ -20357,7 +20385,7 @@ var _Dropdown = function _Dropdown(_ref) {
20357
20385
  }
20358
20386
 
20359
20387
  if (isValidAllowedChildren(child, 'SelectInput')) {
20360
- dropdownTriggerer = 'SelectInput';
20388
+ dropdownTriggerer.current = 'SelectInput';
20361
20389
  }
20362
20390
  }
20363
20391
  });
@@ -20385,7 +20413,7 @@ var _Dropdown = function _Dropdown(_ref) {
20385
20413
  setHasFooterAction: setHasFooterAction,
20386
20414
  hasLabelOnLeft: hasLabelOnLeft,
20387
20415
  setHasLabelOnLeft: setHasLabelOnLeft,
20388
- dropdownTriggerer: dropdownTriggerer
20416
+ dropdownTriggerer: dropdownTriggerer.current
20389
20417
  };
20390
20418
  }, // eslint-disable-next-line react-hooks/exhaustive-deps
20391
20419
  [isOpen, selectedIndices, options, activeIndex, shouldIgnoreBlur, shouldIgnoreBlurAnimation, selectionType, hasFooterAction, hasLabelOnLeft, isKeydownPressed]);
@@ -20872,24 +20900,28 @@ var _DropdownOverlay = function _DropdownOverlay(_ref) {
20872
20900
  window.removeEventListener('resize', setOverlayWidth);
20873
20901
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
20874
20902
  }, [setWidth, triggererRef, hasLabelOnLeft]);
20903
+ var onAnimationEnd = React__default.useCallback(function () {
20904
+ if (isOpen) {
20905
+ setDisplay('block');
20906
+ } else {
20907
+ setDisplay('none');
20908
+ }
20909
+ }, [isOpen]);
20910
+ var styles = React__default.useMemo(function () {
20911
+ return {
20912
+ opacity: isOpen ? 1 : 0
20913
+ };
20914
+ }, [isOpen]);
20875
20915
  return /*#__PURE__*/jsx(BaseBox, {
20876
20916
  position: "relative",
20877
20917
  children: /*#__PURE__*/jsx(StyledDropdownOverlay, _objectSpread$m(_objectSpread$m({
20878
20918
  width: width,
20879
- style: {
20880
- opacity: isOpen ? 1 : 0
20881
- },
20919
+ style: styles,
20882
20920
  display: castWebType(display),
20883
20921
  right: "0px",
20884
20922
  position: "absolute",
20885
20923
  transition: isOpen ? fadeIn : fadeOut,
20886
- onAnimationEnd: function onAnimationEnd() {
20887
- if (isOpen) {
20888
- setDisplay('block');
20889
- } else {
20890
- setDisplay('none');
20891
- }
20892
- }
20924
+ onAnimationEnd: onAnimationEnd
20893
20925
  }, metaAttribute({
20894
20926
  name: MetaConstants.DropdownOverlay,
20895
20927
  testID: testID