@razorpay/blade 10.14.1 → 10.14.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.
- package/build/components/index.d.ts +7 -1
- package/build/components/index.development.web.js +96 -65
- package/build/components/index.development.web.js.map +1 -1
- package/build/components/index.native.d.ts +7 -1
- package/build/components/index.native.js +2 -2
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.production.web.js +96 -65
- package/build/components/index.production.web.js.map +1 -1
- package/build/css/bankingThemeDarkDesktop.css +1 -1
- package/build/css/bankingThemeDarkMobile.css +1 -1
- package/build/css/bankingThemeLightDesktop.css +1 -1
- package/build/css/bankingThemeLightMobile.css +1 -1
- package/build/css/paymentThemeDarkDesktop.css +1 -1
- package/build/css/paymentThemeDarkMobile.css +1 -1
- package/build/css/paymentThemeLightDesktop.css +1 -1
- package/build/css/paymentThemeLightMobile.css +1 -1
- package/package.json +1 -1
|
@@ -537,17 +537,20 @@ var getActionListProperties = function getActionListProperties(children) {
|
|
|
537
537
|
if ( /*#__PURE__*/React__default.isValidElement(child)) {
|
|
538
538
|
if (isValidAllowedChildren(child, componentIds.ActionListSection)) {
|
|
539
539
|
var shouldHideDivider = index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;
|
|
540
|
+
var sectionChildValues = [];
|
|
540
541
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
541
542
|
// @ts-expect-error: TS doesn't understand the child's props
|
|
542
543
|
children: React__default.Children.map(child.props.children, function (childInSection) {
|
|
543
544
|
currentSection = child.props.title;
|
|
545
|
+
sectionChildValues.push(childInSection.props.value);
|
|
544
546
|
if (isValidAllowedChildren(childInSection, componentIds.ActionListItem)) {
|
|
545
547
|
return getActionListItemWithId(childInSection, shouldHideDivider);
|
|
546
548
|
}
|
|
547
549
|
return childInSection;
|
|
548
550
|
}),
|
|
549
551
|
// On web, we handle it with descendant styling in css so no need of JS there
|
|
550
|
-
_hideDivider: isReactNative$4() ? shouldHideDivider : undefined
|
|
552
|
+
_hideDivider: isReactNative$4() ? shouldHideDivider : undefined,
|
|
553
|
+
_sectionChildValues: sectionChildValues
|
|
551
554
|
});
|
|
552
555
|
}
|
|
553
556
|
if (isValidAllowedChildren(child, componentIds.ActionListItem)) {
|
|
@@ -15608,9 +15611,26 @@ var _ActionListSection = function _ActionListSection(_ref) {
|
|
|
15608
15611
|
var title = _ref.title,
|
|
15609
15612
|
children = _ref.children,
|
|
15610
15613
|
testID = _ref.testID,
|
|
15611
|
-
_hideDivider = _ref._hideDivider
|
|
15614
|
+
_hideDivider = _ref._hideDivider,
|
|
15615
|
+
_sectionChildValues = _ref._sectionChildValues;
|
|
15612
15616
|
var _useActionListContext = useActionListContext(),
|
|
15613
15617
|
surfaceLevel = _useActionListContext.surfaceLevel;
|
|
15618
|
+
var _useDropdown = useDropdown(),
|
|
15619
|
+
hasAutoCompleteInBottomSheetHeader = _useDropdown.hasAutoCompleteInBottomSheetHeader,
|
|
15620
|
+
dropdownTriggerer = _useDropdown.dropdownTriggerer,
|
|
15621
|
+
filteredValues = _useDropdown.filteredValues;
|
|
15622
|
+
var hasAutoComplete = hasAutoCompleteInBottomSheetHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;
|
|
15623
|
+
var isSectionVisible = React__default.useMemo(function () {
|
|
15624
|
+
if (hasAutoComplete) {
|
|
15625
|
+
var visibleActionListItemInSection = _sectionChildValues === null || _sectionChildValues === void 0 ? void 0 : _sectionChildValues.find(function (actionItemValue) {
|
|
15626
|
+
return filteredValues.includes(actionItemValue);
|
|
15627
|
+
});
|
|
15628
|
+
return Boolean(visibleActionListItemInSection);
|
|
15629
|
+
}
|
|
15630
|
+
return true;
|
|
15631
|
+
}, [_sectionChildValues, hasAutoComplete, filteredValues]);
|
|
15632
|
+
var showDividerInRN = !(_hideDivider && isReactNative$4());
|
|
15633
|
+
var showDividerInAutoComplete = hasAutoComplete ? isSectionVisible && filteredValues.length > 1 : true;
|
|
15614
15634
|
return /*#__PURE__*/jsxs(BaseBox, _objectSpread$1q(_objectSpread$1q(_objectSpread$1q({}, makeAccessible({
|
|
15615
15635
|
role: getActionListSectionRole(),
|
|
15616
15636
|
label: title
|
|
@@ -15620,7 +15640,7 @@ var _ActionListSection = function _ActionListSection(_ref) {
|
|
|
15620
15640
|
name: MetaConstants.ActionListSection,
|
|
15621
15641
|
testID: testID
|
|
15622
15642
|
})), {}, {
|
|
15623
|
-
children: [/*#__PURE__*/jsx(StyledActionListSectionTitle, _objectSpread$1q(_objectSpread$1q({}, makeAccessible({
|
|
15643
|
+
children: [isSectionVisible ? /*#__PURE__*/jsx(StyledActionListSectionTitle, _objectSpread$1q(_objectSpread$1q({}, makeAccessible({
|
|
15624
15644
|
hidden: true
|
|
15625
15645
|
})), {}, {
|
|
15626
15646
|
children: /*#__PURE__*/jsx(Text, {
|
|
@@ -15629,16 +15649,16 @@ var _ActionListSection = function _ActionListSection(_ref) {
|
|
|
15629
15649
|
weight: "bold",
|
|
15630
15650
|
children: title
|
|
15631
15651
|
})
|
|
15632
|
-
})), /*#__PURE__*/jsx(BaseBox, _objectSpread$1q(_objectSpread$1q({}, makeAccessible({
|
|
15652
|
+
})) : null, /*#__PURE__*/jsx(BaseBox, _objectSpread$1q(_objectSpread$1q({}, makeAccessible({
|
|
15633
15653
|
// On web, we just wrap it in another listbox to announce item count properly for particular group.
|
|
15634
15654
|
// On React Native, we ignore it since `menu` + `group` role will take care of accessibility
|
|
15635
15655
|
role: isReactNative$4() ? undefined : 'listbox'
|
|
15636
15656
|
})), {}, {
|
|
15637
15657
|
children: children
|
|
15638
|
-
})),
|
|
15658
|
+
})), showDividerInAutoComplete && showDividerInRN ? /*#__PURE__*/jsx(Divider, {
|
|
15639
15659
|
marginX: "spacing.3",
|
|
15640
15660
|
marginY: "spacing.1"
|
|
15641
|
-
})]
|
|
15661
|
+
}) : null]
|
|
15642
15662
|
}));
|
|
15643
15663
|
};
|
|
15644
15664
|
var ActionListSection = /*#__PURE__*/assignWithoutSideEffects(_ActionListSection, {
|
|
@@ -15800,17 +15820,17 @@ var ActionListItemBody = /*#__PURE__*/React__default.memo(_ActionListItemBody);
|
|
|
15800
15820
|
* ```
|
|
15801
15821
|
*/
|
|
15802
15822
|
var _ActionListItem = function _ActionListItem(props) {
|
|
15803
|
-
var
|
|
15804
|
-
activeIndex =
|
|
15805
|
-
dropdownBaseId =
|
|
15806
|
-
onOptionClick =
|
|
15807
|
-
selectedIndices =
|
|
15808
|
-
setShouldIgnoreBlurAnimation =
|
|
15809
|
-
selectionType =
|
|
15810
|
-
dropdownTriggerer =
|
|
15811
|
-
isKeydownPressed =
|
|
15812
|
-
filteredValues =
|
|
15813
|
-
hasAutoCompleteInBottomSheetHeader =
|
|
15823
|
+
var _useDropdown2 = useDropdown(),
|
|
15824
|
+
activeIndex = _useDropdown2.activeIndex,
|
|
15825
|
+
dropdownBaseId = _useDropdown2.dropdownBaseId,
|
|
15826
|
+
onOptionClick = _useDropdown2.onOptionClick,
|
|
15827
|
+
selectedIndices = _useDropdown2.selectedIndices,
|
|
15828
|
+
setShouldIgnoreBlurAnimation = _useDropdown2.setShouldIgnoreBlurAnimation,
|
|
15829
|
+
selectionType = _useDropdown2.selectionType,
|
|
15830
|
+
dropdownTriggerer = _useDropdown2.dropdownTriggerer,
|
|
15831
|
+
isKeydownPressed = _useDropdown2.isKeydownPressed,
|
|
15832
|
+
filteredValues = _useDropdown2.filteredValues,
|
|
15833
|
+
hasAutoCompleteInBottomSheetHeader = _useDropdown2.hasAutoCompleteInBottomSheetHeader;
|
|
15814
15834
|
var _useTheme = useTheme(),
|
|
15815
15835
|
platform = _useTheme.platform;
|
|
15816
15836
|
var isMobile = platform === 'onMobile';
|
|
@@ -29032,6 +29052,7 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
29032
29052
|
var scrollRef = React__default.useRef(null);
|
|
29033
29053
|
var grabHandleRef = React__default.useRef(null);
|
|
29034
29054
|
var defaultInitialFocusRef = React__default.useRef(null);
|
|
29055
|
+
var originalFocusElement = React__default.useRef(null);
|
|
29035
29056
|
var initialSnapPoint = React__default.useRef(snapPoints[1]);
|
|
29036
29057
|
var totalHeight = React__default.useMemo(function () {
|
|
29037
29058
|
return grabHandleHeight + headerHeight + footerHeight + contentHeight;
|
|
@@ -29096,17 +29117,43 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
29096
29117
|
}
|
|
29097
29118
|
}
|
|
29098
29119
|
}, [dimensions.height, snapPoints, totalHeight]);
|
|
29120
|
+
var returnFocus = React__default.useCallback(function () {
|
|
29121
|
+
if (!originalFocusElement.current) return;
|
|
29122
|
+
originalFocusElement.current.focus();
|
|
29123
|
+
// After returning focus we will clear the original focus
|
|
29124
|
+
// Because if sheet can be opened up via multiple triggers
|
|
29125
|
+
// We want to ensure the focus returns back to the most recent triggerer
|
|
29126
|
+
originalFocusElement.current = null;
|
|
29127
|
+
}, [originalFocusElement]);
|
|
29128
|
+
var focusOnInitialRef = React__default.useCallback(function () {
|
|
29129
|
+
if (!initialFocusRef) {
|
|
29130
|
+
var _defaultInitialFocusR;
|
|
29131
|
+
// focus on close button
|
|
29132
|
+
(_defaultInitialFocusR = defaultInitialFocusRef.current) === null || _defaultInitialFocusR === void 0 ? void 0 : _defaultInitialFocusR.focus();
|
|
29133
|
+
} else {
|
|
29134
|
+
var _initialFocusRef$curr;
|
|
29135
|
+
// focus on the initialRef passed by the user
|
|
29136
|
+
(_initialFocusRef$curr = initialFocusRef.current) === null || _initialFocusRef$curr === void 0 ? void 0 : _initialFocusRef$curr.focus();
|
|
29137
|
+
}
|
|
29138
|
+
}, [initialFocusRef]);
|
|
29099
29139
|
var handleOnOpen = React__default.useCallback(function () {
|
|
29140
|
+
var _originalFocusElement;
|
|
29100
29141
|
setPositionY(dimensions.height * initialSnapPoint.current);
|
|
29101
29142
|
scrollLockRef.current.activate();
|
|
29102
|
-
|
|
29143
|
+
// initialize the original focused element
|
|
29144
|
+
// On first render it will be the activeElement, eg: the button trigger or select input
|
|
29145
|
+
// On Subsequent open operations it won't further update the original focus
|
|
29146
|
+
originalFocusElement.current = (_originalFocusElement = originalFocusElement.current) !== null && _originalFocusElement !== void 0 ? _originalFocusElement : document.activeElement;
|
|
29147
|
+
focusOnInitialRef();
|
|
29148
|
+
}, [dimensions.height, focusOnInitialRef, scrollLockRef, setPositionY]);
|
|
29103
29149
|
var handleOnClose = React__default.useCallback(function () {
|
|
29104
29150
|
setPositionY(0);
|
|
29105
29151
|
}, [setPositionY]);
|
|
29106
29152
|
var close = React__default.useCallback(function () {
|
|
29107
29153
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
29108
29154
|
bottomSheetAndDropdownGlue === null || bottomSheetAndDropdownGlue === void 0 ? void 0 : bottomSheetAndDropdownGlue.onBottomSheetDismiss();
|
|
29109
|
-
|
|
29155
|
+
returnFocus();
|
|
29156
|
+
}, [bottomSheetAndDropdownGlue, onDismiss, returnFocus]);
|
|
29110
29157
|
|
|
29111
29158
|
// sync controlled state to our actions
|
|
29112
29159
|
React__default.useEffect(function () {
|
|
@@ -29313,13 +29360,6 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
29313
29360
|
}
|
|
29314
29361
|
}, [isMounted, scrollLockRef]);
|
|
29315
29362
|
|
|
29316
|
-
// required by floating ui to handle focus
|
|
29317
|
-
var _useFloating = useFloating({
|
|
29318
|
-
open: isMounted
|
|
29319
|
-
}),
|
|
29320
|
-
refs = _useFloating.refs,
|
|
29321
|
-
context = _useFloating.context;
|
|
29322
|
-
|
|
29323
29363
|
// We don't want to destroy the react tree when we are rendering inside Dropdown
|
|
29324
29364
|
// Because if we bail out early then ActionList won't render,
|
|
29325
29365
|
// and Dropdown manages it's state based on the rendered JSX of ActionList
|
|
@@ -29328,48 +29368,39 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
29328
29368
|
if (!isMounted && !isInsideDropdown) {
|
|
29329
29369
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
29330
29370
|
}
|
|
29331
|
-
return /*#__PURE__*/
|
|
29371
|
+
return /*#__PURE__*/jsxs(BottomSheetContext.Provider, {
|
|
29332
29372
|
value: contextValue,
|
|
29333
|
-
children:
|
|
29334
|
-
|
|
29335
|
-
|
|
29336
|
-
|
|
29373
|
+
children: [/*#__PURE__*/jsx(BottomSheetBackdrop, {
|
|
29374
|
+
zIndex: bottomSheetZIndex
|
|
29375
|
+
}), /*#__PURE__*/jsx(BottomSheetSurface, _objectSpread$f(_objectSpread$f(_objectSpread$f({}, metaAttribute({
|
|
29376
|
+
name: MetaConstants.BottomSheet,
|
|
29377
|
+
testID: 'bottomsheet-surface'
|
|
29378
|
+
})), makeAccessible({
|
|
29337
29379
|
modal: true,
|
|
29338
|
-
|
|
29339
|
-
|
|
29340
|
-
|
|
29341
|
-
|
|
29342
|
-
|
|
29343
|
-
|
|
29344
|
-
|
|
29345
|
-
|
|
29346
|
-
|
|
29347
|
-
|
|
29348
|
-
|
|
29349
|
-
|
|
29350
|
-
|
|
29351
|
-
|
|
29352
|
-
|
|
29353
|
-
|
|
29354
|
-
|
|
29355
|
-
|
|
29356
|
-
|
|
29357
|
-
|
|
29358
|
-
|
|
29359
|
-
|
|
29360
|
-
height: "100%",
|
|
29361
|
-
display: "flex",
|
|
29362
|
-
flexDirection: "column",
|
|
29363
|
-
children: [/*#__PURE__*/jsx(BottomSheetGrabHandle, _objectSpread$f(_objectSpread$f({
|
|
29364
|
-
ref: grabHandleRef,
|
|
29365
|
-
isHeaderFloating: isHeaderFloating
|
|
29366
|
-
}, metaAttribute({
|
|
29367
|
-
name: ComponentIds.BottomSheetGrabHandle
|
|
29368
|
-
})), bind())), children]
|
|
29369
|
-
})
|
|
29370
|
-
}))]
|
|
29380
|
+
role: 'dialog'
|
|
29381
|
+
})), {}, {
|
|
29382
|
+
windowHeight: dimensions.height,
|
|
29383
|
+
isDragging: isDragging,
|
|
29384
|
+
style: {
|
|
29385
|
+
opacity: isVisible ? 1 : 0,
|
|
29386
|
+
pointerEvents: isVisible ? 'all' : 'none',
|
|
29387
|
+
height: positionY,
|
|
29388
|
+
bottom: 0,
|
|
29389
|
+
top: 'auto',
|
|
29390
|
+
zIndex: bottomSheetZIndex
|
|
29391
|
+
},
|
|
29392
|
+
children: /*#__PURE__*/jsxs(BaseBox, {
|
|
29393
|
+
height: "100%",
|
|
29394
|
+
display: "flex",
|
|
29395
|
+
flexDirection: "column",
|
|
29396
|
+
children: [/*#__PURE__*/jsx(BottomSheetGrabHandle, _objectSpread$f(_objectSpread$f({
|
|
29397
|
+
ref: grabHandleRef,
|
|
29398
|
+
isHeaderFloating: isHeaderFloating
|
|
29399
|
+
}, metaAttribute({
|
|
29400
|
+
name: ComponentIds.BottomSheetGrabHandle
|
|
29401
|
+
})), bind())), children]
|
|
29371
29402
|
})
|
|
29372
|
-
})
|
|
29403
|
+
}))]
|
|
29373
29404
|
});
|
|
29374
29405
|
};
|
|
29375
29406
|
var BottomSheet = /*#__PURE__*/assignWithoutSideEffects(_BottomSheet, {
|