@razorpay/blade 10.14.1 → 10.14.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.
- package/build/components/index.development.web.js +59 -48
- package/build/components/index.development.web.js.map +1 -1
- package/build/components/index.production.web.js +59 -48
- 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
|
@@ -29032,6 +29032,7 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
29032
29032
|
var scrollRef = React__default.useRef(null);
|
|
29033
29033
|
var grabHandleRef = React__default.useRef(null);
|
|
29034
29034
|
var defaultInitialFocusRef = React__default.useRef(null);
|
|
29035
|
+
var originalFocusElement = React__default.useRef(null);
|
|
29035
29036
|
var initialSnapPoint = React__default.useRef(snapPoints[1]);
|
|
29036
29037
|
var totalHeight = React__default.useMemo(function () {
|
|
29037
29038
|
return grabHandleHeight + headerHeight + footerHeight + contentHeight;
|
|
@@ -29096,17 +29097,43 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
29096
29097
|
}
|
|
29097
29098
|
}
|
|
29098
29099
|
}, [dimensions.height, snapPoints, totalHeight]);
|
|
29100
|
+
var returnFocus = React__default.useCallback(function () {
|
|
29101
|
+
if (!originalFocusElement.current) return;
|
|
29102
|
+
originalFocusElement.current.focus();
|
|
29103
|
+
// After returning focus we will clear the original focus
|
|
29104
|
+
// Because if sheet can be opened up via multiple triggers
|
|
29105
|
+
// We want to ensure the focus returns back to the most recent triggerer
|
|
29106
|
+
originalFocusElement.current = null;
|
|
29107
|
+
}, [originalFocusElement]);
|
|
29108
|
+
var focusOnInitialRef = React__default.useCallback(function () {
|
|
29109
|
+
if (!initialFocusRef) {
|
|
29110
|
+
var _defaultInitialFocusR;
|
|
29111
|
+
// focus on close button
|
|
29112
|
+
(_defaultInitialFocusR = defaultInitialFocusRef.current) === null || _defaultInitialFocusR === void 0 ? void 0 : _defaultInitialFocusR.focus();
|
|
29113
|
+
} else {
|
|
29114
|
+
var _initialFocusRef$curr;
|
|
29115
|
+
// focus on the initialRef passed by the user
|
|
29116
|
+
(_initialFocusRef$curr = initialFocusRef.current) === null || _initialFocusRef$curr === void 0 ? void 0 : _initialFocusRef$curr.focus();
|
|
29117
|
+
}
|
|
29118
|
+
}, [initialFocusRef]);
|
|
29099
29119
|
var handleOnOpen = React__default.useCallback(function () {
|
|
29120
|
+
var _originalFocusElement;
|
|
29100
29121
|
setPositionY(dimensions.height * initialSnapPoint.current);
|
|
29101
29122
|
scrollLockRef.current.activate();
|
|
29102
|
-
|
|
29123
|
+
// initialize the original focused element
|
|
29124
|
+
// On first render it will be the activeElement, eg: the button trigger or select input
|
|
29125
|
+
// On Subsequent open operations it won't further update the original focus
|
|
29126
|
+
originalFocusElement.current = (_originalFocusElement = originalFocusElement.current) !== null && _originalFocusElement !== void 0 ? _originalFocusElement : document.activeElement;
|
|
29127
|
+
focusOnInitialRef();
|
|
29128
|
+
}, [dimensions.height, focusOnInitialRef, scrollLockRef, setPositionY]);
|
|
29103
29129
|
var handleOnClose = React__default.useCallback(function () {
|
|
29104
29130
|
setPositionY(0);
|
|
29105
29131
|
}, [setPositionY]);
|
|
29106
29132
|
var close = React__default.useCallback(function () {
|
|
29107
29133
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
29108
29134
|
bottomSheetAndDropdownGlue === null || bottomSheetAndDropdownGlue === void 0 ? void 0 : bottomSheetAndDropdownGlue.onBottomSheetDismiss();
|
|
29109
|
-
|
|
29135
|
+
returnFocus();
|
|
29136
|
+
}, [bottomSheetAndDropdownGlue, onDismiss, returnFocus]);
|
|
29110
29137
|
|
|
29111
29138
|
// sync controlled state to our actions
|
|
29112
29139
|
React__default.useEffect(function () {
|
|
@@ -29313,13 +29340,6 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
29313
29340
|
}
|
|
29314
29341
|
}, [isMounted, scrollLockRef]);
|
|
29315
29342
|
|
|
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
29343
|
// We don't want to destroy the react tree when we are rendering inside Dropdown
|
|
29324
29344
|
// Because if we bail out early then ActionList won't render,
|
|
29325
29345
|
// and Dropdown manages it's state based on the rendered JSX of ActionList
|
|
@@ -29328,48 +29348,39 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
29328
29348
|
if (!isMounted && !isInsideDropdown) {
|
|
29329
29349
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
29330
29350
|
}
|
|
29331
|
-
return /*#__PURE__*/
|
|
29351
|
+
return /*#__PURE__*/jsxs(BottomSheetContext.Provider, {
|
|
29332
29352
|
value: contextValue,
|
|
29333
|
-
children:
|
|
29334
|
-
|
|
29335
|
-
|
|
29336
|
-
|
|
29353
|
+
children: [/*#__PURE__*/jsx(BottomSheetBackdrop, {
|
|
29354
|
+
zIndex: bottomSheetZIndex
|
|
29355
|
+
}), /*#__PURE__*/jsx(BottomSheetSurface, _objectSpread$f(_objectSpread$f(_objectSpread$f({}, metaAttribute({
|
|
29356
|
+
name: MetaConstants.BottomSheet,
|
|
29357
|
+
testID: 'bottomsheet-surface'
|
|
29358
|
+
})), makeAccessible({
|
|
29337
29359
|
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
|
-
}))]
|
|
29360
|
+
role: 'dialog'
|
|
29361
|
+
})), {}, {
|
|
29362
|
+
windowHeight: dimensions.height,
|
|
29363
|
+
isDragging: isDragging,
|
|
29364
|
+
style: {
|
|
29365
|
+
opacity: isVisible ? 1 : 0,
|
|
29366
|
+
pointerEvents: isVisible ? 'all' : 'none',
|
|
29367
|
+
height: positionY,
|
|
29368
|
+
bottom: 0,
|
|
29369
|
+
top: 'auto',
|
|
29370
|
+
zIndex: bottomSheetZIndex
|
|
29371
|
+
},
|
|
29372
|
+
children: /*#__PURE__*/jsxs(BaseBox, {
|
|
29373
|
+
height: "100%",
|
|
29374
|
+
display: "flex",
|
|
29375
|
+
flexDirection: "column",
|
|
29376
|
+
children: [/*#__PURE__*/jsx(BottomSheetGrabHandle, _objectSpread$f(_objectSpread$f({
|
|
29377
|
+
ref: grabHandleRef,
|
|
29378
|
+
isHeaderFloating: isHeaderFloating
|
|
29379
|
+
}, metaAttribute({
|
|
29380
|
+
name: ComponentIds.BottomSheetGrabHandle
|
|
29381
|
+
})), bind())), children]
|
|
29371
29382
|
})
|
|
29372
|
-
})
|
|
29383
|
+
}))]
|
|
29373
29384
|
});
|
|
29374
29385
|
};
|
|
29375
29386
|
var BottomSheet = /*#__PURE__*/assignWithoutSideEffects(_BottomSheet, {
|