@abgov/jsonforms-components 2.63.2 → 2.63.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 +74 -65
- package/package.json +1 -1
- package/renderer-catalog.json +2 -2
- package/src/lib/util/useSyncAutofillFields.d.ts +2 -1
package/index.esm.js
CHANGED
|
@@ -17721,6 +17721,7 @@ const NameInputs = ({
|
|
|
17721
17721
|
}) => {
|
|
17722
17722
|
var _displayedErrors$firs, _displayedErrors$last;
|
|
17723
17723
|
const [internalErrors, setInternalErrors] = useState({});
|
|
17724
|
+
const containerRef = useRef(null);
|
|
17724
17725
|
const currentValues = {
|
|
17725
17726
|
firstName,
|
|
17726
17727
|
middleName: middleName || '',
|
|
@@ -17729,8 +17730,8 @@ const NameInputs = ({
|
|
|
17729
17730
|
useEffect(() => {
|
|
17730
17731
|
const timeout = window.setTimeout(() => {
|
|
17731
17732
|
['firstName', 'middleName', 'lastName'].forEach(field => {
|
|
17732
|
-
var _input$value;
|
|
17733
|
-
const input =
|
|
17733
|
+
var _containerRef$current, _input$value;
|
|
17734
|
+
const input = (_containerRef$current = containerRef.current) == null ? void 0 : _containerRef$current.querySelector(`goa-input[name="${field}"]`);
|
|
17734
17735
|
const liveValue = (input == null || (_input$value = input.value) == null ? void 0 : _input$value.trim()) || '';
|
|
17735
17736
|
if (liveValue && !currentValues[field]) {
|
|
17736
17737
|
handleInputChange(field, liveValue);
|
|
@@ -17776,62 +17777,68 @@ const NameInputs = ({
|
|
|
17776
17777
|
handleRequiredFieldBlur(name);
|
|
17777
17778
|
}
|
|
17778
17779
|
};
|
|
17779
|
-
return
|
|
17780
|
-
|
|
17781
|
-
|
|
17782
|
-
|
|
17783
|
-
|
|
17784
|
-
children:
|
|
17785
|
-
|
|
17786
|
-
|
|
17787
|
-
|
|
17788
|
-
|
|
17789
|
-
children: jsx(
|
|
17790
|
-
|
|
17791
|
-
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
|
|
17795
|
-
|
|
17796
|
-
|
|
17797
|
-
|
|
17798
|
-
|
|
17799
|
-
|
|
17800
|
-
|
|
17801
|
-
|
|
17802
|
-
|
|
17803
|
-
|
|
17804
|
-
|
|
17805
|
-
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
|
|
17809
|
-
|
|
17810
|
-
|
|
17811
|
-
|
|
17812
|
-
|
|
17813
|
-
|
|
17814
|
-
|
|
17815
|
-
|
|
17816
|
-
|
|
17817
|
-
|
|
17818
|
-
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
|
|
17823
|
-
|
|
17824
|
-
|
|
17825
|
-
|
|
17826
|
-
|
|
17827
|
-
|
|
17828
|
-
|
|
17829
|
-
|
|
17830
|
-
|
|
17831
|
-
|
|
17832
|
-
|
|
17833
|
-
|
|
17834
|
-
|
|
17780
|
+
return jsx("div", {
|
|
17781
|
+
ref: containerRef,
|
|
17782
|
+
style: {
|
|
17783
|
+
display: 'contents'
|
|
17784
|
+
},
|
|
17785
|
+
children: jsxs(GoabGrid, {
|
|
17786
|
+
minChildWidth: "0ch",
|
|
17787
|
+
gap: "s",
|
|
17788
|
+
mb: "m",
|
|
17789
|
+
testId: "wrapper",
|
|
17790
|
+
children: [jsx(GoabFormItem, {
|
|
17791
|
+
testId: "form-item-first-name",
|
|
17792
|
+
label: "First name",
|
|
17793
|
+
requirement: requiredFields != null && requiredFields.includes('firstName') ? 'required' : undefined,
|
|
17794
|
+
error: (_displayedErrors$firs = displayedErrors == null ? void 0 : displayedErrors['firstName']) != null ? _displayedErrors$firs : '',
|
|
17795
|
+
children: jsx(GoabInput, {
|
|
17796
|
+
type: "text",
|
|
17797
|
+
name: "firstName",
|
|
17798
|
+
disabled: disabled,
|
|
17799
|
+
testId: "name-form-first-name",
|
|
17800
|
+
ariaLabel: 'name-form-first-name',
|
|
17801
|
+
value: firstName || '',
|
|
17802
|
+
onChange: detail => handleInputChange(detail.name, detail.value),
|
|
17803
|
+
onBlur: detail => {
|
|
17804
|
+
handleBlur(detail.name);
|
|
17805
|
+
},
|
|
17806
|
+
width: "100%"
|
|
17807
|
+
})
|
|
17808
|
+
}), jsx(GoabFormItem, {
|
|
17809
|
+
testId: "form-item-middle-name",
|
|
17810
|
+
label: "Middle name",
|
|
17811
|
+
requirement: requiredFields != null && requiredFields.includes('middleName') ? 'required' : undefined,
|
|
17812
|
+
children: jsx(GoabInput, {
|
|
17813
|
+
type: "text",
|
|
17814
|
+
name: "middleName",
|
|
17815
|
+
disabled: disabled,
|
|
17816
|
+
testId: "name-form-middle-name",
|
|
17817
|
+
ariaLabel: 'name-form-middle-name',
|
|
17818
|
+
value: middleName || '',
|
|
17819
|
+
onChange: detail => handleInputChange(detail.name, detail.value),
|
|
17820
|
+
width: "100%"
|
|
17821
|
+
})
|
|
17822
|
+
}), jsx(GoabFormItem, {
|
|
17823
|
+
testId: "form-item-last-name",
|
|
17824
|
+
label: "Last name",
|
|
17825
|
+
requirement: requiredFields != null && requiredFields.includes('lastName') ? 'required' : undefined,
|
|
17826
|
+
error: (_displayedErrors$last = displayedErrors == null ? void 0 : displayedErrors['lastName']) != null ? _displayedErrors$last : '',
|
|
17827
|
+
children: jsx(GoabInput, {
|
|
17828
|
+
type: "text",
|
|
17829
|
+
name: "lastName",
|
|
17830
|
+
disabled: disabled,
|
|
17831
|
+
testId: "name-form-last-name",
|
|
17832
|
+
ariaLabel: 'name-form-last-name',
|
|
17833
|
+
value: lastName || '',
|
|
17834
|
+
onChange: detail => handleInputChange(detail.name, detail.value),
|
|
17835
|
+
onBlur: detail => {
|
|
17836
|
+
handleBlur(detail.name);
|
|
17837
|
+
},
|
|
17838
|
+
width: "100%"
|
|
17839
|
+
})
|
|
17840
|
+
})]
|
|
17841
|
+
})
|
|
17835
17842
|
});
|
|
17836
17843
|
};
|
|
17837
17844
|
|
|
@@ -17972,14 +17979,16 @@ formData,
|
|
|
17972
17979
|
// eslint-disable-next-line
|
|
17973
17980
|
updateFormData,
|
|
17974
17981
|
// eslint-disable-next-line
|
|
17975
|
-
handleRequiredFieldBlur) {
|
|
17982
|
+
handleRequiredFieldBlur, rootRef) {
|
|
17976
17983
|
/* istanbul ignore next */
|
|
17977
17984
|
useEffect(() => {
|
|
17978
17985
|
const rAF = requestAnimationFrame(() => {
|
|
17979
17986
|
const timeout = setTimeout(() => {
|
|
17980
17987
|
const updated = {};
|
|
17981
17988
|
fields.forEach(field => {
|
|
17982
|
-
|
|
17989
|
+
var _rootRef$current;
|
|
17990
|
+
const root = (_rootRef$current = rootRef == null ? void 0 : rootRef.current) != null ? _rootRef$current : document;
|
|
17991
|
+
const input = root.querySelector(`goa-input[name="${field}"]`);
|
|
17983
17992
|
if (input && input.value && !(formData != null && formData[field])) {
|
|
17984
17993
|
updated[field] = input.value;
|
|
17985
17994
|
}
|
|
@@ -18049,9 +18058,9 @@ const FullNameDobControl = props => {
|
|
|
18049
18058
|
};
|
|
18050
18059
|
// eslint-disable-next-line
|
|
18051
18060
|
const handleRequiredFieldBlur = (name, updatedData) => {
|
|
18052
|
-
var _ref, _ref2, _updatedData$name,
|
|
18061
|
+
var _ref, _ref2, _updatedData$name, _controlRef$current;
|
|
18053
18062
|
const err = Object.assign({}, errors);
|
|
18054
|
-
const liveInputValue = (_ref = (_ref2 = (_updatedData$name = updatedData == null ? void 0 : updatedData[name]) != null ? _updatedData$name : data == null ? void 0 : data[name]) != null ? _ref2 : (
|
|
18063
|
+
const liveInputValue = (_ref = (_ref2 = (_updatedData$name = updatedData == null ? void 0 : updatedData[name]) != null ? _updatedData$name : data == null ? void 0 : data[name]) != null ? _ref2 : (_controlRef$current = controlRef.current) == null || (_controlRef$current = _controlRef$current.querySelector(`goa-input[name="${name}"]`)) == null ? void 0 : _controlRef$current.value) != null ? _ref : '';
|
|
18055
18064
|
if (requiredFields.includes(name) && liveInputValue.trim() === '') {
|
|
18056
18065
|
err[name] = `${getRequiredLabel(name)} is required`;
|
|
18057
18066
|
} else {
|
|
@@ -18059,10 +18068,10 @@ const FullNameDobControl = props => {
|
|
|
18059
18068
|
}
|
|
18060
18069
|
setErrors(err);
|
|
18061
18070
|
};
|
|
18062
|
-
useSyncAutofillFields(AUTOFILL_FIELDS, formData, updateFormData, handleRequiredFieldBlur);
|
|
18071
|
+
useSyncAutofillFields(AUTOFILL_FIELDS, formData, updateFormData, handleRequiredFieldBlur, controlRef);
|
|
18063
18072
|
useEffect(() => {
|
|
18064
|
-
var _controlRef$current$q, _controlRef$
|
|
18065
|
-
const host = (_controlRef$current$q = (_controlRef$
|
|
18073
|
+
var _controlRef$current$q, _controlRef$current2, _host$shadowRoot;
|
|
18074
|
+
const host = (_controlRef$current$q = (_controlRef$current2 = controlRef.current) == null ? void 0 : _controlRef$current2.querySelector('goa-input[type="date"]')) != null ? _controlRef$current$q : null;
|
|
18066
18075
|
host == null || (_host$shadowRoot = host.shadowRoot) == null || _host$shadowRoot.querySelector('input[type="date"]');
|
|
18067
18076
|
ensureGoaDatePointerCursor(host);
|
|
18068
18077
|
}, []);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.63.
|
|
3
|
+
"version": "2.63.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",
|
package/renderer-catalog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-05-
|
|
4
|
-
"sourceCommit": "
|
|
3
|
+
"generatedAt": "2026-05-11T21:26:03.548Z",
|
|
4
|
+
"sourceCommit": "b4b6b92cea3e3a44973de17d0d76c1f60409f930",
|
|
5
5
|
"sourcePath": "libs/jsonforms-components/src/index.ts",
|
|
6
6
|
"rendererCount": 33,
|
|
7
7
|
"renderers": [
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
export declare function useSyncAutofillFields(fields: string[], formData: any, updateFormData: (data: any) => void, handleRequiredFieldBlur: (name: string, updatedData?: any) => void, rootRef?: RefObject<HTMLElement>): void;
|