@thecb/components 4.0.22-beta.0 → 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,
@@ -33897,8 +33913,6 @@ var EditableList = function EditableList(_ref) {
33897
33913
  title = _ref$title === void 0 ? "" : _ref$title,
33898
33914
  _ref$titleWeight = _ref.titleWeight,
33899
33915
  titleWeight = _ref$titleWeight === void 0 ? "400" : _ref$titleWeight,
33900
- _ref$canAdd = _ref.canAdd,
33901
- canAdd = _ref$canAdd === void 0 ? true : _ref$canAdd,
33902
33916
  addItem = _ref.addItem,
33903
33917
  removeItem = _ref.removeItem,
33904
33918
  editItem = _ref.editItem,
@@ -33982,7 +33996,7 @@ var EditableList = function EditableList(_ref) {
33982
33996
  },
33983
33997
  extraStyles: "min-width: 0;"
33984
33998
  }))));
33985
- })), canAdd && (!maxItems || items.length < maxItems) && /*#__PURE__*/React__default.createElement(Box, {
33999
+ })), (!maxItems || items.length < maxItems) && /*#__PURE__*/React__default.createElement(Box, {
33986
34000
  padding: items.length === 0 ? "0" : "1rem 0 0"
33987
34001
  }, /*#__PURE__*/React__default.createElement(Placeholder$1, {
33988
34002
  text: "Add a".concat(itemName[0].match(/[aieouAIEOU]/) ? "n" : "", " ").concat(itemName),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "4.0.22-beta.0",
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}
@@ -18,7 +18,6 @@ import {
18
18
  const EditableList = ({
19
19
  title = "",
20
20
  titleWeight = "400",
21
- canAdd = true,
22
21
  addItem,
23
22
  removeItem,
24
23
  editItem,
@@ -124,7 +123,7 @@ const EditableList = ({
124
123
  );
125
124
  })}
126
125
  </Box>
127
- {canAdd && (!maxItems || items.length < maxItems) && (
126
+ {(!maxItems || items.length < maxItems) && (
128
127
  <Box padding={items.length === 0 ? "0" : "1rem 0 0"}>
129
128
  <Placeholder
130
129
  text={`Add a${