@bcgov-sso/common-react-components 1.16.0 → 1.17.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/dist/cjs/index.js
CHANGED
|
@@ -2662,6 +2662,8 @@ var ReactPropTypesSecret$3 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
|
2662
2662
|
|
|
2663
2663
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret$3;
|
|
2664
2664
|
|
|
2665
|
+
var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
2666
|
+
|
|
2665
2667
|
/**
|
|
2666
2668
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
2667
2669
|
*
|
|
@@ -2674,7 +2676,7 @@ var printWarning$1 = function() {};
|
|
|
2674
2676
|
if (process.env.NODE_ENV !== 'production') {
|
|
2675
2677
|
var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
|
|
2676
2678
|
var loggedTypeFailures = {};
|
|
2677
|
-
var has$1 =
|
|
2679
|
+
var has$1 = has$2;
|
|
2678
2680
|
|
|
2679
2681
|
printWarning$1 = function(text) {
|
|
2680
2682
|
var message = 'Warning: ' + text;
|
|
@@ -2686,7 +2688,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
2686
2688
|
// This error was thrown as a convenience so that you can use this stack
|
|
2687
2689
|
// to find the callsite that caused this warning to fire.
|
|
2688
2690
|
throw new Error(message);
|
|
2689
|
-
} catch (x) {}
|
|
2691
|
+
} catch (x) { /**/ }
|
|
2690
2692
|
};
|
|
2691
2693
|
}
|
|
2692
2694
|
|
|
@@ -2715,7 +2717,8 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack)
|
|
|
2715
2717
|
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
2716
2718
|
var err = Error(
|
|
2717
2719
|
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
2718
|
-
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
|
2720
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
2721
|
+
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
2719
2722
|
);
|
|
2720
2723
|
err.name = 'Invariant Violation';
|
|
2721
2724
|
throw err;
|
|
@@ -2774,9 +2777,9 @@ var ReactIs$1 = reactIs$1.exports;
|
|
|
2774
2777
|
var assign = objectAssign;
|
|
2775
2778
|
|
|
2776
2779
|
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
2780
|
+
var has = has$2;
|
|
2777
2781
|
var checkPropTypes = checkPropTypes_1;
|
|
2778
2782
|
|
|
2779
|
-
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
2780
2783
|
var printWarning = function() {};
|
|
2781
2784
|
|
|
2782
2785
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2877,6 +2880,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
2877
2880
|
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
2878
2881
|
var ReactPropTypes = {
|
|
2879
2882
|
array: createPrimitiveTypeChecker('array'),
|
|
2883
|
+
bigint: createPrimitiveTypeChecker('bigint'),
|
|
2880
2884
|
bool: createPrimitiveTypeChecker('boolean'),
|
|
2881
2885
|
func: createPrimitiveTypeChecker('function'),
|
|
2882
2886
|
number: createPrimitiveTypeChecker('number'),
|
|
@@ -2922,8 +2926,9 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
2922
2926
|
* is prohibitively expensive if they are created too often, such as what
|
|
2923
2927
|
* happens in oneOfType() for any type before the one that matched.
|
|
2924
2928
|
*/
|
|
2925
|
-
function PropTypeError(message) {
|
|
2929
|
+
function PropTypeError(message, data) {
|
|
2926
2930
|
this.message = message;
|
|
2931
|
+
this.data = data && typeof data === 'object' ? data: {};
|
|
2927
2932
|
this.stack = '';
|
|
2928
2933
|
}
|
|
2929
2934
|
// Make `instanceof Error` still work for returned errors.
|
|
@@ -2958,7 +2963,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
2958
2963
|
) {
|
|
2959
2964
|
printWarning(
|
|
2960
2965
|
'You are manually calling a React.PropTypes validation ' +
|
|
2961
|
-
'function for the `' + propFullName + '` prop on `' + componentName
|
|
2966
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
2962
2967
|
'and will throw in the standalone `prop-types` package. ' +
|
|
2963
2968
|
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
2964
2969
|
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
@@ -2997,7 +3002,10 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
2997
3002
|
// 'of type `object`'.
|
|
2998
3003
|
var preciseType = getPreciseType(propValue);
|
|
2999
3004
|
|
|
3000
|
-
return new PropTypeError(
|
|
3005
|
+
return new PropTypeError(
|
|
3006
|
+
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
3007
|
+
{expectedType: expectedType}
|
|
3008
|
+
);
|
|
3001
3009
|
}
|
|
3002
3010
|
return null;
|
|
3003
3011
|
}
|
|
@@ -3141,14 +3149,19 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
3141
3149
|
}
|
|
3142
3150
|
|
|
3143
3151
|
function validate(props, propName, componentName, location, propFullName) {
|
|
3152
|
+
var expectedTypes = [];
|
|
3144
3153
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
3145
3154
|
var checker = arrayOfTypeCheckers[i];
|
|
3146
|
-
|
|
3155
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1);
|
|
3156
|
+
if (checkerResult == null) {
|
|
3147
3157
|
return null;
|
|
3148
3158
|
}
|
|
3159
|
+
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
3160
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
3161
|
+
}
|
|
3149
3162
|
}
|
|
3150
|
-
|
|
3151
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '
|
|
3163
|
+
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
3164
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
3152
3165
|
}
|
|
3153
3166
|
return createChainableTypeChecker(validate);
|
|
3154
3167
|
}
|
|
@@ -3163,6 +3176,13 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
3163
3176
|
return createChainableTypeChecker(validate);
|
|
3164
3177
|
}
|
|
3165
3178
|
|
|
3179
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
3180
|
+
return new PropTypeError(
|
|
3181
|
+
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
3182
|
+
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
3183
|
+
);
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3166
3186
|
function createShapeTypeChecker(shapeTypes) {
|
|
3167
3187
|
function validate(props, propName, componentName, location, propFullName) {
|
|
3168
3188
|
var propValue = props[propName];
|
|
@@ -3172,8 +3192,8 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
3172
3192
|
}
|
|
3173
3193
|
for (var key in shapeTypes) {
|
|
3174
3194
|
var checker = shapeTypes[key];
|
|
3175
|
-
if (
|
|
3176
|
-
|
|
3195
|
+
if (typeof checker !== 'function') {
|
|
3196
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
3177
3197
|
}
|
|
3178
3198
|
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
|
|
3179
3199
|
if (error) {
|
|
@@ -3192,16 +3212,18 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
3192
3212
|
if (propType !== 'object') {
|
|
3193
3213
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
3194
3214
|
}
|
|
3195
|
-
// We need to check all keys in case some are required but missing from
|
|
3196
|
-
// props.
|
|
3215
|
+
// We need to check all keys in case some are required but missing from props.
|
|
3197
3216
|
var allKeys = assign({}, props[propName], shapeTypes);
|
|
3198
3217
|
for (var key in allKeys) {
|
|
3199
3218
|
var checker = shapeTypes[key];
|
|
3219
|
+
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
3220
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
3221
|
+
}
|
|
3200
3222
|
if (!checker) {
|
|
3201
3223
|
return new PropTypeError(
|
|
3202
3224
|
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
3203
3225
|
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
3204
|
-
'\nValid keys: ' +
|
|
3226
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
3205
3227
|
);
|
|
3206
3228
|
}
|
|
3207
3229
|
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
|
|
@@ -3386,6 +3408,7 @@ var factoryWithThrowingShims = function() {
|
|
|
3386
3408
|
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
3387
3409
|
var ReactPropTypes = {
|
|
3388
3410
|
array: shim,
|
|
3411
|
+
bigint: shim,
|
|
3389
3412
|
bool: shim,
|
|
3390
3413
|
func: shim,
|
|
3391
3414
|
number: shim,
|
|
@@ -8347,6 +8370,12 @@ const styles$1 = {
|
|
|
8347
8370
|
button: `
|
|
8348
8371
|
background-color: #1a4dff;
|
|
8349
8372
|
color: #e8edff;
|
|
8373
|
+
`,
|
|
8374
|
+
},
|
|
8375
|
+
plainText: {
|
|
8376
|
+
button: `
|
|
8377
|
+
background-color: unset;
|
|
8378
|
+
color: #0139ff;
|
|
8350
8379
|
`,
|
|
8351
8380
|
},
|
|
8352
8381
|
secondary: {
|