@thecb/components 4.3.13 → 4.4.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/.tool-versions CHANGED
@@ -1 +1 @@
1
- nodejs 15.5.0
1
+ nodejs 15.8.0
package/dist/index.cjs.js CHANGED
@@ -6073,16 +6073,17 @@ var createUniqueId = function createUniqueId() {
6073
6073
 
6074
6074
  var safeChildren = function safeChildren(children) {
6075
6075
  var replacement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
6076
+ var unsafeValues = [false, undefined, NaN, null];
6076
6077
 
6077
6078
  if (children && children instanceof Array) {
6078
6079
  return children.map(function (child) {
6079
- return !child ? /*#__PURE__*/React__default.createElement(React.Fragment, {
6080
+ return unsafeValues.includes(child) ? /*#__PURE__*/React__default.createElement(React.Fragment, {
6080
6081
  key: createUniqueId()
6081
6082
  }, replacement) : child;
6082
6083
  });
6083
6084
  }
6084
6085
 
6085
- return !children ? replacement : children;
6086
+ return unsafeValues.includes(children) ? replacement : children;
6086
6087
  };
6087
6088
  var generateClickHandler = function generateClickHandler(form, handleErrors, submitForm) {
6088
6089
  return function (e) {
@@ -16402,7 +16403,7 @@ function parseToRgb(color) {
16402
16403
  };
16403
16404
  }
16404
16405
 
16405
- var rgbaMatched = rgbaRegex.exec(normalizedColor);
16406
+ var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
16406
16407
 
16407
16408
  if (rgbaMatched) {
16408
16409
  return {
@@ -16433,7 +16434,7 @@ function parseToRgb(color) {
16433
16434
  };
16434
16435
  }
16435
16436
 
16436
- var hslaMatched = hslaRegex.exec(normalizedColor);
16437
+ var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
16437
16438
 
16438
16439
  if (hslaMatched) {
16439
16440
  var _hue = parseInt("" + hslaMatched[1], 10);
@@ -35065,7 +35066,7 @@ var AddressForm = function AddressForm(_ref) {
35065
35066
  }), /*#__PURE__*/React__default.createElement(FormStateDropdown, {
35066
35067
  labelTextWhenNoError: isUS ? "State" : "State or Province",
35067
35068
  errorMessages: stateProvinceErrorMessages,
35068
- countryCode: fields.country.rawValue,
35069
+ countryCode: fields.country.rawValue || "US",
35069
35070
  field: fields.stateProvince,
35070
35071
  fieldActions: actions.fields.stateProvince,
35071
35072
  showErrors: showErrors,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "4.3.13",
3
+ "version": "4.4.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -91,7 +91,7 @@ const AddressForm = ({
91
91
  <StateProvinceDropdown
92
92
  labelTextWhenNoError={isUS ? "State" : "State or Province"}
93
93
  errorMessages={stateProvinceErrorMessages}
94
- countryCode={fields.country.rawValue}
94
+ countryCode={fields.country.rawValue || "US"}
95
95
  field={fields.stateProvince}
96
96
  fieldActions={actions.fields.stateProvince}
97
97
  showErrors={showErrors}
@@ -17,12 +17,17 @@ const createUniqueId = () =>
17
17
  .substr(2, 9);
18
18
 
19
19
  export const safeChildren = (children, replacement = []) => {
20
+ const unsafeValues = [false, undefined, NaN, null];
20
21
  if (children && children instanceof Array) {
21
22
  return children.map(child =>
22
- !child ? <Fragment key={createUniqueId()}>{replacement}</Fragment> : child
23
+ unsafeValues.includes(child) ? (
24
+ <Fragment key={createUniqueId()}>{replacement}</Fragment>
25
+ ) : (
26
+ child
27
+ )
23
28
  );
24
29
  }
25
- return !children ? replacement : children;
30
+ return unsafeValues.includes(children) ? replacement : children;
26
31
  };
27
32
 
28
33
  export const generateClickHandler = (form, handleErrors, submitForm) => e => {