@razorpay/blade 3.5.0 → 3.5.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/CHANGELOG.md +12 -0
- package/build/components/index.web.js +152 -266
- 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/tokens/index.web.js +13 -36
- package/build/tokens/index.web.js.map +1 -1
- package/build/utils/index.web.js +27 -82
- package/build/utils/index.web.js.map +1 -1
- package/package.json +4 -4
package/build/utils/index.web.js
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import _typeof from '@babel/runtime
|
|
2
|
-
import _slicedToArray from '@babel/runtime
|
|
3
|
-
import
|
|
4
|
-
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
5
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
6
|
-
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
7
|
-
import _everyInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/every';
|
|
8
|
-
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
9
|
-
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
10
|
-
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
11
|
-
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
12
|
-
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
13
|
-
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
14
|
-
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
15
|
-
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
16
|
-
import _defineProperty$1 from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
17
|
-
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
18
|
-
import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
|
19
|
-
import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
20
|
-
import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
1
|
+
import _typeof from '@babel/runtime/helpers/typeof';
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
+
import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
|
|
21
4
|
import { useMemo, useCallback, useState, useEffect, useRef } from 'react';
|
|
22
5
|
|
|
23
6
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -3893,7 +3876,7 @@ var isPartialMatchObjectKeys = function isPartialMatchObjectKeys(_ref) {
|
|
|
3893
3876
|
var innerObjectToMatch = _ref2.innerObjectToMatch,
|
|
3894
3877
|
innerObjectToInspect = _ref2.innerObjectToInspect;
|
|
3895
3878
|
|
|
3896
|
-
for (var _i = 0, _Object$entries =
|
|
3879
|
+
for (var _i = 0, _Object$entries = Object.entries(innerObjectToMatch); _i < _Object$entries.length; _i++) {
|
|
3897
3880
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
3898
3881
|
key = _Object$entries$_i[0],
|
|
3899
3882
|
valueToMatch = _Object$entries$_i[1];
|
|
@@ -3901,12 +3884,10 @@ var isPartialMatchObjectKeys = function isPartialMatchObjectKeys(_ref) {
|
|
|
3901
3884
|
var valueToInspect = innerObjectToInspect[key];
|
|
3902
3885
|
|
|
3903
3886
|
if (innerObjectToInspect.hasOwnProperty(key)) {
|
|
3904
|
-
if (valueToMatch === null || valueToMatch === undefined || valueToMatch === '' ||
|
|
3887
|
+
if (valueToMatch === null || valueToMatch === undefined || valueToMatch === '' || Array.isArray(valueToMatch) || // the condition checks if the "valueToMatch" is not of type object then "valueToMatch" type should be same as type of "valueToInspect"
|
|
3905
3888
|
!(valueToMatch instanceof Object) && _typeof(valueToMatch) !== _typeof(valueToInspect)) {
|
|
3906
|
-
var _context, _context2;
|
|
3907
|
-
|
|
3908
3889
|
// this is an invalid case, so we log error
|
|
3909
|
-
console.error(
|
|
3890
|
+
console.error("[isPartialMatchObjectKeys]: Unexpected value: ".concat(JSON.stringify(valueToMatch), " of type ").concat(_typeof(valueToMatch), " for key: ").concat(key));
|
|
3910
3891
|
matchResponses.push(false);
|
|
3911
3892
|
}
|
|
3912
3893
|
|
|
@@ -3923,10 +3904,8 @@ var isPartialMatchObjectKeys = function isPartialMatchObjectKeys(_ref) {
|
|
|
3923
3904
|
});
|
|
3924
3905
|
}
|
|
3925
3906
|
} else {
|
|
3926
|
-
var _context3;
|
|
3927
|
-
|
|
3928
3907
|
// the key doesn't exist in the innerObjectToMatch, so we log error
|
|
3929
|
-
console.error(
|
|
3908
|
+
console.error("[isPartialMatchObjectKeys]: ".concat(key, " doesn't exist in ").concat(JSON.stringify(innerObjectToInspect, null, 2)));
|
|
3930
3909
|
matchResponses.push(false);
|
|
3931
3910
|
}
|
|
3932
3911
|
}
|
|
@@ -3936,12 +3915,12 @@ var isPartialMatchObjectKeys = function isPartialMatchObjectKeys(_ref) {
|
|
|
3936
3915
|
innerObjectToMatch: objectToMatch,
|
|
3937
3916
|
innerObjectToInspect: objectToInspect
|
|
3938
3917
|
});
|
|
3939
|
-
return
|
|
3918
|
+
return matchResponses.every(Boolean);
|
|
3940
3919
|
};
|
|
3941
3920
|
|
|
3942
|
-
function ownKeys$2(object, enumerableOnly) { var keys =
|
|
3921
|
+
function ownKeys$2(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; }
|
|
3943
3922
|
|
|
3944
|
-
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
3923
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3945
3924
|
|
|
3946
3925
|
var accessibilityValue = {
|
|
3947
3926
|
valueMax: 'aria-valuemax',
|
|
@@ -4021,9 +4000,7 @@ var makeAccessible = function makeAccessible(props) {
|
|
|
4021
4000
|
};
|
|
4022
4001
|
|
|
4023
4002
|
var makeBezier = function makeBezier(x1, y1, x2, y2) {
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
return _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = "cubic-bezier(".concat(x1, ", ")).call(_context3, y1, ", ")).call(_context2, x2, ", ")).call(_context, y2, ")");
|
|
4003
|
+
return "cubic-bezier(".concat(x1, ", ").concat(y1, ", ").concat(x2, ", ").concat(y2, ")");
|
|
4027
4004
|
};
|
|
4028
4005
|
|
|
4029
4006
|
function makeBorderSize(size) {
|
|
@@ -4722,13 +4699,13 @@ var merge = createAssigner(function(object, source, srcIndex) {
|
|
|
4722
4699
|
|
|
4723
4700
|
var merge_1 = merge;
|
|
4724
4701
|
|
|
4725
|
-
function ownKeys$1(object, enumerableOnly) { var keys =
|
|
4702
|
+
function ownKeys$1(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; }
|
|
4703
|
+
|
|
4704
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4726
4705
|
|
|
4727
|
-
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$1(Object(source), !0)).call(_context, function (key) { _defineProperty$1(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4728
4706
|
var setupMatchMediaMock = function setupMatchMediaMock() {
|
|
4729
4707
|
var customArgs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4730
|
-
|
|
4731
|
-
_Object$defineProperty(window, 'matchMedia', {
|
|
4708
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
4732
4709
|
writable: true,
|
|
4733
4710
|
value: jest.fn().mockImplementation(function (query) {
|
|
4734
4711
|
return _objectSpread$1({
|
|
@@ -4748,10 +4725,8 @@ var testID = function testID(defaultKey) {
|
|
|
4748
4725
|
};
|
|
4749
4726
|
|
|
4750
4727
|
var toTitleCase = function toTitleCase(inputString) {
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
return _mapInstanceProperty(_context = inputString.toLowerCase().split(' ')).call(_context, function (word) {
|
|
4754
|
-
return word.charAt(0).toUpperCase() + _sliceInstanceProperty(word).call(word, 1);
|
|
4728
|
+
return inputString.toLowerCase().split(' ').map(function (word) {
|
|
4729
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
4755
4730
|
}).join(' ');
|
|
4756
4731
|
};
|
|
4757
4732
|
|
|
@@ -4765,9 +4740,7 @@ var useBreakpoint = function useBreakpoint(_ref) {
|
|
|
4765
4740
|
var breakpoints = _ref.breakpoints;
|
|
4766
4741
|
var supportsMatchMedia = typeof document !== 'undefined' && typeof ((_window = window) === null || _window === void 0 ? void 0 : _window.matchMedia) === 'function';
|
|
4767
4742
|
var breakpointsTokenAndQueryCollection = useMemo(function () {
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
return supportsMatchMedia ? _mapInstanceProperty(_context = _Object$entries2(breakpoints)).call(_context, function (_ref2, index, breakpointsArray) {
|
|
4743
|
+
return supportsMatchMedia ? Object.entries(breakpoints).map(function (_ref2, index, breakpointsArray) {
|
|
4771
4744
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
4772
4745
|
token = _ref3[0],
|
|
4773
4746
|
screenSize = _ref3[1];
|
|
@@ -4777,9 +4750,7 @@ var useBreakpoint = function useBreakpoint(_ref) {
|
|
|
4777
4750
|
if (token === 'max') {
|
|
4778
4751
|
mediaQuery = "screen and (min-width: ".concat(screenSize, "px)");
|
|
4779
4752
|
} else if (breakpointsArray[index - 1]) {
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
mediaQuery = _concatInstanceProperty(_context2 = "screen and (min-width: ".concat(breakpointsArray[index - 1][1] + 1, "px) and (max-width: ")).call(_context2, screenSize, "px)");
|
|
4753
|
+
mediaQuery = "screen and (min-width: ".concat(breakpointsArray[index - 1][1] + 1, "px) and (max-width: ").concat(screenSize, "px)");
|
|
4783
4754
|
} else {
|
|
4784
4755
|
mediaQuery = "screen and (max-width: ".concat(screenSize, "px)");
|
|
4785
4756
|
}
|
|
@@ -4798,9 +4769,7 @@ var useBreakpoint = function useBreakpoint(_ref) {
|
|
|
4798
4769
|
if (platform === 'react-native') {
|
|
4799
4770
|
matchedDeviceType = deviceType.mobile;
|
|
4800
4771
|
} else if (platform === 'browser') {
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
if (matchedBreakpoint && _includesInstanceProperty(_context3 = ['xs', 's', 'm']).call(_context3, matchedBreakpoint)) {
|
|
4772
|
+
if (matchedBreakpoint && ['xs', 's', 'm'].includes(matchedBreakpoint)) {
|
|
4804
4773
|
// tablet is also categorised as mobile
|
|
4805
4774
|
matchedDeviceType = deviceType.mobile;
|
|
4806
4775
|
} else {
|
|
@@ -4816,7 +4785,7 @@ var useBreakpoint = function useBreakpoint(_ref) {
|
|
|
4816
4785
|
var getMatchedBreakpoint = useCallback(function (event) {
|
|
4817
4786
|
var _breakpointsTokenAndQ, _breakpointsTokenAndQ2;
|
|
4818
4787
|
|
|
4819
|
-
var matchedBreakpoint = (_breakpointsTokenAndQ = (_breakpointsTokenAndQ2 =
|
|
4788
|
+
var matchedBreakpoint = (_breakpointsTokenAndQ = (_breakpointsTokenAndQ2 = breakpointsTokenAndQueryCollection.find(function (_ref4) {
|
|
4820
4789
|
var _ref4$mediaQuery = _ref4.mediaQuery,
|
|
4821
4790
|
mediaQuery = _ref4$mediaQuery === void 0 ? '' : _ref4$mediaQuery;
|
|
4822
4791
|
|
|
@@ -4864,7 +4833,7 @@ var useBreakpoint = function useBreakpoint(_ref) {
|
|
|
4864
4833
|
});
|
|
4865
4834
|
};
|
|
4866
4835
|
|
|
4867
|
-
var mediaQueryInstances =
|
|
4836
|
+
var mediaQueryInstances = breakpointsTokenAndQueryCollection.map(function (_ref5) {
|
|
4868
4837
|
var _ref5$mediaQuery = _ref5.mediaQuery,
|
|
4869
4838
|
mediaQuery = _ref5$mediaQuery === void 0 ? '' : _ref5$mediaQuery;
|
|
4870
4839
|
var mediaQueryInstance = window.matchMedia(mediaQuery);
|
|
@@ -4882,9 +4851,8 @@ var useBreakpoint = function useBreakpoint(_ref) {
|
|
|
4882
4851
|
|
|
4883
4852
|
return mediaQueryInstance;
|
|
4884
4853
|
});
|
|
4885
|
-
|
|
4886
4854
|
return function () {
|
|
4887
|
-
|
|
4855
|
+
mediaQueryInstances.forEach(function (mediaQueryInstance) {
|
|
4888
4856
|
if (mediaQueryInstance.removeEventListener) {
|
|
4889
4857
|
mediaQueryInstance.removeEventListener('change', handleMediaQueryChange);
|
|
4890
4858
|
} else {
|
|
@@ -4903,9 +4871,9 @@ var fontFamily = {
|
|
|
4903
4871
|
code: 'monospace'
|
|
4904
4872
|
};
|
|
4905
4873
|
|
|
4906
|
-
function ownKeys(object, enumerableOnly) { var keys =
|
|
4874
|
+
function ownKeys(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; }
|
|
4907
4875
|
|
|
4908
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
4876
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4909
4877
|
var fontWeight = {
|
|
4910
4878
|
regular: 400,
|
|
4911
4879
|
bold: 700
|
|
@@ -4981,27 +4949,6 @@ var fontWeight = {
|
|
|
4981
4949
|
}
|
|
4982
4950
|
});
|
|
4983
4951
|
|
|
4984
|
-
/* makeBezier returns a string of `cubic-bezier()` for web & a react-native-reanimated Easing Function of type `EasingFunctionFactory` for native */
|
|
4985
|
-
|
|
4986
|
-
({
|
|
4987
|
-
standard: {
|
|
4988
|
-
attentive: makeBezier(0.5, 0, 0.3, 1.5),
|
|
4989
|
-
effective: makeBezier(0.3, 0, 0.2, 1),
|
|
4990
|
-
revealing: makeBezier(0.5, 0, 0, 1),
|
|
4991
|
-
wary: makeBezier(1, 0.5, 0, 0.5)
|
|
4992
|
-
},
|
|
4993
|
-
entrance: {
|
|
4994
|
-
attentive: makeBezier(0.5, 0, 0.3, 1.5),
|
|
4995
|
-
effective: makeBezier(0, 0, 0.2, 1),
|
|
4996
|
-
revealing: makeBezier(0, 0, 0, 1)
|
|
4997
|
-
},
|
|
4998
|
-
exit: {
|
|
4999
|
-
attentive: makeBezier(0.7, 0, 0.5, 1),
|
|
5000
|
-
effective: makeBezier(0.17, 0, 1, 1),
|
|
5001
|
-
revealing: makeBezier(0.5, 0, 1, 1)
|
|
5002
|
-
}
|
|
5003
|
-
});
|
|
5004
|
-
|
|
5005
4952
|
var colorSchemeNamesInput = ['light', 'dark', 'system'];
|
|
5006
4953
|
|
|
5007
4954
|
var useColorScheme = function useColorScheme() {
|
|
@@ -5016,10 +4963,8 @@ var useColorScheme = function useColorScheme() {
|
|
|
5016
4963
|
setColorSchemeState = _useState2[1];
|
|
5017
4964
|
|
|
5018
4965
|
var setColorScheme = useCallback(function setThemeMode(colorScheme) {
|
|
5019
|
-
if (!
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
throw new Error(_concatInstanceProperty(_context = "[useColorScheme]: Expected color scheme to be one of [".concat(colorSchemeNamesInput.toString(), "] but received ")).call(_context, colorScheme));
|
|
4966
|
+
if (!colorSchemeNamesInput.includes(colorScheme)) {
|
|
4967
|
+
throw new Error("[useColorScheme]: Expected color scheme to be one of [".concat(colorSchemeNamesInput.toString(), "] but received ").concat(colorScheme));
|
|
5023
4968
|
}
|
|
5024
4969
|
|
|
5025
4970
|
setColorSchemeState(getColorScheme(colorScheme));
|