@razorpay/blade 8.15.3 → 9.0.1
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 +27 -17
- package/build/components/index.native.d.ts +27 -17
- package/build/components/index.native.js +11 -11
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.web.js +66 -40
- 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/build/utils/index.d.ts +549 -1
- package/build/utils/index.native.d.ts +549 -1
- package/build/utils/index.native.js +4 -2
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/index.web.js +26 -2
- package/build/utils/index.web.js.map +1 -1
- package/package.json +1 -1
|
@@ -553,6 +553,11 @@ var getDropdownOverlayPosition = function getDropdownOverlayPosition(_ref) {
|
|
|
553
553
|
var HEIGHT_THRESHOLD = (Number(actionListItemEl === null || actionListItemEl === void 0 ? void 0 : actionListItemEl.clientHeight) + Number(size[16])) * -1;
|
|
554
554
|
|
|
555
555
|
if (!isMenu) {
|
|
556
|
+
// In SelectInput, we set position wrt to right so that leftLabel position can be accomodated
|
|
557
|
+
// without additional offset calculation from left
|
|
558
|
+
newPosition.left = undefined;
|
|
559
|
+
newPosition.right = zeroSpacing;
|
|
560
|
+
|
|
556
561
|
if (bottom > HEIGHT_THRESHOLD) {
|
|
557
562
|
newPosition.bottom = "".concat(Number(triggererEl === null || triggererEl === void 0 ? void 0 : triggererEl.clientHeight) + Number(size[32]), "px");
|
|
558
563
|
newPosition.top = undefined;
|
|
@@ -925,6 +930,30 @@ function usePrevious(value) {
|
|
|
925
930
|
return ref.current;
|
|
926
931
|
}
|
|
927
932
|
|
|
933
|
+
var ThemeContext = /*#__PURE__*/createContext({
|
|
934
|
+
// @ts-expect-error set null
|
|
935
|
+
theme: null,
|
|
936
|
+
colorScheme: 'light',
|
|
937
|
+
platform: 'onDesktop',
|
|
938
|
+
setColorScheme: function setColorScheme() {
|
|
939
|
+
return null;
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
|
|
943
|
+
var useTheme = function useTheme() {
|
|
944
|
+
var themeContext = useContext(ThemeContext);
|
|
945
|
+
|
|
946
|
+
if (!themeContext.theme) {
|
|
947
|
+
throw new Error("[@razorpay/blade:BladeProvider]: BladeProvider is missing theme");
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
if (themeContext === undefined) {
|
|
951
|
+
throw new Error("[@razorpay/blade:BladeProvider]: useTheme must be used within BladeProvider");
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
return themeContext;
|
|
955
|
+
};
|
|
956
|
+
|
|
928
957
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
929
958
|
var BottomSheetContext = /*#__PURE__*/React__default.createContext({
|
|
930
959
|
headerHeight: 0,
|
|
@@ -1370,15 +1399,19 @@ var componentIds = {
|
|
|
1370
1399
|
ActionListSection: 'ActionListSection'
|
|
1371
1400
|
};
|
|
1372
1401
|
|
|
1373
|
-
/* eslint-disable
|
|
1402
|
+
/* eslint-disable no-restricted-properties */
|
|
1374
1403
|
/**
|
|
1375
1404
|
* Gets the `componentId` prop of React component if it exists.
|
|
1376
1405
|
*/
|
|
1377
1406
|
|
|
1378
1407
|
var getComponentId = function getComponentId(component) {
|
|
1379
|
-
var _component$type;
|
|
1408
|
+
var _component$props, _component$props2, _component$props2$ori, _component$type;
|
|
1380
1409
|
|
|
1381
|
-
if (! /*#__PURE__*/React__default.isValidElement(component)) return null; //
|
|
1410
|
+
if (! /*#__PURE__*/React__default.isValidElement(component)) return null; // Storybook wraps MDX components in a wrapper component, so we need to get componentId from originalType
|
|
1411
|
+
|
|
1412
|
+
if (component !== null && component !== void 0 && (_component$props = component.props) !== null && _component$props !== void 0 && _component$props.mdxType && component !== null && component !== void 0 && (_component$props2 = component.props) !== null && _component$props2 !== void 0 && (_component$props2$ori = _component$props2.originalType) !== null && _component$props2$ori !== void 0 && _component$props2$ori.componentId) {
|
|
1413
|
+
return component.props.originalType.componentId;
|
|
1414
|
+
}
|
|
1382
1415
|
|
|
1383
1416
|
return (_component$type = component.type) === null || _component$type === void 0 ? void 0 : _component$type.componentId;
|
|
1384
1417
|
};
|
|
@@ -3723,30 +3756,6 @@ var getBaseBoxStyles = function getBaseBoxStyles(props) {
|
|
|
3723
3756
|
return _objectSpread$5Z(_objectSpread$5Z({}, getAllProps(props)), getAllMediaQueries(props));
|
|
3724
3757
|
};
|
|
3725
3758
|
|
|
3726
|
-
var ThemeContext = /*#__PURE__*/createContext({
|
|
3727
|
-
// @ts-expect-error set null
|
|
3728
|
-
theme: null,
|
|
3729
|
-
colorScheme: 'light',
|
|
3730
|
-
platform: 'onDesktop',
|
|
3731
|
-
setColorScheme: function setColorScheme() {
|
|
3732
|
-
return null;
|
|
3733
|
-
}
|
|
3734
|
-
});
|
|
3735
|
-
|
|
3736
|
-
var useTheme = function useTheme() {
|
|
3737
|
-
var themeContext = useContext(ThemeContext);
|
|
3738
|
-
|
|
3739
|
-
if (!themeContext.theme) {
|
|
3740
|
-
throw new Error("[@razorpay/blade:BladeProvider]: BladeProvider is missing theme");
|
|
3741
|
-
}
|
|
3742
|
-
|
|
3743
|
-
if (themeContext === undefined) {
|
|
3744
|
-
throw new Error("[@razorpay/blade:BladeProvider]: useTheme must be used within BladeProvider");
|
|
3745
|
-
}
|
|
3746
|
-
|
|
3747
|
-
return themeContext;
|
|
3748
|
-
};
|
|
3749
|
-
|
|
3750
3759
|
function ownKeys$5Z(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3751
3760
|
|
|
3752
3761
|
function _objectSpread$5Y(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5Z(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5Z(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -16725,6 +16734,8 @@ var _Checkbox = function _Checkbox(_ref, ref) {
|
|
|
16725
16734
|
|
|
16726
16735
|
var _isDisabled = isDisabled !== null && isDisabled !== void 0 ? isDisabled : groupProps === null || groupProps === void 0 ? void 0 : groupProps.isDisabled;
|
|
16727
16736
|
|
|
16737
|
+
var _isRequired = Boolean(isRequired || (groupProps === null || groupProps === void 0 ? void 0 : groupProps.isRequired) || (groupProps === null || groupProps === void 0 ? void 0 : groupProps.necessityIndicator) === 'required');
|
|
16738
|
+
|
|
16728
16739
|
var _name = name !== null && name !== void 0 ? name : groupProps === null || groupProps === void 0 ? void 0 : groupProps.name; // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
16729
16740
|
|
|
16730
16741
|
|
|
@@ -16766,7 +16777,7 @@ var _Checkbox = function _Checkbox(_ref, ref) {
|
|
|
16766
16777
|
hasError: _hasError,
|
|
16767
16778
|
hasHelperText: Boolean(showSupportingText),
|
|
16768
16779
|
isDisabled: _isDisabled,
|
|
16769
|
-
isRequired:
|
|
16780
|
+
isRequired: _isRequired,
|
|
16770
16781
|
name: _name,
|
|
16771
16782
|
value: value,
|
|
16772
16783
|
onChange: handleChange
|
|
@@ -16832,10 +16843,12 @@ var useCheckboxGroup = function useCheckboxGroup(_ref) {
|
|
|
16832
16843
|
var value = _ref.value,
|
|
16833
16844
|
defaultValue = _ref.defaultValue,
|
|
16834
16845
|
isDisabled = _ref.isDisabled,
|
|
16846
|
+
isRequired = _ref.isRequired,
|
|
16835
16847
|
labelPosition = _ref.labelPosition,
|
|
16836
16848
|
_onChange = _ref.onChange,
|
|
16837
16849
|
validationState = _ref.validationState,
|
|
16838
16850
|
name = _ref.name,
|
|
16851
|
+
necessityIndicator = _ref.necessityIndicator,
|
|
16839
16852
|
size = _ref.size;
|
|
16840
16853
|
|
|
16841
16854
|
var _useTheme = useTheme(),
|
|
@@ -16914,12 +16927,14 @@ var useCheckboxGroup = function useCheckboxGroup(_ref) {
|
|
|
16914
16927
|
return {
|
|
16915
16928
|
validationState: validationState,
|
|
16916
16929
|
isDisabled: isDisabled,
|
|
16930
|
+
isRequired: isRequired,
|
|
16917
16931
|
labelPosition: platform === 'onMobile' ? 'top' : labelPosition,
|
|
16918
16932
|
name: name,
|
|
16933
|
+
necessityIndicator: necessityIndicator,
|
|
16919
16934
|
state: state,
|
|
16920
16935
|
size: size
|
|
16921
16936
|
};
|
|
16922
|
-
}, [validationState, isDisabled, platform, labelPosition, name, state, size]);
|
|
16937
|
+
}, [validationState, isDisabled, isRequired, platform, labelPosition, name, necessityIndicator, state, size]);
|
|
16923
16938
|
return {
|
|
16924
16939
|
state: state,
|
|
16925
16940
|
contextValue: contextValue,
|
|
@@ -16959,7 +16974,7 @@ var SelectorGroupField = function SelectorGroupField(_ref) {
|
|
|
16959
16974
|
}));
|
|
16960
16975
|
};
|
|
16961
16976
|
|
|
16962
|
-
var _excluded$u = ["children", "label", "helpText", "isDisabled", "necessityIndicator", "labelPosition", "validationState", "errorText", "name", "defaultValue", "onChange", "value", "size", "testID"];
|
|
16977
|
+
var _excluded$u = ["children", "label", "helpText", "isDisabled", "isRequired", "necessityIndicator", "labelPosition", "validationState", "errorText", "name", "defaultValue", "onChange", "value", "size", "testID"];
|
|
16963
16978
|
|
|
16964
16979
|
function ownKeys$1c(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16965
16980
|
|
|
@@ -16969,7 +16984,10 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
|
16969
16984
|
var children = _ref.children,
|
|
16970
16985
|
label = _ref.label,
|
|
16971
16986
|
helpText = _ref.helpText,
|
|
16972
|
-
isDisabled = _ref.isDisabled,
|
|
16987
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
16988
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
16989
|
+
_ref$isRequired = _ref.isRequired,
|
|
16990
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired,
|
|
16973
16991
|
_ref$necessityIndicat = _ref.necessityIndicator,
|
|
16974
16992
|
necessityIndicator = _ref$necessityIndicat === void 0 ? 'none' : _ref$necessityIndicat,
|
|
16975
16993
|
_ref$labelPosition = _ref.labelPosition,
|
|
@@ -16990,6 +17008,8 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
|
16990
17008
|
onChange: onChange,
|
|
16991
17009
|
value: value,
|
|
16992
17010
|
isDisabled: isDisabled,
|
|
17011
|
+
necessityIndicator: necessityIndicator,
|
|
17012
|
+
isRequired: isRequired,
|
|
16993
17013
|
name: name,
|
|
16994
17014
|
labelPosition: labelPosition,
|
|
16995
17015
|
validationState: validationState,
|
|
@@ -21965,8 +21985,10 @@ var BaseInput = /*#__PURE__*/React__default.forwardRef(function (_ref11, ref) {
|
|
|
21965
21985
|
currentInteraction = _useInteraction.currentInteraction,
|
|
21966
21986
|
setCurrentInteraction = _useInteraction.setCurrentInteraction;
|
|
21967
21987
|
|
|
21988
|
+
var _isRequired = isRequired || necessityIndicator === 'required';
|
|
21989
|
+
|
|
21968
21990
|
var accessibilityProps = makeAccessible({
|
|
21969
|
-
required: Boolean(
|
|
21991
|
+
required: Boolean(_isRequired),
|
|
21970
21992
|
disabled: Boolean(isDisabled),
|
|
21971
21993
|
invalid: Boolean(validationState === 'error'),
|
|
21972
21994
|
describedBy: getDescribedByElementId({
|
|
@@ -22039,7 +22061,7 @@ var BaseInput = /*#__PURE__*/React__default.forwardRef(function (_ref11, ref) {
|
|
|
22039
22061
|
placeholder: placeholder,
|
|
22040
22062
|
isDisabled: isDisabled,
|
|
22041
22063
|
validationState: validationState,
|
|
22042
|
-
isRequired:
|
|
22064
|
+
isRequired: _isRequired,
|
|
22043
22065
|
handleOnFocus: handleOnFocus,
|
|
22044
22066
|
handleOnChange: handleOnChange,
|
|
22045
22067
|
handleOnBlur: handleOnBlur,
|
|
@@ -22723,9 +22745,6 @@ var OTPInput = function OTPInput(_ref) {
|
|
|
22723
22745
|
errorTextId = _useFormId.errorTextId,
|
|
22724
22746
|
successTextId = _useFormId.successTextId;
|
|
22725
22747
|
|
|
22726
|
-
var _useTheme = useTheme(),
|
|
22727
|
-
platform = _useTheme.platform;
|
|
22728
|
-
|
|
22729
22748
|
useEffect(function () {
|
|
22730
22749
|
// Effect for calling `onOTPFilled` callback
|
|
22731
22750
|
if (inputValue && inputValue.length >= otpLength) {
|
|
@@ -22920,7 +22939,6 @@ var OTPInput = function OTPInput(_ref) {
|
|
|
22920
22939
|
inputs.push( /*#__PURE__*/jsx(BaseBox, {
|
|
22921
22940
|
flex: 1,
|
|
22922
22941
|
marginLeft: index == 0 ? 'spacing.0' : 'spacing.3',
|
|
22923
|
-
maxWidth: platform === 'onDesktop' ? makeSize(size[36]) : makeSize(size[40]),
|
|
22924
22942
|
children: /*#__PURE__*/jsx(BaseInput // eslint-disable-next-line jsx-a11y/no-autofocus
|
|
22925
22943
|
, {
|
|
22926
22944
|
autoFocus: autoFocus && index === 0,
|
|
@@ -25011,6 +25029,8 @@ var _Radio = function _Radio(_ref, ref) {
|
|
|
25011
25029
|
|
|
25012
25030
|
var _isDisabled = isDisabled !== null && isDisabled !== void 0 ? isDisabled : groupProps === null || groupProps === void 0 ? void 0 : groupProps.isDisabled;
|
|
25013
25031
|
|
|
25032
|
+
var _isRequired = (groupProps === null || groupProps === void 0 ? void 0 : groupProps.isRequired) || (groupProps === null || groupProps === void 0 ? void 0 : groupProps.necessityIndicator) === 'required';
|
|
25033
|
+
|
|
25014
25034
|
var name = groupProps === null || groupProps === void 0 ? void 0 : groupProps.name;
|
|
25015
25035
|
var showHelpText = !hasError && helpText;
|
|
25016
25036
|
var isReactNative = getPlatformType() === 'react-native';
|
|
@@ -25039,7 +25059,7 @@ var _Radio = function _Radio(_ref, ref) {
|
|
|
25039
25059
|
isChecked: isChecked,
|
|
25040
25060
|
hasError: hasError,
|
|
25041
25061
|
isDisabled: _isDisabled,
|
|
25042
|
-
isRequired:
|
|
25062
|
+
isRequired: _isRequired,
|
|
25043
25063
|
name: name,
|
|
25044
25064
|
value: value,
|
|
25045
25065
|
onChange: handleChange
|
|
@@ -25097,6 +25117,7 @@ var useRadioGroup = function useRadioGroup(_ref) {
|
|
|
25097
25117
|
var value = _ref.value,
|
|
25098
25118
|
defaultValue = _ref.defaultValue,
|
|
25099
25119
|
isDisabled = _ref.isDisabled,
|
|
25120
|
+
isRequired = _ref.isRequired,
|
|
25100
25121
|
labelPosition = _ref.labelPosition,
|
|
25101
25122
|
_onChange = _ref.onChange,
|
|
25102
25123
|
validationState = _ref.validationState,
|
|
@@ -25165,12 +25186,13 @@ var useRadioGroup = function useRadioGroup(_ref) {
|
|
|
25165
25186
|
necessityIndicator: necessityIndicator,
|
|
25166
25187
|
validationState: validationState,
|
|
25167
25188
|
isDisabled: isDisabled,
|
|
25189
|
+
isRequired: isRequired,
|
|
25168
25190
|
labelPosition: platform === 'onMobile' ? 'top' : labelPosition,
|
|
25169
25191
|
name: fallbackName,
|
|
25170
25192
|
state: state,
|
|
25171
25193
|
size: size
|
|
25172
25194
|
};
|
|
25173
|
-
}, [validationState, isDisabled, platform, labelPosition, state, fallbackName, necessityIndicator, size]);
|
|
25195
|
+
}, [validationState, isDisabled, isRequired, platform, labelPosition, state, fallbackName, necessityIndicator, size]);
|
|
25174
25196
|
return {
|
|
25175
25197
|
state: state,
|
|
25176
25198
|
contextValue: contextValue,
|
|
@@ -25180,7 +25202,7 @@ var useRadioGroup = function useRadioGroup(_ref) {
|
|
|
25180
25202
|
};
|
|
25181
25203
|
};
|
|
25182
25204
|
|
|
25183
|
-
var _excluded$4 = ["children", "label", "helpText", "isDisabled", "necessityIndicator", "labelPosition", "validationState", "errorText", "name", "defaultValue", "onChange", "value", "size", "testID"];
|
|
25205
|
+
var _excluded$4 = ["children", "label", "helpText", "isDisabled", "isRequired", "necessityIndicator", "labelPosition", "validationState", "errorText", "name", "defaultValue", "onChange", "value", "size", "testID"];
|
|
25184
25206
|
|
|
25185
25207
|
function ownKeys$r(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25186
25208
|
|
|
@@ -25192,6 +25214,8 @@ var RadioGroup = function RadioGroup(_ref) {
|
|
|
25192
25214
|
helpText = _ref.helpText,
|
|
25193
25215
|
_ref$isDisabled = _ref.isDisabled,
|
|
25194
25216
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
25217
|
+
_ref$isRequired = _ref.isRequired,
|
|
25218
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired,
|
|
25195
25219
|
_ref$necessityIndicat = _ref.necessityIndicator,
|
|
25196
25220
|
necessityIndicator = _ref$necessityIndicat === void 0 ? 'none' : _ref$necessityIndicat,
|
|
25197
25221
|
_ref$labelPosition = _ref.labelPosition,
|
|
@@ -25211,8 +25235,10 @@ var RadioGroup = function RadioGroup(_ref) {
|
|
|
25211
25235
|
var _useRadioGroup = useRadioGroup({
|
|
25212
25236
|
defaultValue: defaultValue,
|
|
25213
25237
|
isDisabled: isDisabled,
|
|
25238
|
+
isRequired: isRequired,
|
|
25214
25239
|
labelPosition: labelPosition,
|
|
25215
25240
|
name: name,
|
|
25241
|
+
necessityIndicator: necessityIndicator,
|
|
25216
25242
|
onChange: onChange,
|
|
25217
25243
|
validationState: validationState,
|
|
25218
25244
|
value: value,
|