@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
|
@@ -2115,8 +2115,14 @@ declare type ActionListSectionProps = {
|
|
|
2115
2115
|
* @private
|
|
2116
2116
|
*/
|
|
2117
2117
|
_hideDivider?: boolean;
|
|
2118
|
+
/**
|
|
2119
|
+
* Internally used to hide / show section in AutoComplete
|
|
2120
|
+
*
|
|
2121
|
+
* @private
|
|
2122
|
+
*/
|
|
2123
|
+
_sectionChildValues?: string[];
|
|
2118
2124
|
} & TestID;
|
|
2119
|
-
declare const ActionListSection: ({ title, children, testID, _hideDivider, }: ActionListSectionProps) => React__default.ReactElement;
|
|
2125
|
+
declare const ActionListSection: ({ title, children, testID, _hideDivider, _sectionChildValues, }: ActionListSectionProps) => React__default.ReactElement;
|
|
2120
2126
|
declare const ActionListItemIcon: ({ icon }: {
|
|
2121
2127
|
icon: IconComponent;
|
|
2122
2128
|
}) => React__default.ReactElement;
|
|
@@ -590,17 +590,20 @@ var getActionListProperties = function getActionListProperties(children) {
|
|
|
590
590
|
if ( /*#__PURE__*/React__default.isValidElement(child)) {
|
|
591
591
|
if (isValidAllowedChildren(child, componentIds.ActionListSection)) {
|
|
592
592
|
var shouldHideDivider = index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;
|
|
593
|
+
var sectionChildValues = [];
|
|
593
594
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
594
595
|
// @ts-expect-error: TS doesn't understand the child's props
|
|
595
596
|
children: React__default.Children.map(child.props.children, function (childInSection) {
|
|
596
597
|
currentSection = child.props.title;
|
|
598
|
+
sectionChildValues.push(childInSection.props.value);
|
|
597
599
|
if (isValidAllowedChildren(childInSection, componentIds.ActionListItem)) {
|
|
598
600
|
return getActionListItemWithId(childInSection, shouldHideDivider);
|
|
599
601
|
}
|
|
600
602
|
return childInSection;
|
|
601
603
|
}),
|
|
602
604
|
// On web, we handle it with descendant styling in css so no need of JS there
|
|
603
|
-
_hideDivider: isReactNative$4() ? shouldHideDivider : undefined
|
|
605
|
+
_hideDivider: isReactNative$4() ? shouldHideDivider : undefined,
|
|
606
|
+
_sectionChildValues: sectionChildValues
|
|
604
607
|
});
|
|
605
608
|
}
|
|
606
609
|
if (isValidAllowedChildren(child, componentIds.ActionListItem)) {
|
|
@@ -15846,9 +15849,26 @@ var _ActionListSection = function _ActionListSection(_ref) {
|
|
|
15846
15849
|
var title = _ref.title,
|
|
15847
15850
|
children = _ref.children,
|
|
15848
15851
|
testID = _ref.testID,
|
|
15849
|
-
_hideDivider = _ref._hideDivider
|
|
15852
|
+
_hideDivider = _ref._hideDivider,
|
|
15853
|
+
_sectionChildValues = _ref._sectionChildValues;
|
|
15850
15854
|
var _useActionListContext = useActionListContext(),
|
|
15851
15855
|
surfaceLevel = _useActionListContext.surfaceLevel;
|
|
15856
|
+
var _useDropdown = useDropdown(),
|
|
15857
|
+
hasAutoCompleteInBottomSheetHeader = _useDropdown.hasAutoCompleteInBottomSheetHeader,
|
|
15858
|
+
dropdownTriggerer = _useDropdown.dropdownTriggerer,
|
|
15859
|
+
filteredValues = _useDropdown.filteredValues;
|
|
15860
|
+
var hasAutoComplete = hasAutoCompleteInBottomSheetHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;
|
|
15861
|
+
var isSectionVisible = React__default.useMemo(function () {
|
|
15862
|
+
if (hasAutoComplete) {
|
|
15863
|
+
var visibleActionListItemInSection = _sectionChildValues === null || _sectionChildValues === void 0 ? void 0 : _sectionChildValues.find(function (actionItemValue) {
|
|
15864
|
+
return filteredValues.includes(actionItemValue);
|
|
15865
|
+
});
|
|
15866
|
+
return Boolean(visibleActionListItemInSection);
|
|
15867
|
+
}
|
|
15868
|
+
return true;
|
|
15869
|
+
}, [_sectionChildValues, hasAutoComplete, filteredValues]);
|
|
15870
|
+
var showDividerInRN = !(_hideDivider && isReactNative$4());
|
|
15871
|
+
var showDividerInAutoComplete = hasAutoComplete ? isSectionVisible && filteredValues.length > 1 : true;
|
|
15852
15872
|
return /*#__PURE__*/jsxs(BaseBox, _objectSpread$1q(_objectSpread$1q(_objectSpread$1q({}, makeAccessible({
|
|
15853
15873
|
role: getActionListSectionRole(),
|
|
15854
15874
|
label: title
|
|
@@ -15858,7 +15878,7 @@ var _ActionListSection = function _ActionListSection(_ref) {
|
|
|
15858
15878
|
name: MetaConstants.ActionListSection,
|
|
15859
15879
|
testID: testID
|
|
15860
15880
|
})), {}, {
|
|
15861
|
-
children: [/*#__PURE__*/jsx(StyledActionListSectionTitle, _objectSpread$1q(_objectSpread$1q({}, makeAccessible({
|
|
15881
|
+
children: [isSectionVisible ? /*#__PURE__*/jsx(StyledActionListSectionTitle, _objectSpread$1q(_objectSpread$1q({}, makeAccessible({
|
|
15862
15882
|
hidden: true
|
|
15863
15883
|
})), {}, {
|
|
15864
15884
|
children: /*#__PURE__*/jsx(Text, {
|
|
@@ -15867,16 +15887,16 @@ var _ActionListSection = function _ActionListSection(_ref) {
|
|
|
15867
15887
|
weight: "bold",
|
|
15868
15888
|
children: title
|
|
15869
15889
|
})
|
|
15870
|
-
})), /*#__PURE__*/jsx(BaseBox, _objectSpread$1q(_objectSpread$1q({}, makeAccessible({
|
|
15890
|
+
})) : null, /*#__PURE__*/jsx(BaseBox, _objectSpread$1q(_objectSpread$1q({}, makeAccessible({
|
|
15871
15891
|
// On web, we just wrap it in another listbox to announce item count properly for particular group.
|
|
15872
15892
|
// On React Native, we ignore it since `menu` + `group` role will take care of accessibility
|
|
15873
15893
|
role: isReactNative$4() ? undefined : 'listbox'
|
|
15874
15894
|
})), {}, {
|
|
15875
15895
|
children: children
|
|
15876
|
-
})),
|
|
15896
|
+
})), showDividerInAutoComplete && showDividerInRN ? /*#__PURE__*/jsx(Divider, {
|
|
15877
15897
|
marginX: "spacing.3",
|
|
15878
15898
|
marginY: "spacing.1"
|
|
15879
|
-
})]
|
|
15899
|
+
}) : null]
|
|
15880
15900
|
}));
|
|
15881
15901
|
};
|
|
15882
15902
|
var ActionListSection = /*#__PURE__*/assignWithoutSideEffects(_ActionListSection, {
|
|
@@ -16038,17 +16058,17 @@ var ActionListItemBody = /*#__PURE__*/React__default.memo(_ActionListItemBody);
|
|
|
16038
16058
|
* ```
|
|
16039
16059
|
*/
|
|
16040
16060
|
var _ActionListItem = function _ActionListItem(props) {
|
|
16041
|
-
var
|
|
16042
|
-
activeIndex =
|
|
16043
|
-
dropdownBaseId =
|
|
16044
|
-
onOptionClick =
|
|
16045
|
-
selectedIndices =
|
|
16046
|
-
setShouldIgnoreBlurAnimation =
|
|
16047
|
-
selectionType =
|
|
16048
|
-
dropdownTriggerer =
|
|
16049
|
-
isKeydownPressed =
|
|
16050
|
-
filteredValues =
|
|
16051
|
-
hasAutoCompleteInBottomSheetHeader =
|
|
16061
|
+
var _useDropdown2 = useDropdown(),
|
|
16062
|
+
activeIndex = _useDropdown2.activeIndex,
|
|
16063
|
+
dropdownBaseId = _useDropdown2.dropdownBaseId,
|
|
16064
|
+
onOptionClick = _useDropdown2.onOptionClick,
|
|
16065
|
+
selectedIndices = _useDropdown2.selectedIndices,
|
|
16066
|
+
setShouldIgnoreBlurAnimation = _useDropdown2.setShouldIgnoreBlurAnimation,
|
|
16067
|
+
selectionType = _useDropdown2.selectionType,
|
|
16068
|
+
dropdownTriggerer = _useDropdown2.dropdownTriggerer,
|
|
16069
|
+
isKeydownPressed = _useDropdown2.isKeydownPressed,
|
|
16070
|
+
filteredValues = _useDropdown2.filteredValues,
|
|
16071
|
+
hasAutoCompleteInBottomSheetHeader = _useDropdown2.hasAutoCompleteInBottomSheetHeader;
|
|
16052
16072
|
var _useTheme = useTheme(),
|
|
16053
16073
|
platform = _useTheme.platform;
|
|
16054
16074
|
var isMobile = platform === 'onMobile';
|
|
@@ -29495,6 +29515,7 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
29495
29515
|
var scrollRef = React__default.useRef(null);
|
|
29496
29516
|
var grabHandleRef = React__default.useRef(null);
|
|
29497
29517
|
var defaultInitialFocusRef = React__default.useRef(null);
|
|
29518
|
+
var originalFocusElement = React__default.useRef(null);
|
|
29498
29519
|
var initialSnapPoint = React__default.useRef(snapPoints[1]);
|
|
29499
29520
|
var totalHeight = React__default.useMemo(function () {
|
|
29500
29521
|
return grabHandleHeight + headerHeight + footerHeight + contentHeight;
|
|
@@ -29559,17 +29580,43 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
29559
29580
|
}
|
|
29560
29581
|
}
|
|
29561
29582
|
}, [dimensions.height, snapPoints, totalHeight]);
|
|
29583
|
+
var returnFocus = React__default.useCallback(function () {
|
|
29584
|
+
if (!originalFocusElement.current) return;
|
|
29585
|
+
originalFocusElement.current.focus();
|
|
29586
|
+
// After returning focus we will clear the original focus
|
|
29587
|
+
// Because if sheet can be opened up via multiple triggers
|
|
29588
|
+
// We want to ensure the focus returns back to the most recent triggerer
|
|
29589
|
+
originalFocusElement.current = null;
|
|
29590
|
+
}, [originalFocusElement]);
|
|
29591
|
+
var focusOnInitialRef = React__default.useCallback(function () {
|
|
29592
|
+
if (!initialFocusRef) {
|
|
29593
|
+
var _defaultInitialFocusR;
|
|
29594
|
+
// focus on close button
|
|
29595
|
+
(_defaultInitialFocusR = defaultInitialFocusRef.current) === null || _defaultInitialFocusR === void 0 ? void 0 : _defaultInitialFocusR.focus();
|
|
29596
|
+
} else {
|
|
29597
|
+
var _initialFocusRef$curr;
|
|
29598
|
+
// focus on the initialRef passed by the user
|
|
29599
|
+
(_initialFocusRef$curr = initialFocusRef.current) === null || _initialFocusRef$curr === void 0 ? void 0 : _initialFocusRef$curr.focus();
|
|
29600
|
+
}
|
|
29601
|
+
}, [initialFocusRef]);
|
|
29562
29602
|
var handleOnOpen = React__default.useCallback(function () {
|
|
29603
|
+
var _originalFocusElement;
|
|
29563
29604
|
setPositionY(dimensions.height * initialSnapPoint.current);
|
|
29564
29605
|
scrollLockRef.current.activate();
|
|
29565
|
-
|
|
29606
|
+
// initialize the original focused element
|
|
29607
|
+
// On first render it will be the activeElement, eg: the button trigger or select input
|
|
29608
|
+
// On Subsequent open operations it won't further update the original focus
|
|
29609
|
+
originalFocusElement.current = (_originalFocusElement = originalFocusElement.current) !== null && _originalFocusElement !== void 0 ? _originalFocusElement : document.activeElement;
|
|
29610
|
+
focusOnInitialRef();
|
|
29611
|
+
}, [dimensions.height, focusOnInitialRef, scrollLockRef, setPositionY]);
|
|
29566
29612
|
var handleOnClose = React__default.useCallback(function () {
|
|
29567
29613
|
setPositionY(0);
|
|
29568
29614
|
}, [setPositionY]);
|
|
29569
29615
|
var close = React__default.useCallback(function () {
|
|
29570
29616
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
29571
29617
|
bottomSheetAndDropdownGlue === null || bottomSheetAndDropdownGlue === void 0 ? void 0 : bottomSheetAndDropdownGlue.onBottomSheetDismiss();
|
|
29572
|
-
|
|
29618
|
+
returnFocus();
|
|
29619
|
+
}, [bottomSheetAndDropdownGlue, onDismiss, returnFocus]);
|
|
29573
29620
|
|
|
29574
29621
|
// sync controlled state to our actions
|
|
29575
29622
|
React__default.useEffect(function () {
|
|
@@ -29776,13 +29823,6 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
29776
29823
|
}
|
|
29777
29824
|
}, [isMounted, scrollLockRef]);
|
|
29778
29825
|
|
|
29779
|
-
// required by floating ui to handle focus
|
|
29780
|
-
var _useFloating = useFloating({
|
|
29781
|
-
open: isMounted
|
|
29782
|
-
}),
|
|
29783
|
-
refs = _useFloating.refs,
|
|
29784
|
-
context = _useFloating.context;
|
|
29785
|
-
|
|
29786
29826
|
// We don't want to destroy the react tree when we are rendering inside Dropdown
|
|
29787
29827
|
// Because if we bail out early then ActionList won't render,
|
|
29788
29828
|
// and Dropdown manages it's state based on the rendered JSX of ActionList
|
|
@@ -29791,48 +29831,39 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
29791
29831
|
if (!isMounted && !isInsideDropdown) {
|
|
29792
29832
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
29793
29833
|
}
|
|
29794
|
-
return /*#__PURE__*/
|
|
29834
|
+
return /*#__PURE__*/jsxs(BottomSheetContext.Provider, {
|
|
29795
29835
|
value: contextValue,
|
|
29796
|
-
children:
|
|
29797
|
-
|
|
29798
|
-
|
|
29799
|
-
|
|
29836
|
+
children: [/*#__PURE__*/jsx(BottomSheetBackdrop, {
|
|
29837
|
+
zIndex: bottomSheetZIndex
|
|
29838
|
+
}), /*#__PURE__*/jsx(BottomSheetSurface, _objectSpread$f(_objectSpread$f(_objectSpread$f({}, metaAttribute({
|
|
29839
|
+
name: MetaConstants.BottomSheet,
|
|
29840
|
+
testID: 'bottomsheet-surface'
|
|
29841
|
+
})), makeAccessible({
|
|
29800
29842
|
modal: true,
|
|
29801
|
-
|
|
29802
|
-
|
|
29803
|
-
|
|
29804
|
-
|
|
29805
|
-
|
|
29806
|
-
|
|
29807
|
-
|
|
29808
|
-
|
|
29809
|
-
|
|
29810
|
-
|
|
29811
|
-
|
|
29812
|
-
|
|
29813
|
-
|
|
29814
|
-
|
|
29815
|
-
|
|
29816
|
-
|
|
29817
|
-
|
|
29818
|
-
|
|
29819
|
-
|
|
29820
|
-
|
|
29821
|
-
|
|
29822
|
-
|
|
29823
|
-
height: "100%",
|
|
29824
|
-
display: "flex",
|
|
29825
|
-
flexDirection: "column",
|
|
29826
|
-
children: [/*#__PURE__*/jsx(BottomSheetGrabHandle, _objectSpread$f(_objectSpread$f({
|
|
29827
|
-
ref: grabHandleRef,
|
|
29828
|
-
isHeaderFloating: isHeaderFloating
|
|
29829
|
-
}, metaAttribute({
|
|
29830
|
-
name: ComponentIds.BottomSheetGrabHandle
|
|
29831
|
-
})), bind())), children]
|
|
29832
|
-
})
|
|
29833
|
-
}))]
|
|
29843
|
+
role: 'dialog'
|
|
29844
|
+
})), {}, {
|
|
29845
|
+
windowHeight: dimensions.height,
|
|
29846
|
+
isDragging: isDragging,
|
|
29847
|
+
style: {
|
|
29848
|
+
opacity: isVisible ? 1 : 0,
|
|
29849
|
+
pointerEvents: isVisible ? 'all' : 'none',
|
|
29850
|
+
height: positionY,
|
|
29851
|
+
bottom: 0,
|
|
29852
|
+
top: 'auto',
|
|
29853
|
+
zIndex: bottomSheetZIndex
|
|
29854
|
+
},
|
|
29855
|
+
children: /*#__PURE__*/jsxs(BaseBox, {
|
|
29856
|
+
height: "100%",
|
|
29857
|
+
display: "flex",
|
|
29858
|
+
flexDirection: "column",
|
|
29859
|
+
children: [/*#__PURE__*/jsx(BottomSheetGrabHandle, _objectSpread$f(_objectSpread$f({
|
|
29860
|
+
ref: grabHandleRef,
|
|
29861
|
+
isHeaderFloating: isHeaderFloating
|
|
29862
|
+
}, metaAttribute({
|
|
29863
|
+
name: ComponentIds.BottomSheetGrabHandle
|
|
29864
|
+
})), bind())), children]
|
|
29834
29865
|
})
|
|
29835
|
-
})
|
|
29866
|
+
}))]
|
|
29836
29867
|
});
|
|
29837
29868
|
};
|
|
29838
29869
|
var BottomSheet = /*#__PURE__*/assignWithoutSideEffects(_BottomSheet, {
|