@thecb/components 4.1.8-beta.0 → 4.1.8-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
|
@@ -18866,7 +18866,7 @@ function _templateObject3$5() {
|
|
|
18866
18866
|
}
|
|
18867
18867
|
|
|
18868
18868
|
function _templateObject2$b() {
|
|
18869
|
-
var data = _taggedTemplateLiteral(["\n transform-origin: 0 0;\n border: 1px solid ", ";\n border-radius: 2px;\n background-color: ", ";\n padding: 8px 0 8px;\n position: absolute;\n width:
|
|
18869
|
+
var data = _taggedTemplateLiteral(["\n transform-origin: 0 0;\n border: 1px solid ", ";\n border-radius: 2px;\n background-color: ", ";\n padding: 8px 0 8px;\n position: absolute;\n width: 100%;\n max-height: ", ";\n overflow-y: scroll;\n z-index: 1;\n box-sizing: border-box;\n &:focus {\n outline: none;\n }\n"]);
|
|
18870
18870
|
|
|
18871
18871
|
_templateObject2$b = function _templateObject2() {
|
|
18872
18872
|
return data;
|
|
@@ -18876,7 +18876,7 @@ function _templateObject2$b() {
|
|
|
18876
18876
|
}
|
|
18877
18877
|
|
|
18878
18878
|
function _templateObject$n() {
|
|
18879
|
-
var data = _taggedTemplateLiteral(["\n display: flex;\n
|
|
18879
|
+
var data = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n transition: transform 0.3s ease;\n ", "\n"]);
|
|
18880
18880
|
|
|
18881
18881
|
_templateObject$n = function _templateObject() {
|
|
18882
18882
|
return data;
|
|
@@ -18889,52 +18889,47 @@ var IconWrapper = styled__default.div(_templateObject$n(), function (_ref) {
|
|
|
18889
18889
|
return open ? "transform: rotate(-180deg)" : "";
|
|
18890
18890
|
});
|
|
18891
18891
|
var DropdownContentWrapper = styled__default.div(_templateObject2$b(), GREY_CHATEAU, WHITE, function (_ref2) {
|
|
18892
|
-
var
|
|
18893
|
-
return widthFitOptions ? "fit-content" : "100%";
|
|
18894
|
-
}, function (_ref3) {
|
|
18895
|
-
var maxHeight = _ref3.maxHeight;
|
|
18892
|
+
var maxHeight = _ref2.maxHeight;
|
|
18896
18893
|
return maxHeight || "400px";
|
|
18897
18894
|
});
|
|
18898
|
-
var DropdownItemWrapper = styled__default.div(_templateObject3$5(), function (
|
|
18899
|
-
var selected =
|
|
18900
|
-
themeValues =
|
|
18895
|
+
var DropdownItemWrapper = styled__default.div(_templateObject3$5(), function (_ref3) {
|
|
18896
|
+
var selected = _ref3.selected,
|
|
18897
|
+
themeValues = _ref3.themeValues;
|
|
18901
18898
|
return selected ? themeValues.selectedColor : WHITE;
|
|
18902
|
-
}, function (
|
|
18903
|
-
var disabled =
|
|
18899
|
+
}, function (_ref4) {
|
|
18900
|
+
var disabled = _ref4.disabled;
|
|
18904
18901
|
return disabled ? "default" : "pointer";
|
|
18902
|
+
}, function (_ref5) {
|
|
18903
|
+
var selected = _ref5.selected,
|
|
18904
|
+
disabled = _ref5.disabled,
|
|
18905
|
+
themeValues = _ref5.themeValues;
|
|
18906
|
+
return selected ? themeValues.selectedColor : disabled ? WHITE : themeValues.hoverColor;
|
|
18905
18907
|
}, function (_ref6) {
|
|
18906
18908
|
var selected = _ref6.selected,
|
|
18907
18909
|
disabled = _ref6.disabled,
|
|
18908
18910
|
themeValues = _ref6.themeValues;
|
|
18909
18911
|
return selected ? themeValues.selectedColor : disabled ? WHITE : themeValues.hoverColor;
|
|
18910
|
-
}, function (_ref7) {
|
|
18911
|
-
var selected = _ref7.selected,
|
|
18912
|
-
disabled = _ref7.disabled,
|
|
18913
|
-
themeValues = _ref7.themeValues;
|
|
18914
|
-
return selected ? themeValues.selectedColor : disabled ? WHITE : themeValues.hoverColor;
|
|
18915
18912
|
});
|
|
18916
|
-
var SearchInput = styled__default.input(_templateObject4$2(), function (
|
|
18917
|
-
var themeValues =
|
|
18913
|
+
var SearchInput = styled__default.input(_templateObject4$2(), function (_ref7) {
|
|
18914
|
+
var themeValues = _ref7.themeValues;
|
|
18918
18915
|
return themeValues.hoverColor && themeValues.hoverColor;
|
|
18919
18916
|
});
|
|
18920
18917
|
|
|
18921
|
-
var Dropdown = function Dropdown(
|
|
18918
|
+
var Dropdown = function Dropdown(_ref8) {
|
|
18922
18919
|
var _options$find;
|
|
18923
18920
|
|
|
18924
|
-
var placeholder =
|
|
18925
|
-
options =
|
|
18926
|
-
value =
|
|
18927
|
-
isOpen =
|
|
18928
|
-
isError =
|
|
18929
|
-
onSelect =
|
|
18930
|
-
|
|
18931
|
-
disabledValues =
|
|
18932
|
-
|
|
18933
|
-
onClick =
|
|
18934
|
-
themeValues =
|
|
18935
|
-
maxHeight =
|
|
18936
|
-
_ref9$widthFitOptions = _ref9.widthFitOptions,
|
|
18937
|
-
widthFitOptions = _ref9$widthFitOptions === void 0 ? false : _ref9$widthFitOptions;
|
|
18921
|
+
var placeholder = _ref8.placeholder,
|
|
18922
|
+
options = _ref8.options,
|
|
18923
|
+
value = _ref8.value,
|
|
18924
|
+
isOpen = _ref8.isOpen,
|
|
18925
|
+
isError = _ref8.isError,
|
|
18926
|
+
onSelect = _ref8.onSelect,
|
|
18927
|
+
_ref8$disabledValues = _ref8.disabledValues,
|
|
18928
|
+
disabledValues = _ref8$disabledValues === void 0 ? [] : _ref8$disabledValues,
|
|
18929
|
+
_ref8$onClick = _ref8.onClick,
|
|
18930
|
+
onClick = _ref8$onClick === void 0 ? noop : _ref8$onClick,
|
|
18931
|
+
themeValues = _ref8.themeValues,
|
|
18932
|
+
maxHeight = _ref8.maxHeight;
|
|
18938
18933
|
|
|
18939
18934
|
var _useState = React.useState(""),
|
|
18940
18935
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -19030,7 +19025,7 @@ var Dropdown = function Dropdown(_ref9) {
|
|
|
19030
19025
|
break;
|
|
19031
19026
|
}
|
|
19032
19027
|
|
|
19033
|
-
if (keyCode > 64 && keyCode < 91 || keyCode == 32
|
|
19028
|
+
if (keyCode > 64 && keyCode < 91 || keyCode == 32) {
|
|
19034
19029
|
e.preventDefault();
|
|
19035
19030
|
setInputValue(inputValue + key);
|
|
19036
19031
|
}
|
|
@@ -19101,7 +19096,6 @@ var Dropdown = function Dropdown(_ref9) {
|
|
|
19101
19096
|
maxHeight: maxHeight,
|
|
19102
19097
|
open: isOpen,
|
|
19103
19098
|
ref: dropdownRef,
|
|
19104
|
-
widthFitOptions: widthFitOptions,
|
|
19105
19099
|
tabIndex: 0
|
|
19106
19100
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
19107
19101
|
childGap: "0"
|
|
@@ -34224,17 +34218,33 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
34224
34218
|
|
|
34225
34219
|
var zipErrorMessages = (_zipErrorMessages = {}, _defineProperty(_zipErrorMessages, required.error, "Zip code is required"), _defineProperty(_zipErrorMessages, hasLength.error, "Zip code must be 5 or 9 digits"), _zipErrorMessages);
|
|
34226
34220
|
|
|
34227
|
-
var stateProvinceErrorMessages = _defineProperty({}, required.error, "State or Province is required");
|
|
34228
|
-
// [required.error]: "Country is required"
|
|
34229
|
-
// };
|
|
34221
|
+
var stateProvinceErrorMessages = _defineProperty({}, required.error, "State or Province is required");
|
|
34230
34222
|
|
|
34223
|
+
var countryErrorMessages = _defineProperty({}, required.error, "Country is required");
|
|
34231
34224
|
|
|
34232
34225
|
var isUS = fields.country.rawValue === "US";
|
|
34233
34226
|
return /*#__PURE__*/React__default.createElement(FormContainer$1, {
|
|
34234
34227
|
variant: variant,
|
|
34235
34228
|
role: "form",
|
|
34236
34229
|
"aria-label": "Address"
|
|
34237
|
-
}, /*#__PURE__*/React__default.createElement(FormInputColumn, null, /*#__PURE__*/React__default.createElement(
|
|
34230
|
+
}, /*#__PURE__*/React__default.createElement(FormInputColumn, null, /*#__PURE__*/React__default.createElement(CountryDropdown, {
|
|
34231
|
+
labelTextWhenNoError: "Country",
|
|
34232
|
+
errorMessages: countryErrorMessages,
|
|
34233
|
+
field: fields.country,
|
|
34234
|
+
onChange: function onChange(value) {
|
|
34235
|
+
actions.fields.country.set(value); // temporary measure to not dirty fields until
|
|
34236
|
+
// we can write a reset function for fields
|
|
34237
|
+
|
|
34238
|
+
if (fields.stateProvince.rawValue) {
|
|
34239
|
+
actions.fields.stateProvince.set("");
|
|
34240
|
+
}
|
|
34241
|
+
|
|
34242
|
+
if (fields.zip.rawValue) {
|
|
34243
|
+
actions.fields.zip.set("");
|
|
34244
|
+
}
|
|
34245
|
+
},
|
|
34246
|
+
showErrors: showErrors
|
|
34247
|
+
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
34238
34248
|
labelTextWhenNoError: "Address",
|
|
34239
34249
|
errorMessages: street1ErrorMessages,
|
|
34240
34250
|
field: fields.street1,
|
package/package.json
CHANGED
|
@@ -17,7 +17,6 @@ import { themeComponent } from "../../../util/themeUtils";
|
|
|
17
17
|
|
|
18
18
|
const IconWrapper = styled.div`
|
|
19
19
|
display: flex;
|
|
20
|
-
padding-left: 8px;
|
|
21
20
|
flex-direction: column;
|
|
22
21
|
justify-content: center;
|
|
23
22
|
transition: transform 0.3s ease;
|
|
@@ -31,8 +30,7 @@ const DropdownContentWrapper = styled.div`
|
|
|
31
30
|
background-color: ${WHITE};
|
|
32
31
|
padding: 8px 0 8px;
|
|
33
32
|
position: absolute;
|
|
34
|
-
width:
|
|
35
|
-
min-width: 100%;
|
|
33
|
+
width: 100%;
|
|
36
34
|
max-height: ${({ maxHeight }) => maxHeight || "400px"};
|
|
37
35
|
overflow-y: scroll;
|
|
38
36
|
z-index: 1;
|
|
@@ -91,8 +89,7 @@ const Dropdown = ({
|
|
|
91
89
|
disabledValues = [],
|
|
92
90
|
onClick = noop,
|
|
93
91
|
themeValues,
|
|
94
|
-
maxHeight
|
|
95
|
-
widthFitOptions = false
|
|
92
|
+
maxHeight
|
|
96
93
|
}) => {
|
|
97
94
|
const [inputValue, setInputValue] = useState("");
|
|
98
95
|
const [optionsState, setOptionsState] = useState([]);
|
|
@@ -154,7 +151,7 @@ const Dropdown = ({
|
|
|
154
151
|
setInputValue(inputValue.slice(0, -1));
|
|
155
152
|
break;
|
|
156
153
|
}
|
|
157
|
-
if ((keyCode > 64 && keyCode < 91) || keyCode == 32
|
|
154
|
+
if ((keyCode > 64 && keyCode < 91) || keyCode == 32) {
|
|
158
155
|
e.preventDefault();
|
|
159
156
|
setInputValue(inputValue + key);
|
|
160
157
|
}
|
|
@@ -250,7 +247,6 @@ const Dropdown = ({
|
|
|
250
247
|
maxHeight={maxHeight}
|
|
251
248
|
open={isOpen}
|
|
252
249
|
ref={dropdownRef}
|
|
253
|
-
widthFitOptions={widthFitOptions}
|
|
254
250
|
tabIndex={0}
|
|
255
251
|
>
|
|
256
252
|
<Stack childGap="0">
|
|
@@ -3,7 +3,7 @@ import { required, hasLength } from "redux-freeform";
|
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
import StateProvinceDropdown from "../../atoms/state-province-dropdown";
|
|
5
5
|
import Checkbox from "../../atoms/checkbox";
|
|
6
|
-
|
|
6
|
+
import CountryDropdown from "../../atoms/country-dropdown";
|
|
7
7
|
import { zipFormat } from "../../../util/formats";
|
|
8
8
|
import { noop } from "../../../util/general";
|
|
9
9
|
import {
|
|
@@ -51,16 +51,16 @@ const AddressForm = ({
|
|
|
51
51
|
const stateProvinceErrorMessages = {
|
|
52
52
|
[required.error]: "State or Province is required"
|
|
53
53
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
const countryErrorMessages = {
|
|
55
|
+
[required.error]: "Country is required"
|
|
56
|
+
};
|
|
57
57
|
|
|
58
58
|
const isUS = fields.country.rawValue === "US";
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
61
|
<FormContainer variant={variant} role="form" aria-label="Address">
|
|
62
62
|
<FormInputColumn>
|
|
63
|
-
|
|
63
|
+
<CountryDropdown
|
|
64
64
|
labelTextWhenNoError="Country"
|
|
65
65
|
errorMessages={countryErrorMessages}
|
|
66
66
|
field={fields.country}
|
|
@@ -76,7 +76,7 @@ const AddressForm = ({
|
|
|
76
76
|
}
|
|
77
77
|
}}
|
|
78
78
|
showErrors={showErrors}
|
|
79
|
-
/>
|
|
79
|
+
/>
|
|
80
80
|
<FormInput
|
|
81
81
|
labelTextWhenNoError="Address"
|
|
82
82
|
errorMessages={street1ErrorMessages}
|