@abgov/jsonforms-components 1.43.1 → 1.43.3
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/index.esm.js +13 -8
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -7913,7 +7913,8 @@ const HelpContentComponent = _a => {
|
|
|
7913
7913
|
src: src,
|
|
7914
7914
|
width: width,
|
|
7915
7915
|
height: height,
|
|
7916
|
-
alt: alt || 'help-content-toggle-
|
|
7916
|
+
alt: alt || 'help-content-toggle-icon',
|
|
7917
|
+
"aria-label": "help-content-toggle-icon"
|
|
7917
7918
|
});
|
|
7918
7919
|
};
|
|
7919
7920
|
const textVariant = !((_c = uischema.options) === null || _c === void 0 ? void 0 : _c.variant) || ((_d = uischema.options) === null || _d === void 0 ? void 0 : _d.variant) !== 'details' && ((_e = uischema.options) === null || _e === void 0 ? void 0 : _e.variant) !== 'hyperlink';
|
|
@@ -8000,6 +8001,7 @@ const AddressLookUpControl = props => {
|
|
|
8000
8001
|
const [loading, setLoading] = useState(false);
|
|
8001
8002
|
const [errors, setErrors] = useState({});
|
|
8002
8003
|
const requiredFields = schema.required;
|
|
8004
|
+
const [dropdownSelected, setDropdownSelected] = useState(false);
|
|
8003
8005
|
const updateFormData = updatedAddress => {
|
|
8004
8006
|
setAddress(updatedAddress);
|
|
8005
8007
|
handleChange(path, updatedAddress);
|
|
@@ -8008,6 +8010,9 @@ const AddressLookUpControl = props => {
|
|
|
8008
8010
|
const dropdownRef = useRef(null);
|
|
8009
8011
|
const handleInputChange = (field, value) => {
|
|
8010
8012
|
var _a, _b;
|
|
8013
|
+
if (field === 'addressLine1' && searchTerm.length < 3) {
|
|
8014
|
+
setDropdownSelected(false);
|
|
8015
|
+
}
|
|
8011
8016
|
let newAddress;
|
|
8012
8017
|
const postalCodeErrorMessage = (_b = (_a = schema.errorMessage) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.postalCode;
|
|
8013
8018
|
if (field === 'postalCode') {
|
|
@@ -8034,7 +8039,7 @@ const AddressLookUpControl = props => {
|
|
|
8034
8039
|
};
|
|
8035
8040
|
useEffect(() => {
|
|
8036
8041
|
const fetchSuggestions = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
8037
|
-
if (searchTerm.length > 2) {
|
|
8042
|
+
if (searchTerm.length > 2 && dropdownSelected === false) {
|
|
8038
8043
|
setLoading(true);
|
|
8039
8044
|
setOpen(true);
|
|
8040
8045
|
yield fetchAddressSuggestions(formUrl, searchTerm, isAlbertaAddress).then(response => {
|
|
@@ -8052,7 +8057,7 @@ const AddressLookUpControl = props => {
|
|
|
8052
8057
|
}
|
|
8053
8058
|
});
|
|
8054
8059
|
fetchSuggestions();
|
|
8055
|
-
}, [searchTerm]);
|
|
8060
|
+
}, [searchTerm, dropdownSelected]);
|
|
8056
8061
|
const handleDropdownChange = value => {
|
|
8057
8062
|
setSearchTerm(value);
|
|
8058
8063
|
handleInputChange('addressLine1', value);
|
|
@@ -8063,6 +8068,7 @@ const AddressLookUpControl = props => {
|
|
|
8063
8068
|
handleChange(path, suggestAddress);
|
|
8064
8069
|
setSuggestions([]);
|
|
8065
8070
|
setErrors({});
|
|
8071
|
+
setDropdownSelected(true);
|
|
8066
8072
|
};
|
|
8067
8073
|
/* istanbul ignore next */
|
|
8068
8074
|
const handleRequiredFieldBlur = name => {
|
|
@@ -8117,9 +8123,7 @@ const AddressLookUpControl = props => {
|
|
|
8117
8123
|
ariaLabel: 'address-form-address1',
|
|
8118
8124
|
placeholder: "Start typing the first line of your address, required.",
|
|
8119
8125
|
value: (address === null || address === void 0 ? void 0 : address.addressLine1) || '',
|
|
8120
|
-
onChange: (e, value) =>
|
|
8121
|
-
handleDropdownChange(value);
|
|
8122
|
-
},
|
|
8126
|
+
onChange: (e, value) => handleDropdownChange(value),
|
|
8123
8127
|
onBlur: name => handleRequiredFieldBlur(name),
|
|
8124
8128
|
width: "100%",
|
|
8125
8129
|
onKeyPress: (e, value, key) => {
|
|
@@ -8131,10 +8135,9 @@ const AddressLookUpControl = props => {
|
|
|
8131
8135
|
variant: "inline",
|
|
8132
8136
|
size: "small",
|
|
8133
8137
|
visible: true
|
|
8134
|
-
}), suggestions && autocompletion && jsx("ul", {
|
|
8138
|
+
}), !loading && suggestions && autocompletion && jsx("ul", {
|
|
8135
8139
|
ref: dropdownRef,
|
|
8136
8140
|
className: "suggestions",
|
|
8137
|
-
tabIndex: 0,
|
|
8138
8141
|
children: suggestions && autocompletion && open && suggestions.map((suggestion, index) => jsx(ListItem, {
|
|
8139
8142
|
"data-index": index,
|
|
8140
8143
|
onMouseDown: e => {
|
|
@@ -8340,6 +8343,7 @@ const NameInputs = ({
|
|
|
8340
8343
|
return jsxs(GoAGrid, {
|
|
8341
8344
|
minChildWidth: "0ch",
|
|
8342
8345
|
gap: "s",
|
|
8346
|
+
mb: "m",
|
|
8343
8347
|
testId: "wrapper",
|
|
8344
8348
|
children: [jsx(GoAFormItem, {
|
|
8345
8349
|
testId: "formitem-first-name",
|
|
@@ -8556,6 +8560,7 @@ const FullNameDobControl = props => {
|
|
|
8556
8560
|
children: [jsxs(GoAGrid, {
|
|
8557
8561
|
minChildWidth: "0ch",
|
|
8558
8562
|
gap: "s",
|
|
8563
|
+
mb: "m",
|
|
8559
8564
|
children: [jsx(GoAFormItem, {
|
|
8560
8565
|
label: "First name",
|
|
8561
8566
|
requirement: ((_a = schema === null || schema === void 0 ? void 0 : schema.required) === null || _a === void 0 ? void 0 : _a.includes('firstName')) ? 'required' : undefined,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.43.
|
|
3
|
+
"version": "1.43.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
|
|
6
6
|
"repository": "https://github.com/GovAlta/adsp-monorepo",
|