@razorpay/blade 8.11.0 → 8.11.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.d.ts +1 -1
- package/build/components/index.native.d.ts +1 -1
- package/build/components/index.native.js +1 -1
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.web.js +54 -44
- package/build/components/index.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
|
@@ -5,7 +5,7 @@ import _typeof from '@babel/runtime/helpers/typeof';
|
|
|
5
5
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
6
|
import styled, { ThemeProvider, css, keyframes } from 'styled-components';
|
|
7
7
|
import _objectWithoutProperties$1 from '@babel/runtime/helpers/objectWithoutProperties';
|
|
8
|
-
import { FloatingDelayGroup, detectOverflow, useFloating, FloatingOverlay, FloatingPortal, FloatingFocusManager, shift, flip, offset, arrow,
|
|
8
|
+
import { FloatingDelayGroup, detectOverflow, useFloating, autoUpdate, FloatingOverlay, FloatingPortal, FloatingFocusManager, shift, flip, offset, arrow, useTransitionStyles, useDelayGroup, useDelayGroupContext, useHover, useFocus, useRole, useInteractions, FloatingArrow } from '@floating-ui/react';
|
|
9
9
|
import _toConsumableArray$1 from '@babel/runtime/helpers/toConsumableArray';
|
|
10
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
@@ -5093,60 +5093,66 @@ var makeInputDisplayValue = function makeInputDisplayValue(selectedIndices, opti
|
|
|
5093
5093
|
return "".concat(selectedIndices.length, " items selected");
|
|
5094
5094
|
};
|
|
5095
5095
|
|
|
5096
|
-
/**
|
|
5097
|
-
* This object is used for calculating overflows in dropdown overlay.
|
|
5098
|
-
* 400 is used since max-width of dropdown overlay is 400px.
|
|
5099
|
-
*/
|
|
5100
|
-
var POSITION_THRESHOLDS = {
|
|
5101
|
-
top: -400,
|
|
5102
|
-
bottom: -300,
|
|
5103
|
-
left: -400,
|
|
5104
|
-
right: -400
|
|
5105
|
-
};
|
|
5106
5096
|
/**
|
|
5107
5097
|
* This function calculates the position of dropdown overlay with respect to dropdown trigger element.
|
|
5108
5098
|
* For non-menus (e.g SelectInput), position is flipped if overflow is on bottom.
|
|
5109
5099
|
* For menus (e.g. DropdownButton), position is flipped if overflow is on right or bottom.
|
|
5110
5100
|
* Additional spacing is added to clientHeight to provide spacing above the dropdown trigger.
|
|
5111
5101
|
*/
|
|
5112
|
-
|
|
5113
5102
|
var getDropdownOverlayPosition = function getDropdownOverlayPosition(_ref) {
|
|
5114
5103
|
var position = _ref.overflow,
|
|
5115
5104
|
isMenu = _ref.isMenu,
|
|
5116
|
-
triggererEl = _ref.triggererEl
|
|
5105
|
+
triggererEl = _ref.triggererEl,
|
|
5106
|
+
actionListItemEl = _ref.actionListItemEl;
|
|
5117
5107
|
var zeroSpacing = 'spacing.0';
|
|
5118
|
-
var
|
|
5108
|
+
var top = position.top,
|
|
5109
|
+
bottom = position.bottom,
|
|
5119
5110
|
right = position.right;
|
|
5120
5111
|
var newPosition = {
|
|
5121
5112
|
left: zeroSpacing
|
|
5122
5113
|
};
|
|
5114
|
+
/**
|
|
5115
|
+
* Calculating thresholds using the height & width of action list element with offset of 16px
|
|
5116
|
+
*/
|
|
5117
|
+
|
|
5118
|
+
var WIDTH_THRESHOLD = (Number(actionListItemEl === null || actionListItemEl === void 0 ? void 0 : actionListItemEl.clientWidth) + Number(size[16])) * -1;
|
|
5119
|
+
var HEIGHT_THRESHOLD = (Number(actionListItemEl === null || actionListItemEl === void 0 ? void 0 : actionListItemEl.clientHeight) + Number(size[16])) * -1;
|
|
5123
5120
|
|
|
5124
5121
|
if (!isMenu) {
|
|
5125
|
-
if (bottom >
|
|
5122
|
+
if (bottom > HEIGHT_THRESHOLD) {
|
|
5126
5123
|
newPosition.bottom = "".concat(Number(triggererEl === null || triggererEl === void 0 ? void 0 : triggererEl.clientHeight) + Number(size[32]), "px");
|
|
5124
|
+
newPosition.top = undefined;
|
|
5125
|
+
}
|
|
5126
|
+
|
|
5127
|
+
if (top > HEIGHT_THRESHOLD) {
|
|
5128
|
+
newPosition.top = zeroSpacing;
|
|
5129
|
+
newPosition.bottom = undefined;
|
|
5127
5130
|
}
|
|
5128
5131
|
|
|
5129
|
-
console.log({
|
|
5130
|
-
newPosition: newPosition
|
|
5131
|
-
});
|
|
5132
5132
|
return newPosition;
|
|
5133
5133
|
}
|
|
5134
5134
|
|
|
5135
|
-
if (right >
|
|
5135
|
+
if (right > WIDTH_THRESHOLD) {
|
|
5136
5136
|
newPosition.right = zeroSpacing;
|
|
5137
5137
|
newPosition.left = undefined;
|
|
5138
5138
|
}
|
|
5139
5139
|
|
|
5140
|
-
if (bottom >
|
|
5140
|
+
if (bottom > HEIGHT_THRESHOLD) {
|
|
5141
5141
|
newPosition.bottom = "".concat(Number(triggererEl === null || triggererEl === void 0 ? void 0 : triggererEl.clientHeight) + Number(size[20]), "px");
|
|
5142
5142
|
newPosition.top = undefined;
|
|
5143
5143
|
}
|
|
5144
5144
|
|
|
5145
|
+
if (top > HEIGHT_THRESHOLD) {
|
|
5146
|
+
newPosition.top = zeroSpacing;
|
|
5147
|
+
newPosition.bottom = undefined;
|
|
5148
|
+
}
|
|
5149
|
+
|
|
5145
5150
|
return newPosition;
|
|
5146
5151
|
};
|
|
5147
5152
|
var getDropdownOverflowMiddleware = function getDropdownOverflowMiddleware(_ref2) {
|
|
5148
5153
|
var isMenu = _ref2.isMenu,
|
|
5149
5154
|
triggererRef = _ref2.triggererRef,
|
|
5155
|
+
actionListItemRef = _ref2.actionListItemRef,
|
|
5150
5156
|
setDropdownPosition = _ref2.setDropdownPosition;
|
|
5151
5157
|
return {
|
|
5152
5158
|
name: 'detectOverflowMiddleware',
|
|
@@ -5167,7 +5173,8 @@ var getDropdownOverflowMiddleware = function getDropdownOverflowMiddleware(_ref2
|
|
|
5167
5173
|
position = getDropdownOverlayPosition({
|
|
5168
5174
|
overflow: overflow,
|
|
5169
5175
|
isMenu: isMenu,
|
|
5170
|
-
triggererEl: triggererRef.current
|
|
5176
|
+
triggererEl: triggererRef.current,
|
|
5177
|
+
actionListItemEl: actionListItemRef.current
|
|
5171
5178
|
});
|
|
5172
5179
|
setDropdownPosition(position);
|
|
5173
5180
|
return _context.abrupt("return", {});
|
|
@@ -5722,15 +5729,15 @@ var getBaseTextStyles = function getBaseTextStyles(_ref) {
|
|
|
5722
5729
|
if (numberOfLines !== undefined) {
|
|
5723
5730
|
if (isReactNative$4()) {
|
|
5724
5731
|
truncateStyles = {};
|
|
5732
|
+
} else {
|
|
5733
|
+
truncateStyles = {
|
|
5734
|
+
overflow: 'hidden',
|
|
5735
|
+
display: '-webkit-box',
|
|
5736
|
+
'line-clamp': "".concat(numberOfLines),
|
|
5737
|
+
'-webkit-line-clamp': "".concat(numberOfLines),
|
|
5738
|
+
'-webkit-box-orient': 'vertical'
|
|
5739
|
+
};
|
|
5725
5740
|
}
|
|
5726
|
-
|
|
5727
|
-
truncateStyles = {
|
|
5728
|
-
overflow: 'hidden',
|
|
5729
|
-
display: '-webkit-box',
|
|
5730
|
-
'line-clamp': "".concat(numberOfLines),
|
|
5731
|
-
'-webkit-line-clamp': "".concat(numberOfLines),
|
|
5732
|
-
'-webkit-box-orient': 'vertical'
|
|
5733
|
-
};
|
|
5734
5741
|
}
|
|
5735
5742
|
|
|
5736
5743
|
return _objectSpread$5E({
|
|
@@ -21803,7 +21810,7 @@ var StyledDropdownOverlay = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
21803
21810
|
displayName: "DropdownOverlayweb__StyledDropdownOverlay",
|
|
21804
21811
|
componentId: "sc-9pwxtx-0"
|
|
21805
21812
|
})(function (props) {
|
|
21806
|
-
return css(["", " transform:translateY(", ");opacity:0;z-index:99;"], props.transition, makeSize(props.theme.spacing[3]));
|
|
21813
|
+
return css(["", " transform:translateY(", ");opacity:0;z-index:99;pointer-events:", ";"], props.transition, makeSize(props.theme.spacing[3]), props.isOpen ? 'all' : 'none');
|
|
21807
21814
|
});
|
|
21808
21815
|
|
|
21809
21816
|
/**
|
|
@@ -21820,25 +21827,26 @@ var _DropdownOverlay = function _DropdownOverlay(_ref) {
|
|
|
21820
21827
|
triggererRef = _useDropdown.triggererRef,
|
|
21821
21828
|
hasLabelOnLeft = _useDropdown.hasLabelOnLeft,
|
|
21822
21829
|
dropdownTriggerer = _useDropdown.dropdownTriggerer,
|
|
21823
|
-
setIsOpen = _useDropdown.setIsOpen
|
|
21830
|
+
setIsOpen = _useDropdown.setIsOpen,
|
|
21831
|
+
actionListItemRef = _useDropdown.actionListItemRef;
|
|
21824
21832
|
|
|
21825
21833
|
var _useTheme = useTheme(),
|
|
21826
21834
|
theme = _useTheme.theme;
|
|
21827
21835
|
|
|
21828
|
-
var _React$useState = React__default.useState(
|
|
21836
|
+
var _React$useState = React__default.useState(false),
|
|
21829
21837
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
21830
|
-
|
|
21831
|
-
|
|
21838
|
+
showFadeOutAnimation = _React$useState2[0],
|
|
21839
|
+
setShowFadeOutAnimation = _React$useState2[1];
|
|
21832
21840
|
|
|
21833
21841
|
var _React$useState3 = React__default.useState('100%'),
|
|
21834
21842
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
21835
21843
|
width = _React$useState4[0],
|
|
21836
21844
|
setWidth = _React$useState4[1];
|
|
21837
21845
|
|
|
21838
|
-
var
|
|
21839
|
-
|
|
21840
|
-
dropdownPosition =
|
|
21841
|
-
setDropdownPosition =
|
|
21846
|
+
var _React$useState5 = React__default.useState({}),
|
|
21847
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
21848
|
+
dropdownPosition = _React$useState6[0],
|
|
21849
|
+
setDropdownPosition = _React$useState6[1];
|
|
21842
21850
|
|
|
21843
21851
|
var isMenu = dropdownTriggerer !== 'SelectInput';
|
|
21844
21852
|
|
|
@@ -21853,20 +21861,22 @@ var _DropdownOverlay = function _DropdownOverlay(_ref) {
|
|
|
21853
21861
|
middleware: [getDropdownOverflowMiddleware({
|
|
21854
21862
|
isMenu: isMenu,
|
|
21855
21863
|
triggererRef: triggererRef,
|
|
21864
|
+
actionListItemRef: actionListItemRef,
|
|
21856
21865
|
setDropdownPosition: setDropdownPosition
|
|
21857
|
-
})]
|
|
21866
|
+
})],
|
|
21867
|
+
whileElementsMounted: autoUpdate
|
|
21858
21868
|
}),
|
|
21859
21869
|
refs = _useFloating.refs;
|
|
21860
21870
|
|
|
21861
21871
|
var fadeIn = /*#__PURE__*/css(["animation:", " ", " ", ";"], dropdownFadeIn, makeMotionTime(theme.motion.duration.quick), String(theme.motion.easing.entrance.revealing));
|
|
21862
21872
|
var fadeOut = /*#__PURE__*/css(["animation:", " ", " ", ";"], dropdownFadeOut, makeMotionTime(theme.motion.duration.quick), String(theme.motion.easing.entrance.revealing));
|
|
21873
|
+
var noAnimation = /*#__PURE__*/css(["animation:none;"]);
|
|
21863
21874
|
React__default.useEffect(function () {
|
|
21864
21875
|
if (isOpen) {
|
|
21865
21876
|
var _triggererRef$current;
|
|
21866
21877
|
|
|
21867
21878
|
// On Safari clicking on a non input element doesn't focuses it https://bugs.webkit.org/show_bug.cgi?id=22261
|
|
21868
21879
|
(_triggererRef$current = triggererRef.current) === null || _triggererRef$current === void 0 ? void 0 : _triggererRef$current.focus();
|
|
21869
|
-
setDisplay('block');
|
|
21870
21880
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21871
21881
|
|
|
21872
21882
|
}, [isOpen]); // We want to set width of overlay as per width of the SelectInput
|
|
@@ -21903,9 +21913,9 @@ var _DropdownOverlay = function _DropdownOverlay(_ref) {
|
|
|
21903
21913
|
}, [setWidth, triggererRef, hasLabelOnLeft]);
|
|
21904
21914
|
var onAnimationEnd = React__default.useCallback(function () {
|
|
21905
21915
|
if (isOpen) {
|
|
21906
|
-
|
|
21916
|
+
setShowFadeOutAnimation(true);
|
|
21907
21917
|
} else {
|
|
21908
|
-
|
|
21918
|
+
setShowFadeOutAnimation(false);
|
|
21909
21919
|
}
|
|
21910
21920
|
}, [isOpen]);
|
|
21911
21921
|
var styles = React__default.useMemo(function () {
|
|
@@ -21929,9 +21939,9 @@ var _DropdownOverlay = function _DropdownOverlay(_ref) {
|
|
|
21929
21939
|
right: dropdownPosition.right,
|
|
21930
21940
|
bottom: dropdownPosition.bottom,
|
|
21931
21941
|
style: styles,
|
|
21932
|
-
|
|
21942
|
+
isOpen: isOpen,
|
|
21933
21943
|
position: "absolute",
|
|
21934
|
-
transition: isOpen ? fadeIn : fadeOut,
|
|
21944
|
+
transition: isOpen ? fadeIn : showFadeOutAnimation ? fadeOut : noAnimation,
|
|
21935
21945
|
onAnimationEnd: onAnimationEnd
|
|
21936
21946
|
}, metaAttribute({
|
|
21937
21947
|
name: MetaConstants.DropdownOverlay,
|