@razorpay/blade 8.15.2 → 9.0.0
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 +10 -10
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.web.js +56 -39
- 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
|
@@ -925,6 +925,30 @@ function usePrevious(value) {
|
|
|
925
925
|
return ref.current;
|
|
926
926
|
}
|
|
927
927
|
|
|
928
|
+
var ThemeContext = /*#__PURE__*/createContext({
|
|
929
|
+
// @ts-expect-error set null
|
|
930
|
+
theme: null,
|
|
931
|
+
colorScheme: 'light',
|
|
932
|
+
platform: 'onDesktop',
|
|
933
|
+
setColorScheme: function setColorScheme() {
|
|
934
|
+
return null;
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
|
|
938
|
+
var useTheme = function useTheme() {
|
|
939
|
+
var themeContext = useContext(ThemeContext);
|
|
940
|
+
|
|
941
|
+
if (!themeContext.theme) {
|
|
942
|
+
throw new Error("[@razorpay/blade:BladeProvider]: BladeProvider is missing theme");
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
if (themeContext === undefined) {
|
|
946
|
+
throw new Error("[@razorpay/blade:BladeProvider]: useTheme must be used within BladeProvider");
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
return themeContext;
|
|
950
|
+
};
|
|
951
|
+
|
|
928
952
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
929
953
|
var BottomSheetContext = /*#__PURE__*/React__default.createContext({
|
|
930
954
|
headerHeight: 0,
|
|
@@ -3723,30 +3747,6 @@ var getBaseBoxStyles = function getBaseBoxStyles(props) {
|
|
|
3723
3747
|
return _objectSpread$5Z(_objectSpread$5Z({}, getAllProps(props)), getAllMediaQueries(props));
|
|
3724
3748
|
};
|
|
3725
3749
|
|
|
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
3750
|
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
3751
|
|
|
3752
3752
|
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 +16725,8 @@ var _Checkbox = function _Checkbox(_ref, ref) {
|
|
|
16725
16725
|
|
|
16726
16726
|
var _isDisabled = isDisabled !== null && isDisabled !== void 0 ? isDisabled : groupProps === null || groupProps === void 0 ? void 0 : groupProps.isDisabled;
|
|
16727
16727
|
|
|
16728
|
+
var _isRequired = Boolean(isRequired || (groupProps === null || groupProps === void 0 ? void 0 : groupProps.isRequired) || (groupProps === null || groupProps === void 0 ? void 0 : groupProps.necessityIndicator) === 'required');
|
|
16729
|
+
|
|
16728
16730
|
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
16731
|
|
|
16730
16732
|
|
|
@@ -16766,7 +16768,7 @@ var _Checkbox = function _Checkbox(_ref, ref) {
|
|
|
16766
16768
|
hasError: _hasError,
|
|
16767
16769
|
hasHelperText: Boolean(showSupportingText),
|
|
16768
16770
|
isDisabled: _isDisabled,
|
|
16769
|
-
isRequired:
|
|
16771
|
+
isRequired: _isRequired,
|
|
16770
16772
|
name: _name,
|
|
16771
16773
|
value: value,
|
|
16772
16774
|
onChange: handleChange
|
|
@@ -16832,10 +16834,12 @@ var useCheckboxGroup = function useCheckboxGroup(_ref) {
|
|
|
16832
16834
|
var value = _ref.value,
|
|
16833
16835
|
defaultValue = _ref.defaultValue,
|
|
16834
16836
|
isDisabled = _ref.isDisabled,
|
|
16837
|
+
isRequired = _ref.isRequired,
|
|
16835
16838
|
labelPosition = _ref.labelPosition,
|
|
16836
16839
|
_onChange = _ref.onChange,
|
|
16837
16840
|
validationState = _ref.validationState,
|
|
16838
16841
|
name = _ref.name,
|
|
16842
|
+
necessityIndicator = _ref.necessityIndicator,
|
|
16839
16843
|
size = _ref.size;
|
|
16840
16844
|
|
|
16841
16845
|
var _useTheme = useTheme(),
|
|
@@ -16914,12 +16918,14 @@ var useCheckboxGroup = function useCheckboxGroup(_ref) {
|
|
|
16914
16918
|
return {
|
|
16915
16919
|
validationState: validationState,
|
|
16916
16920
|
isDisabled: isDisabled,
|
|
16921
|
+
isRequired: isRequired,
|
|
16917
16922
|
labelPosition: platform === 'onMobile' ? 'top' : labelPosition,
|
|
16918
16923
|
name: name,
|
|
16924
|
+
necessityIndicator: necessityIndicator,
|
|
16919
16925
|
state: state,
|
|
16920
16926
|
size: size
|
|
16921
16927
|
};
|
|
16922
|
-
}, [validationState, isDisabled, platform, labelPosition, name, state, size]);
|
|
16928
|
+
}, [validationState, isDisabled, isRequired, platform, labelPosition, name, necessityIndicator, state, size]);
|
|
16923
16929
|
return {
|
|
16924
16930
|
state: state,
|
|
16925
16931
|
contextValue: contextValue,
|
|
@@ -16959,7 +16965,7 @@ var SelectorGroupField = function SelectorGroupField(_ref) {
|
|
|
16959
16965
|
}));
|
|
16960
16966
|
};
|
|
16961
16967
|
|
|
16962
|
-
var _excluded$u = ["children", "label", "helpText", "isDisabled", "necessityIndicator", "labelPosition", "validationState", "errorText", "name", "defaultValue", "onChange", "value", "size", "testID"];
|
|
16968
|
+
var _excluded$u = ["children", "label", "helpText", "isDisabled", "isRequired", "necessityIndicator", "labelPosition", "validationState", "errorText", "name", "defaultValue", "onChange", "value", "size", "testID"];
|
|
16963
16969
|
|
|
16964
16970
|
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
16971
|
|
|
@@ -16969,7 +16975,10 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
|
16969
16975
|
var children = _ref.children,
|
|
16970
16976
|
label = _ref.label,
|
|
16971
16977
|
helpText = _ref.helpText,
|
|
16972
|
-
isDisabled = _ref.isDisabled,
|
|
16978
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
16979
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
16980
|
+
_ref$isRequired = _ref.isRequired,
|
|
16981
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired,
|
|
16973
16982
|
_ref$necessityIndicat = _ref.necessityIndicator,
|
|
16974
16983
|
necessityIndicator = _ref$necessityIndicat === void 0 ? 'none' : _ref$necessityIndicat,
|
|
16975
16984
|
_ref$labelPosition = _ref.labelPosition,
|
|
@@ -16990,6 +16999,8 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
|
16990
16999
|
onChange: onChange,
|
|
16991
17000
|
value: value,
|
|
16992
17001
|
isDisabled: isDisabled,
|
|
17002
|
+
necessityIndicator: necessityIndicator,
|
|
17003
|
+
isRequired: isRequired,
|
|
16993
17004
|
name: name,
|
|
16994
17005
|
labelPosition: labelPosition,
|
|
16995
17006
|
validationState: validationState,
|
|
@@ -21965,8 +21976,10 @@ var BaseInput = /*#__PURE__*/React__default.forwardRef(function (_ref11, ref) {
|
|
|
21965
21976
|
currentInteraction = _useInteraction.currentInteraction,
|
|
21966
21977
|
setCurrentInteraction = _useInteraction.setCurrentInteraction;
|
|
21967
21978
|
|
|
21979
|
+
var _isRequired = isRequired || necessityIndicator === 'required';
|
|
21980
|
+
|
|
21968
21981
|
var accessibilityProps = makeAccessible({
|
|
21969
|
-
required: Boolean(
|
|
21982
|
+
required: Boolean(_isRequired),
|
|
21970
21983
|
disabled: Boolean(isDisabled),
|
|
21971
21984
|
invalid: Boolean(validationState === 'error'),
|
|
21972
21985
|
describedBy: getDescribedByElementId({
|
|
@@ -22039,7 +22052,7 @@ var BaseInput = /*#__PURE__*/React__default.forwardRef(function (_ref11, ref) {
|
|
|
22039
22052
|
placeholder: placeholder,
|
|
22040
22053
|
isDisabled: isDisabled,
|
|
22041
22054
|
validationState: validationState,
|
|
22042
|
-
isRequired:
|
|
22055
|
+
isRequired: _isRequired,
|
|
22043
22056
|
handleOnFocus: handleOnFocus,
|
|
22044
22057
|
handleOnChange: handleOnChange,
|
|
22045
22058
|
handleOnBlur: handleOnBlur,
|
|
@@ -22723,9 +22736,6 @@ var OTPInput = function OTPInput(_ref) {
|
|
|
22723
22736
|
errorTextId = _useFormId.errorTextId,
|
|
22724
22737
|
successTextId = _useFormId.successTextId;
|
|
22725
22738
|
|
|
22726
|
-
var _useTheme = useTheme(),
|
|
22727
|
-
platform = _useTheme.platform;
|
|
22728
|
-
|
|
22729
22739
|
useEffect(function () {
|
|
22730
22740
|
// Effect for calling `onOTPFilled` callback
|
|
22731
22741
|
if (inputValue && inputValue.length >= otpLength) {
|
|
@@ -22920,7 +22930,6 @@ var OTPInput = function OTPInput(_ref) {
|
|
|
22920
22930
|
inputs.push( /*#__PURE__*/jsx(BaseBox, {
|
|
22921
22931
|
flex: 1,
|
|
22922
22932
|
marginLeft: index == 0 ? 'spacing.0' : 'spacing.3',
|
|
22923
|
-
maxWidth: platform === 'onDesktop' ? makeSize(size[36]) : makeSize(size[40]),
|
|
22924
22933
|
children: /*#__PURE__*/jsx(BaseInput // eslint-disable-next-line jsx-a11y/no-autofocus
|
|
22925
22934
|
, {
|
|
22926
22935
|
autoFocus: autoFocus && index === 0,
|
|
@@ -25011,6 +25020,8 @@ var _Radio = function _Radio(_ref, ref) {
|
|
|
25011
25020
|
|
|
25012
25021
|
var _isDisabled = isDisabled !== null && isDisabled !== void 0 ? isDisabled : groupProps === null || groupProps === void 0 ? void 0 : groupProps.isDisabled;
|
|
25013
25022
|
|
|
25023
|
+
var _isRequired = (groupProps === null || groupProps === void 0 ? void 0 : groupProps.isRequired) || (groupProps === null || groupProps === void 0 ? void 0 : groupProps.necessityIndicator) === 'required';
|
|
25024
|
+
|
|
25014
25025
|
var name = groupProps === null || groupProps === void 0 ? void 0 : groupProps.name;
|
|
25015
25026
|
var showHelpText = !hasError && helpText;
|
|
25016
25027
|
var isReactNative = getPlatformType() === 'react-native';
|
|
@@ -25039,7 +25050,7 @@ var _Radio = function _Radio(_ref, ref) {
|
|
|
25039
25050
|
isChecked: isChecked,
|
|
25040
25051
|
hasError: hasError,
|
|
25041
25052
|
isDisabled: _isDisabled,
|
|
25042
|
-
isRequired:
|
|
25053
|
+
isRequired: _isRequired,
|
|
25043
25054
|
name: name,
|
|
25044
25055
|
value: value,
|
|
25045
25056
|
onChange: handleChange
|
|
@@ -25097,6 +25108,7 @@ var useRadioGroup = function useRadioGroup(_ref) {
|
|
|
25097
25108
|
var value = _ref.value,
|
|
25098
25109
|
defaultValue = _ref.defaultValue,
|
|
25099
25110
|
isDisabled = _ref.isDisabled,
|
|
25111
|
+
isRequired = _ref.isRequired,
|
|
25100
25112
|
labelPosition = _ref.labelPosition,
|
|
25101
25113
|
_onChange = _ref.onChange,
|
|
25102
25114
|
validationState = _ref.validationState,
|
|
@@ -25165,12 +25177,13 @@ var useRadioGroup = function useRadioGroup(_ref) {
|
|
|
25165
25177
|
necessityIndicator: necessityIndicator,
|
|
25166
25178
|
validationState: validationState,
|
|
25167
25179
|
isDisabled: isDisabled,
|
|
25180
|
+
isRequired: isRequired,
|
|
25168
25181
|
labelPosition: platform === 'onMobile' ? 'top' : labelPosition,
|
|
25169
25182
|
name: fallbackName,
|
|
25170
25183
|
state: state,
|
|
25171
25184
|
size: size
|
|
25172
25185
|
};
|
|
25173
|
-
}, [validationState, isDisabled, platform, labelPosition, state, fallbackName, necessityIndicator, size]);
|
|
25186
|
+
}, [validationState, isDisabled, isRequired, platform, labelPosition, state, fallbackName, necessityIndicator, size]);
|
|
25174
25187
|
return {
|
|
25175
25188
|
state: state,
|
|
25176
25189
|
contextValue: contextValue,
|
|
@@ -25180,7 +25193,7 @@ var useRadioGroup = function useRadioGroup(_ref) {
|
|
|
25180
25193
|
};
|
|
25181
25194
|
};
|
|
25182
25195
|
|
|
25183
|
-
var _excluded$4 = ["children", "label", "helpText", "isDisabled", "necessityIndicator", "labelPosition", "validationState", "errorText", "name", "defaultValue", "onChange", "value", "size", "testID"];
|
|
25196
|
+
var _excluded$4 = ["children", "label", "helpText", "isDisabled", "isRequired", "necessityIndicator", "labelPosition", "validationState", "errorText", "name", "defaultValue", "onChange", "value", "size", "testID"];
|
|
25184
25197
|
|
|
25185
25198
|
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
25199
|
|
|
@@ -25192,6 +25205,8 @@ var RadioGroup = function RadioGroup(_ref) {
|
|
|
25192
25205
|
helpText = _ref.helpText,
|
|
25193
25206
|
_ref$isDisabled = _ref.isDisabled,
|
|
25194
25207
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
25208
|
+
_ref$isRequired = _ref.isRequired,
|
|
25209
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired,
|
|
25195
25210
|
_ref$necessityIndicat = _ref.necessityIndicator,
|
|
25196
25211
|
necessityIndicator = _ref$necessityIndicat === void 0 ? 'none' : _ref$necessityIndicat,
|
|
25197
25212
|
_ref$labelPosition = _ref.labelPosition,
|
|
@@ -25211,8 +25226,10 @@ var RadioGroup = function RadioGroup(_ref) {
|
|
|
25211
25226
|
var _useRadioGroup = useRadioGroup({
|
|
25212
25227
|
defaultValue: defaultValue,
|
|
25213
25228
|
isDisabled: isDisabled,
|
|
25229
|
+
isRequired: isRequired,
|
|
25214
25230
|
labelPosition: labelPosition,
|
|
25215
25231
|
name: name,
|
|
25232
|
+
necessityIndicator: necessityIndicator,
|
|
25216
25233
|
onChange: onChange,
|
|
25217
25234
|
validationState: validationState,
|
|
25218
25235
|
value: value,
|
|
@@ -28127,8 +28144,8 @@ function useWindowSize() {
|
|
|
28127
28144
|
// Initialize state with undefined width/height so server and client renders match
|
|
28128
28145
|
// Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
|
|
28129
28146
|
var _React$useState = React__default.useState({
|
|
28130
|
-
width:
|
|
28131
|
-
height:
|
|
28147
|
+
width: 0,
|
|
28148
|
+
height: 0
|
|
28132
28149
|
}),
|
|
28133
28150
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
28134
28151
|
windowSize = _React$useState2[0],
|