@thecb/components 4.0.18-beta.1 → 4.0.22-beta.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/dist/index.cjs.js CHANGED
@@ -33517,17 +33517,33 @@ var AddressForm = function AddressForm(_ref) {
33517
33517
 
33518
33518
  var zipErrorMessages = (_zipErrorMessages = {}, _defineProperty(_zipErrorMessages, required.error, "Zip code is required"), _defineProperty(_zipErrorMessages, hasLength.error, "Zip code must be 5 or 9 digits"), _zipErrorMessages);
33519
33519
 
33520
- var stateProvinceErrorMessages = _defineProperty({}, required.error, "State or Province is required"); // const countryErrorMessages = {
33521
- // [required.error]: "Country is required"
33522
- // };
33520
+ var stateProvinceErrorMessages = _defineProperty({}, required.error, "State or Province is required");
33523
33521
 
33522
+ var countryErrorMessages = _defineProperty({}, required.error, "Country is required");
33524
33523
 
33525
33524
  var isUS = fields.country.rawValue === "US";
33526
33525
  return /*#__PURE__*/React__default.createElement(FormContainer$1, {
33527
33526
  variant: variant,
33528
33527
  role: "form",
33529
33528
  "aria-label": "Address"
33530
- }, /*#__PURE__*/React__default.createElement(FormInputColumn, null, /*#__PURE__*/React__default.createElement(FormInput$1, {
33529
+ }, /*#__PURE__*/React__default.createElement(FormInputColumn, null, /*#__PURE__*/React__default.createElement(CountryDropdown, {
33530
+ labelTextWhenNoError: "Country",
33531
+ errorMessages: countryErrorMessages,
33532
+ field: fields.country,
33533
+ onChange: function onChange(value) {
33534
+ actions.fields.country.set(value); // temporary measure to not dirty fields until
33535
+ // we can write a reset function for fields
33536
+
33537
+ if (fields.stateProvince.rawValue) {
33538
+ actions.fields.stateProvince.set("");
33539
+ }
33540
+
33541
+ if (fields.zip.rawValue) {
33542
+ actions.fields.zip.set("");
33543
+ }
33544
+ },
33545
+ showErrors: showErrors
33546
+ }), /*#__PURE__*/React__default.createElement(FormInput$1, {
33531
33547
  labelTextWhenNoError: "Address",
33532
33548
  errorMessages: street1ErrorMessages,
33533
33549
  field: fields.street1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "4.0.18-beta.1",
3
+ "version": "4.0.22-beta.1",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect } from "react";
2
2
  import { required, hasLength } from "redux-freeform";
3
3
  import StateProvinceDropdown from "../../atoms/state-province-dropdown";
4
- // import CountryDropdown from "../../atoms/country-dropdown";
4
+ import CountryDropdown from "../../atoms/country-dropdown";
5
5
  import { zipFormat } from "../../../util/formats";
6
6
  import { noop } from "../../../util/general";
7
7
  import {
@@ -35,16 +35,16 @@ const AddressForm = ({
35
35
  const stateProvinceErrorMessages = {
36
36
  [required.error]: "State or Province is required"
37
37
  };
38
- // const countryErrorMessages = {
39
- // [required.error]: "Country is required"
40
- // };
38
+ const countryErrorMessages = {
39
+ [required.error]: "Country is required"
40
+ };
41
41
 
42
42
  const isUS = fields.country.rawValue === "US";
43
43
 
44
44
  return (
45
45
  <FormContainer variant={variant} role="form" aria-label="Address">
46
46
  <FormInputColumn>
47
- {/* <CountryDropdown
47
+ <CountryDropdown
48
48
  labelTextWhenNoError="Country"
49
49
  errorMessages={countryErrorMessages}
50
50
  field={fields.country}
@@ -60,7 +60,7 @@ const AddressForm = ({
60
60
  }
61
61
  }}
62
62
  showErrors={showErrors}
63
- /> */}
63
+ />
64
64
  <FormInput
65
65
  labelTextWhenNoError="Address"
66
66
  errorMessages={street1ErrorMessages}