@abgov/jsonforms-components 2.66.4 → 2.67.0

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 CHANGED
@@ -6,7 +6,7 @@ import Ajv from 'ajv';
6
6
  import styled from 'styled-components';
7
7
  import axios from 'axios';
8
8
  import get$1 from 'lodash/get';
9
- import { isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, or, isOneOfEnumControl, isBooleanControl, createDefaultValue, Paths, Resolve, toDataPath, schemaTypeIs, formatIs, getAjv, schemaMatches, isObjectArrayControl, isPrimitiveArrayControl, composePaths, hasType, isCategorization, isLayout } from '@jsonforms/core';
9
+ import { isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, or, isOneOfEnumControl, isBooleanControl, createDefaultValue, Paths, Resolve, toDataPath, schemaTypeIs, formatIs, getAjv, schemaMatches, isObjectArrayControl, isPrimitiveArrayControl, composePaths, hasType, isCategorization, isLayout, INIT, UPDATE_CORE } from '@jsonforms/core';
10
10
  import * as _$c from 'lodash';
11
11
  import ___default, { isObject as isObject$i, isEmpty as isEmpty$1 } from 'lodash';
12
12
  import { useJsonForms, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsArrayLayoutProps, withJsonFormsLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
@@ -4103,7 +4103,7 @@ const onKeyPressForTimeControl = props => {
4103
4103
  path
4104
4104
  } = controlProps;
4105
4105
  if (isNotKeyPressTabOrShift(key)) {
4106
- handleChange(path, value === '' ? undefined : value);
4106
+ handleChange(path, value);
4107
4107
  }
4108
4108
  };
4109
4109
  /**
@@ -4124,7 +4124,7 @@ const onKeyPressForDateControl = props => {
4124
4124
  } = controlProps;
4125
4125
  if (isNotKeyPressTabOrShift(key)) {
4126
4126
  value = standardizeDate(value) || '';
4127
- handleChange(path, value === '' ? undefined : value);
4127
+ handleChange(path, value);
4128
4128
  }
4129
4129
  };
4130
4130
  /**
@@ -4141,7 +4141,7 @@ const onBlurForTextControl = props => {
4141
4141
  path
4142
4142
  } = controlProps;
4143
4143
  if (isRequiredAndHasNoData(controlProps)) {
4144
- handleChange(path, value === '' ? undefined : value);
4144
+ handleChange(path, value);
4145
4145
  }
4146
4146
  };
4147
4147
  /**
@@ -4182,7 +4182,7 @@ const onBlurForDateControl = props => {
4182
4182
  } = controlProps;
4183
4183
  if (isRequiredAndHasNoData(controlProps)) {
4184
4184
  value = standardizeDate(value) || '';
4185
- handleChange(path, value === '' ? undefined : value);
4185
+ handleChange(path, value);
4186
4186
  }
4187
4187
  };
4188
4188
  /**
@@ -4204,7 +4204,7 @@ const onChangeForDateControl = props => {
4204
4204
  if (value && value !== null) {
4205
4205
  value = standardizeDate(value) || '';
4206
4206
  if (value !== data) {
4207
- handleChange(path, value === '' ? undefined : value);
4207
+ handleChange(path, value);
4208
4208
  }
4209
4209
  }
4210
4210
  };
@@ -4223,7 +4223,7 @@ const onChangeForInputControl = props => {
4223
4223
  handleChange,
4224
4224
  path
4225
4225
  } = controlProps;
4226
- handleChange(path, value === '' ? undefined : value);
4226
+ handleChange(path, value);
4227
4227
  };
4228
4228
  /**
4229
4229
  * Helper function to process onChange event for Date controls.
@@ -4245,19 +4245,23 @@ const onChangeForDateTimeControl = props => {
4245
4245
  var _Date;
4246
4246
  value = isValidDate(value) ? (_Date = new Date(value)) == null ? void 0 : _Date.toISOString() : '';
4247
4247
  if (data !== value) {
4248
- handleChange(path, value === '' ? undefined : value);
4248
+ handleChange(path, value);
4249
4249
  }
4250
4250
  }
4251
4251
  };
4252
+ const toNumericControlValue = value => {
4253
+ if (value === '' || value === null || value === undefined || value instanceof Date) {
4254
+ return undefined;
4255
+ }
4256
+ return +value;
4257
+ };
4252
4258
  /**
4253
4259
  * Helper function to process onChange event for Number/Integer controls.
4254
4260
  * @param props - EventChangeControlProps
4255
4261
  */
4256
4262
  const onChangeForNumericControl = props => {
4257
4263
  const {
4258
- value
4259
- } = props;
4260
- const {
4264
+ value,
4261
4265
  controlProps
4262
4266
  } = props;
4263
4267
  const {
@@ -4265,18 +4269,9 @@ const onChangeForNumericControl = props => {
4265
4269
  path,
4266
4270
  data
4267
4271
  } = controlProps;
4268
- if (value && value !== null) {
4269
- //Prevents handleChange from executing if the data has not changed
4270
- //so the component will not re render.
4271
- if (data !== +value) {
4272
- let newValue = undefined;
4273
- if (value !== '') {
4274
- newValue = +value;
4275
- }
4276
- handleChange(path, newValue);
4277
- }
4278
- } else {
4279
- handleChange(path, value === '' ? undefined : value);
4272
+ const newValue = toNumericControlValue(value);
4273
+ if (data !== newValue) {
4274
+ handleChange(path, newValue);
4280
4275
  }
4281
4276
  };
4282
4277
  const ensureGoaDatePointerCursor = host => {
@@ -4425,8 +4420,8 @@ if ($stringify) {
4425
4420
  });
4426
4421
  }
4427
4422
 
4428
- const defineFields$1 = fields => fields;
4429
- const OPTION_DEFINITIONS = defineFields$1({
4423
+ const defineFields = fields => fields;
4424
+ const OPTION_DEFINITIONS = defineFields({
4430
4425
  mainTitle: {
4431
4426
  schema: 'Main form title'
4432
4427
  },
@@ -4442,6 +4437,9 @@ const OPTION_DEFINITIONS = defineFields$1({
4442
4437
  emailFirst: {
4443
4438
  schema: true
4444
4439
  },
4440
+ autoPopulate: {
4441
+ schema: 'firstName'
4442
+ },
4445
4443
  noDataMessage: {
4446
4444
  schema: 'no data'
4447
4445
  },
@@ -6859,6 +6857,9 @@ const createStepperContextInitData = props => {
6859
6857
  };
6860
6858
  };
6861
6859
  const JsonFormsStepperContext = /*#__PURE__*/createContext(undefined);
6860
+ const isFormValid = (ajvValid, emptyRequiredStringErrors) => {
6861
+ return ajvValid && emptyRequiredStringErrors.length === 0;
6862
+ };
6862
6863
  const JsonFormsStepperContextProvider = ({
6863
6864
  children,
6864
6865
  StepperProps
@@ -6895,6 +6896,8 @@ const JsonFormsStepperContextProvider = ({
6895
6896
  stepperDispatch,
6896
6897
  selectStepperState: () => {
6897
6898
  var _stepperState$categor;
6899
+ const emptyRequiredStringErrors = getEmptyRequiredStringErrors(data || {}, schema);
6900
+ stepperState.isValid = isFormValid(stepperState.isValid, emptyRequiredStringErrors);
6898
6901
  return Object.assign({}, stepperState, {
6899
6902
  categories: (_stepperState$categor = stepperState.categories) == null ? void 0 : _stepperState$categor.map(c => {
6900
6903
  return Object.assign({}, c, {
@@ -7009,6 +7012,58 @@ const JsonFormsStepperContextProvider = ({
7009
7012
  children: children
7010
7013
  });
7011
7014
  };
7015
+ const isSchemaObject = schema => {
7016
+ return !!schema && typeof schema === 'object' && !Array.isArray(schema);
7017
+ };
7018
+ const getObjectData = data => {
7019
+ return data && typeof data === 'object' && !Array.isArray(data) ? data : {};
7020
+ };
7021
+ const isRequiredStringSchema = schema => {
7022
+ return isSchemaObject(schema) && schema.type === 'string';
7023
+ };
7024
+ const createRequiredStringError = (schema, propertyName, instancePath, schemaPath) => ({
7025
+ instancePath: `${instancePath}/${propertyName}`,
7026
+ schemaPath: `${schemaPath}/requiredString`,
7027
+ keyword: 'requiredString',
7028
+ params: {
7029
+ propertyName
7030
+ },
7031
+ message: 'is required',
7032
+ schema: true,
7033
+ parentSchema: schema,
7034
+ data: ''
7035
+ });
7036
+ const addEmptyRequiredStringErrors = (data, schema, instancePath, schemaPath, errors) => {
7037
+ var _schema$required, _schema$properties;
7038
+ const required = (_schema$required = schema.required) != null ? _schema$required : [];
7039
+ const properties = (_schema$properties = schema.properties) != null ? _schema$properties : {};
7040
+ for (const propertyName of required) {
7041
+ const propertySchema = properties[propertyName];
7042
+ if (isRequiredStringSchema(propertySchema) && data[propertyName] === '') {
7043
+ errors.push(createRequiredStringError(schema, propertyName, instancePath, schemaPath));
7044
+ }
7045
+ }
7046
+ };
7047
+ const collectEmptyRequiredStringErrors = (data, schema, instancePath, schemaPath, errors) => {
7048
+ var _schema$properties2;
7049
+ if (!isSchemaObject(schema)) {
7050
+ return;
7051
+ }
7052
+ const objectData = getObjectData(data);
7053
+ const properties = (_schema$properties2 = schema.properties) != null ? _schema$properties2 : {};
7054
+ addEmptyRequiredStringErrors(objectData, schema, instancePath, schemaPath, errors);
7055
+ for (const [propertyName, propertySchema] of Object.entries(properties)) {
7056
+ if (!isSchemaObject(propertySchema)) {
7057
+ continue;
7058
+ }
7059
+ collectEmptyRequiredStringErrors(objectData[propertyName], propertySchema, `${instancePath}/${propertyName}`, `${schemaPath}/properties/${propertyName}`, errors);
7060
+ }
7061
+ };
7062
+ const getEmptyRequiredStringErrors = (data, schema) => {
7063
+ const errors = [];
7064
+ collectEmptyRequiredStringErrors(data, schema, '', '#', errors);
7065
+ return errors;
7066
+ };
7012
7067
 
7013
7068
  const GoAInputBaseControl = props => {
7014
7069
  var _stepperState$categor, _uischema$options$com, _uischema$options, _uischema$options2, _uischema$options3;
@@ -7302,7 +7357,6 @@ const InnerGoAInputText = props => {
7302
7357
  isVisited,
7303
7358
  setIsVisited
7304
7359
  } = props;
7305
- useRegisterUser();
7306
7360
  const isSinField = schema.title === sinTitle;
7307
7361
  const initialValue = isSinField && typeof data === 'string' ? formatSinForDisplay(data) : data;
7308
7362
  const [manualInput, setManualInput] = useState(false);
@@ -10377,94 +10431,6 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa
10377
10431
  ];
10378
10432
  }, BUGGY || !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
10379
10433
 
10380
- const defineFields = fields => fields;
10381
- const autoLabel = name => `${name} (auto from user profile)`;
10382
- const buildInsertText = (key, schema) => `${key}": ${JSON.stringify(schema, null, 2)}`;
10383
- const getNameParts = user => {
10384
- const [first = '', last = ''] = ((user == null ? void 0 : user.name) || '').split(' ');
10385
- return {
10386
- first,
10387
- last
10388
- };
10389
- };
10390
- const fullNameSchema = {
10391
- type: 'string',
10392
- minLength: 3,
10393
- description: 'Please enter your full name'
10394
- };
10395
- const firstNameSchema = {
10396
- type: 'string',
10397
- minLength: 3,
10398
- description: 'Please enter your first name'
10399
- };
10400
- const lastNameSchema = {
10401
- type: 'string',
10402
- minLength: 3,
10403
- description: 'Please enter your last name'
10404
- };
10405
- const emailSchema = {
10406
- type: 'string',
10407
- format: 'email',
10408
- maxLength: 100,
10409
- pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,}$',
10410
- description: 'Please enter a valid email address (e.g., name@example.com).',
10411
- errorMessage: {
10412
- pattern: '(e.g., name@example.com).',
10413
- maxLength: 'Email must be less than 100 characters.'
10414
- }
10415
- };
10416
- const USER_FIELD_DEFINITIONS = defineFields({
10417
- fullName: {
10418
- schema: fullNameSchema,
10419
- getValue: user => user == null ? void 0 : user.name
10420
- },
10421
- name: {
10422
- schema: fullNameSchema,
10423
- getValue: user => user == null ? void 0 : user.name
10424
- },
10425
- firstName: {
10426
- schema: firstNameSchema,
10427
- getValue: user => getNameParts(user).first
10428
- },
10429
- givenName: {
10430
- schema: firstNameSchema,
10431
- getValue: user => getNameParts(user).first
10432
- },
10433
- lastName: {
10434
- schema: lastNameSchema,
10435
- getValue: user => getNameParts(user).last
10436
- },
10437
- familyName: {
10438
- schema: lastNameSchema,
10439
- getValue: user => getNameParts(user).last
10440
- },
10441
- surname: {
10442
- schema: lastNameSchema,
10443
- getValue: user => getNameParts(user).last
10444
- },
10445
- email: {
10446
- schema: emailSchema,
10447
- getValue: user => (user == null ? void 0 : user.email) || ''
10448
- },
10449
- emailAddress: {
10450
- schema: emailSchema,
10451
- getValue: user => (user == null ? void 0 : user.email) || ''
10452
- },
10453
- primaryEmail: {
10454
- schema: emailSchema,
10455
- getValue: user => (user == null ? void 0 : user.email) || ''
10456
- }
10457
- });
10458
- const autoPopulateValue = (user, props) => {
10459
- const field = USER_FIELD_DEFINITIONS[props.path];
10460
- if (!field) return undefined;
10461
- return field.getValue(user);
10462
- };
10463
- const autoPopulatePropertiesMonaco = Object.entries(USER_FIELD_DEFINITIONS).map(([key, field]) => ({
10464
- label: autoLabel(key),
10465
- insertText: buildInsertText(key, field.schema)
10466
- }));
10467
-
10468
10434
  const defaultLabel = 'Email address';
10469
10435
  const GoAEmailInput = props => {
10470
10436
  var _uischema$options$com, _uischema$options, _uischema$options$com2, _uischema$options2, _stepperState$categor;
@@ -10485,13 +10451,18 @@ const GoAEmailInput = props => {
10485
10451
  const appliedUiSchemaOptions = Object.assign({}, config, uischema == null ? void 0 : uischema.options);
10486
10452
  const readOnly = (_uischema$options$com = uischema == null || (_uischema$options = uischema.options) == null || (_uischema$options = _uischema$options.componentProps) == null ? void 0 : _uischema$options.readOnly) != null ? _uischema$options$com : false;
10487
10453
  const width = (_uischema$options$com2 = uischema == null || (_uischema$options2 = uischema.options) == null || (_uischema$options2 = _uischema$options2.componentProps) == null ? void 0 : _uischema$options2.width) != null ? _uischema$options$com2 : '100%';
10488
- const user = useRegisterUser();
10489
10454
  const formStepperCtx = useContext(JsonFormsStepperContext);
10490
10455
  const stepperState = formStepperCtx == null || formStepperCtx.selectStepperState == null ? void 0 : formStepperCtx.selectStepperState();
10491
10456
  const currentCategory = stepperState == null || (_stepperState$categor = stepperState.categories) == null ? void 0 : _stepperState$categor[stepperState == null ? void 0 : stepperState.activeId];
10492
10457
  const showReviewLink = currentCategory == null ? void 0 : currentCategory.showReviewPageLink;
10493
10458
  const [localValue, setLocalValue] = useState(data);
10494
10459
  const debouncedValue = useDebounce(localValue, 300);
10460
+ useEffect(() => {
10461
+ if (data === undefined || data === null) {
10462
+ return;
10463
+ }
10464
+ setLocalValue(data);
10465
+ }, [data]);
10495
10466
  /* istanbul ignore next */
10496
10467
  useEffect(() => {
10497
10468
  if (debouncedValue === data) return;
@@ -10503,7 +10474,6 @@ const GoAEmailInput = props => {
10503
10474
  });
10504
10475
  }
10505
10476
  }, [debouncedValue]);
10506
- const [manualInput, setManualInput] = useState(false);
10507
10477
  const [isVisited, setIsVisited] = useState(false);
10508
10478
  useEffect(() => {
10509
10479
  if (showReviewLink === true) {
@@ -10515,14 +10485,6 @@ const GoAEmailInput = props => {
10515
10485
  const splintIndex = splitErrors.findIndex(e => e === REQUIRED_PROPERTY_ERROR);
10516
10486
  splitErrors[splintIndex] = `${primaryLabel} is required`;
10517
10487
  const finalErrors = splitErrors.join('\n');
10518
- useEffect(() => {
10519
- if (!user || data) return;
10520
- const autoPopulatedValue = schema.default || user && autoPopulateValue(user, props);
10521
- if (autoPopulatedValue && autoPopulatedValue !== data && !manualInput) {
10522
- handleChange(props.path, autoPopulatedValue);
10523
- }
10524
- // eslint-disable-next-line react-hooks/exhaustive-deps
10525
- }, [schema, user]);
10526
10488
  useEffect(() => {
10527
10489
  if (typeof handleChange === 'function' && (schema == null ? void 0 : schema.default) !== undefined) {
10528
10490
  handleChange(props.path, schema.default);
@@ -10549,7 +10511,6 @@ const GoAEmailInput = props => {
10549
10511
  disabled: !enabled,
10550
10512
  readonly: readOnly,
10551
10513
  onChange: detail => {
10552
- setManualInput(true);
10553
10514
  if (!isVisited) {
10554
10515
  setIsVisited(true);
10555
10516
  }
@@ -18870,6 +18831,158 @@ async function tryResolveRefs(schema, ...refSchemas) {
18870
18831
  }
18871
18832
  }
18872
18833
 
18834
+ const AUTO_POPULATE_SOURCES = ['firstName', 'lastName', 'email'];
18835
+ const getNameParts = user => {
18836
+ const parts = ((user == null ? void 0 : user.name) || '').trim().split(/\s+/).filter(Boolean);
18837
+ return {
18838
+ firstName: parts[0] || '',
18839
+ lastName: parts.length > 1 ? parts[parts.length - 1] : ''
18840
+ };
18841
+ };
18842
+ /**
18843
+ * @deprecated Field names no longer control auto-population. Use the
18844
+ * UI-schema `options.autoPopulate` directive.
18845
+ */
18846
+ const USER_FIELD_DEFINITIONS = {
18847
+ fullName: {
18848
+ schema: {
18849
+ type: 'string'
18850
+ },
18851
+ getValue: user => user == null ? void 0 : user.name
18852
+ },
18853
+ name: {
18854
+ schema: {
18855
+ type: 'string'
18856
+ },
18857
+ getValue: user => user == null ? void 0 : user.name
18858
+ },
18859
+ firstName: {
18860
+ schema: {
18861
+ type: 'string'
18862
+ },
18863
+ getValue: user => getNameParts(user).firstName
18864
+ },
18865
+ givenName: {
18866
+ schema: {
18867
+ type: 'string'
18868
+ },
18869
+ getValue: user => getNameParts(user).firstName
18870
+ },
18871
+ lastName: {
18872
+ schema: {
18873
+ type: 'string'
18874
+ },
18875
+ getValue: user => getNameParts(user).lastName
18876
+ },
18877
+ familyName: {
18878
+ schema: {
18879
+ type: 'string'
18880
+ },
18881
+ getValue: user => getNameParts(user).lastName
18882
+ },
18883
+ surname: {
18884
+ schema: {
18885
+ type: 'string'
18886
+ },
18887
+ getValue: user => getNameParts(user).lastName
18888
+ },
18889
+ email: {
18890
+ schema: {
18891
+ type: 'string',
18892
+ format: 'email'
18893
+ },
18894
+ getValue: user => (user == null ? void 0 : user.email) || ''
18895
+ },
18896
+ emailAddress: {
18897
+ schema: {
18898
+ type: 'string',
18899
+ format: 'email'
18900
+ },
18901
+ getValue: user => (user == null ? void 0 : user.email) || ''
18902
+ },
18903
+ primaryEmail: {
18904
+ schema: {
18905
+ type: 'string',
18906
+ format: 'email'
18907
+ },
18908
+ getValue: user => (user == null ? void 0 : user.email) || ''
18909
+ }
18910
+ };
18911
+ const AUTO_POPULATE_ACTION_TYPES = new Set([INIT, UPDATE_CORE]);
18912
+ const isEmptyAutoPopulateTarget = value => value === undefined || value === null || value === '';
18913
+ const shouldAutoPopulate = actionType => AUTO_POPULATE_ACTION_TYPES.has(actionType);
18914
+ const isAutoPopulateSource = value => typeof value === 'string' && AUTO_POPULATE_SOURCES.includes(value);
18915
+ const autoPopulateValue = (user, props) => {
18916
+ var _props$uischema;
18917
+ const source = (_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.autoPopulate;
18918
+ if (!isAutoPopulateSource(source)) {
18919
+ return undefined;
18920
+ }
18921
+ const name = getNameParts(user);
18922
+ const values = {
18923
+ firstName: name.firstName,
18924
+ lastName: name.lastName,
18925
+ email: (user == null ? void 0 : user.email) || ''
18926
+ };
18927
+ return values[source];
18928
+ };
18929
+ const getAutoPopulateControls = element => {
18930
+ var _element$options, _element$elements;
18931
+ if (!element) {
18932
+ return [];
18933
+ }
18934
+ const controls = element.type === 'Control' && (_element$options = element.options) != null && _element$options.autoPopulate ? [element] : [];
18935
+ const children = (_element$elements = element.elements) != null ? _element$elements : [];
18936
+ return [...controls, ...children.flatMap(getAutoPopulateControls)];
18937
+ };
18938
+ const getAutoPopulatedData = (uischema, user) => {
18939
+ if (!user) {
18940
+ return [];
18941
+ }
18942
+ return getAutoPopulateControls(uischema).map(control => ({
18943
+ path: toDataPath(control.scope),
18944
+ value: autoPopulateValue(user, {
18945
+ uischema: control
18946
+ })
18947
+ })).filter(({
18948
+ path,
18949
+ value
18950
+ }) => Boolean(path) && value !== undefined && value !== null);
18951
+ };
18952
+ const mergeAutoPopulatedData = (data, autoPopulatedData) => {
18953
+ if (autoPopulatedData.length === 0) {
18954
+ return data;
18955
+ }
18956
+ const defaults = autoPopulatedData.reduce((values, {
18957
+ path,
18958
+ value
18959
+ }) => _$c.set(values, path, value), {});
18960
+ const normalizedData = _$c.cloneDeep(data != null ? data : {});
18961
+ autoPopulatedData.forEach(({
18962
+ path,
18963
+ value
18964
+ }) => {
18965
+ if (isEmptyAutoPopulateTarget(_$c.get(normalizedData, path)) && value !== undefined && value !== null) {
18966
+ _$c.unset(normalizedData, path);
18967
+ }
18968
+ });
18969
+ return _$c.defaultsDeep({}, normalizedData, defaults);
18970
+ };
18971
+ const createAutoPopulateMiddleware = (uischema, user) => (state, action, defaultReducer) => {
18972
+ const newState = defaultReducer(state, action);
18973
+ if (!shouldAutoPopulate(action.type)) {
18974
+ return newState;
18975
+ }
18976
+ return Object.assign({}, newState, {
18977
+ data: mergeAutoPopulatedData(newState.data, getAutoPopulatedData(uischema, user))
18978
+ });
18979
+ };
18980
+ /**
18981
+ * Retained for compatibility with consumers of the previous data-schema
18982
+ * autocomplete API. Auto-population is now configured in the UI schema.
18983
+ */
18984
+ const autoPopulatePropertiesMonaco = [];
18985
+
18873
18986
  const GoABaseRenderers = [
18874
18987
  // controls
18875
18988
  {
@@ -19136,4 +19249,4 @@ const GoARenderers = [...GoABaseRenderers, {
19136
19249
  }];
19137
19250
  const GoACells = [...InputCells];
19138
19251
 
19139
- export { ADD_DATALIST_ACTION, ADD_NO_ANONYMOUS_ACTION, ADD_REGISTER_DATA_ACTION, ADD_REGISTER_DATA_ERROR, ADD_USER_ACTION, AddressLookUpControl, AddressLookUpControlReview, AddressLookUpTester, AddressLoopUpControlTableReview, ArrayControl, ArrayControlBase, ArrayControlReview, BooleanComponent, BooleanControl, BooleanRadioComponent, BooleanRadioControl, CategorizationPagesRendererTester, CategorizationStepperRendererTester, CheckboxGroup, ContactInformationTester, ContextProviderC, ContextProviderClass, ContextProviderFactory, ContractInfoControl, ContractInfoControlReview, EnumCheckboxControl, EnumRadioControl, EnumSelect, FileUploader, FileUploaderReview, FileUploaderTester, FormPageStepper, FormPagesView, FormStepper, FormStepperControl, FormStepperPagesControl, FormStepperReviewControl, FormStepperReviewer, FormStepperView, FullNameControl, FullNameControlReview, FullNameDobControl, FullNameDobReviewControl, FullNameDobTester, FullNameReviewControl, FullNameTester, GoAArrayControlRenderer, GoAArrayControlReviewRenderer, GoAArrayControlTester, GoABaseInputReviewComponent, GoABaseRenderers, GoABaseReviewRenderers, GoABaseTableReviewRenderers, GoABooleanControl, GoABooleanControlTester, GoABooleanRadioControl, GoABooleanRadioControlTester, GoACalculationControl, GoACalculationControlTester, GoACells, GoACheckoutGroupControlTester, GoAContractInfoControlReview, GoADateControl, GoADateControlTester, GoADateInput, GoADateTimeControl, GoADateTimeControlTester, GoADateTimeInput, GoAEmailControl, GoAEmailControlTester, GoAEmailInput, GoAEnumCheckboxGroupControl, GoAEnumControl, GoAEnumControlTester, GoAEnumRadioGroupControl, GoAInputBaseControl, GoAInputBaseFullNameControlReview, GoAInputBaseFullNameDobControlReview, GoAInputBaseReviewControl, GoAInputBaseTableReview, GoAInputBaseTableReviewControl, GoAInputDateControl, GoAInputDateTimeControl, GoAInputEmailControl, GoAInputIntegerControl, GoAInputNumberControl, GoAInputText, GoAInputTextControl, GoAInputTimeControl, GoAIntegerControl, GoAIntegerControlTester, GoAListWithDetailsControlRenderer, GoAListWithDetailsTester, GoANumberControl, GoANumberControlTester, GoANumberInput, GoAPhoneNumberControl, GoAPhoneNumberWithTypeControl, GoAPrimitiveArrayRenderer, GoAPrimitiveArrayTester, GoARadioGroupControlTester, GoARenderers, GoAReviewRenderers, GoATextControl, GoATextControlTester, GoATimeControl, GoATimeControlTester, GoATimeInput, GoInputBaseReview, GoabInputBasePhoneNumberReviewControl, GoabInputBasePhoneNumberWithTypeReviewControl, GoabInputInteger, InnerGoAInputText, JsonFormContext, JsonFormRegisterProvider, JsonFormsRegisterContext, ListWithDetailsControl, MultiLineText, MultiLineTextControl, MultiLineTextControlInput, MultiLineTextControlTester, OPTION_DEFINITIONS, PHONE_REGEX, PhoneGrid, PhoneNumberControl, PhoneNumberReviewControl, PhoneNumberTester, PhoneNumberWithTypeControl, PhoneNumberWithTypeReviewControl, PhoneNumberWithTypeTester, PrimitiveArrayControl, RadioGroup, USER_FIELD_DEFINITIONS, autoPopulatePropertiesMonaco, autoPopulateValue, categoriesAreValid, createDefaultAjv, enumControl, errMalformedDate, fetchRegisterConfigFromOptions$1 as fetchRegisterConfigFromOptions, formatSin, getByJsonPointer, getCategoryScopes, hasDataInScopes, hasDataValue, isAddressLookup, isContactInformation, isFullName, isFullNameDoB, isPhoneNumberWithType, predictiveOptionsMonaco, registerReducer, resolveRefs, toDateTimeLocalInputValue, tryResolveRefs, useRegisterUser };
19252
+ export { ADD_DATALIST_ACTION, ADD_NO_ANONYMOUS_ACTION, ADD_REGISTER_DATA_ACTION, ADD_REGISTER_DATA_ERROR, ADD_USER_ACTION, AUTO_POPULATE_SOURCES, AddressLookUpControl, AddressLookUpControlReview, AddressLookUpTester, AddressLoopUpControlTableReview, ArrayControl, ArrayControlBase, ArrayControlReview, BooleanComponent, BooleanControl, BooleanRadioComponent, BooleanRadioControl, CategorizationPagesRendererTester, CategorizationStepperRendererTester, CheckboxGroup, ContactInformationTester, ContextProviderC, ContextProviderClass, ContextProviderFactory, ContractInfoControl, ContractInfoControlReview, EnumCheckboxControl, EnumRadioControl, EnumSelect, FileUploader, FileUploaderReview, FileUploaderTester, FormPageStepper, FormPagesView, FormStepper, FormStepperControl, FormStepperPagesControl, FormStepperReviewControl, FormStepperReviewer, FormStepperView, FullNameControl, FullNameControlReview, FullNameDobControl, FullNameDobReviewControl, FullNameDobTester, FullNameReviewControl, FullNameTester, GoAArrayControlRenderer, GoAArrayControlReviewRenderer, GoAArrayControlTester, GoABaseInputReviewComponent, GoABaseRenderers, GoABaseReviewRenderers, GoABaseTableReviewRenderers, GoABooleanControl, GoABooleanControlTester, GoABooleanRadioControl, GoABooleanRadioControlTester, GoACalculationControl, GoACalculationControlTester, GoACells, GoACheckoutGroupControlTester, GoAContractInfoControlReview, GoADateControl, GoADateControlTester, GoADateInput, GoADateTimeControl, GoADateTimeControlTester, GoADateTimeInput, GoAEmailControl, GoAEmailControlTester, GoAEmailInput, GoAEnumCheckboxGroupControl, GoAEnumControl, GoAEnumControlTester, GoAEnumRadioGroupControl, GoAInputBaseControl, GoAInputBaseFullNameControlReview, GoAInputBaseFullNameDobControlReview, GoAInputBaseReviewControl, GoAInputBaseTableReview, GoAInputBaseTableReviewControl, GoAInputDateControl, GoAInputDateTimeControl, GoAInputEmailControl, GoAInputIntegerControl, GoAInputNumberControl, GoAInputText, GoAInputTextControl, GoAInputTimeControl, GoAIntegerControl, GoAIntegerControlTester, GoAListWithDetailsControlRenderer, GoAListWithDetailsTester, GoANumberControl, GoANumberControlTester, GoANumberInput, GoAPhoneNumberControl, GoAPhoneNumberWithTypeControl, GoAPrimitiveArrayRenderer, GoAPrimitiveArrayTester, GoARadioGroupControlTester, GoARenderers, GoAReviewRenderers, GoATextControl, GoATextControlTester, GoATimeControl, GoATimeControlTester, GoATimeInput, GoInputBaseReview, GoabInputBasePhoneNumberReviewControl, GoabInputBasePhoneNumberWithTypeReviewControl, GoabInputInteger, InnerGoAInputText, JsonFormContext, JsonFormRegisterProvider, JsonFormsRegisterContext, ListWithDetailsControl, MultiLineText, MultiLineTextControl, MultiLineTextControlInput, MultiLineTextControlTester, OPTION_DEFINITIONS, PHONE_REGEX, PhoneGrid, PhoneNumberControl, PhoneNumberReviewControl, PhoneNumberTester, PhoneNumberWithTypeControl, PhoneNumberWithTypeReviewControl, PhoneNumberWithTypeTester, PrimitiveArrayControl, RadioGroup, USER_FIELD_DEFINITIONS, autoPopulatePropertiesMonaco, autoPopulateValue, categoriesAreValid, createAutoPopulateMiddleware, createDefaultAjv, enumControl, errMalformedDate, fetchRegisterConfigFromOptions$1 as fetchRegisterConfigFromOptions, formatSin, getAutoPopulateControls, getAutoPopulatedData, getByJsonPointer, getCategoryScopes, hasDataInScopes, hasDataValue, isAddressLookup, isContactInformation, isFullName, isFullNameDoB, isPhoneNumberWithType, mergeAutoPopulatedData, predictiveOptionsMonaco, registerReducer, resolveRefs, toDateTimeLocalInputValue, tryResolveRefs, useRegisterUser };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.66.4",
3
+ "version": "2.67.0",
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",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-06-17T15:15:12.476Z",
4
- "sourceCommit": "131eadb73d7d67a498c9363ca20648a1cc9b6b88",
3
+ "generatedAt": "2026-06-17T16:47:32.172Z",
4
+ "sourceCommit": "bb6ddf86d6467140c26b258d1deb5e7f22736f6a",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 33,
7
7
  "renderers": [
@@ -2,6 +2,8 @@ import { ReactNode, Dispatch } from 'react';
2
2
  import { CategorizationStepperLayoutRendererProps } from '../types';
3
3
  import { StepperContextDataType, CategoryState } from './types';
4
4
  import { JsonFormStepperDispatch } from './reducer';
5
+ import { JsonSchema } from '@jsonforms/core';
6
+ import { ErrorObject } from 'ajv';
5
7
  export interface JsonFormsStepperContextProviderProps {
6
8
  children: ReactNode;
7
9
  StepperProps: CategorizationStepperLayoutRendererProps & {
@@ -29,3 +31,4 @@ export interface JsonFormsStepperContextProps {
29
31
  }
30
32
  export declare const JsonFormsStepperContext: import("react").Context<JsonFormsStepperContextProps | undefined>;
31
33
  export declare const JsonFormsStepperContextProvider: ({ children, StepperProps, }: JsonFormsStepperContextProviderProps) => JSX.Element;
34
+ export declare const getEmptyRequiredStringErrors: (data: unknown, schema: JsonSchema) => ErrorObject[];
@@ -1,58 +1,51 @@
1
1
  import { User } from '../Context/register';
2
+ import { ControlElement, Middleware, UISchemaElement } from '@jsonforms/core';
3
+ export declare const AUTO_POPULATE_SOURCES: readonly ["firstName", "lastName", "email"];
4
+ export type AutoPopulateSource = (typeof AUTO_POPULATE_SOURCES)[number];
5
+ /**
6
+ * @deprecated Field names no longer control auto-population. Use the
7
+ * UI-schema `options.autoPopulate` directive.
8
+ */
2
9
  export declare const USER_FIELD_DEFINITIONS: {
3
10
  fullName: {
4
11
  schema: {
5
12
  type: string;
6
- minLength: number;
7
- description: string;
8
13
  };
9
14
  getValue: (user: User) => string;
10
15
  };
11
16
  name: {
12
17
  schema: {
13
18
  type: string;
14
- minLength: number;
15
- description: string;
16
19
  };
17
20
  getValue: (user: User) => string;
18
21
  };
19
22
  firstName: {
20
23
  schema: {
21
24
  type: string;
22
- minLength: number;
23
- description: string;
24
25
  };
25
26
  getValue: (user: User) => string;
26
27
  };
27
28
  givenName: {
28
29
  schema: {
29
30
  type: string;
30
- minLength: number;
31
- description: string;
32
31
  };
33
32
  getValue: (user: User) => string;
34
33
  };
35
34
  lastName: {
36
35
  schema: {
37
36
  type: string;
38
- minLength: number;
39
- description: string;
40
37
  };
41
38
  getValue: (user: User) => string;
42
39
  };
43
40
  familyName: {
44
41
  schema: {
45
42
  type: string;
46
- minLength: number;
47
- description: string;
48
43
  };
49
44
  getValue: (user: User) => string;
50
45
  };
51
46
  surname: {
52
47
  schema: {
53
48
  type: string;
54
- minLength: number;
55
- description: string;
56
49
  };
57
50
  getValue: (user: User) => string;
58
51
  };
@@ -60,13 +53,6 @@ export declare const USER_FIELD_DEFINITIONS: {
60
53
  schema: {
61
54
  type: string;
62
55
  format: string;
63
- maxLength: number;
64
- pattern: string;
65
- description: string;
66
- errorMessage: {
67
- pattern: string;
68
- maxLength: string;
69
- };
70
56
  };
71
57
  getValue: (user: User) => string;
72
58
  };
@@ -74,13 +60,6 @@ export declare const USER_FIELD_DEFINITIONS: {
74
60
  schema: {
75
61
  type: string;
76
62
  format: string;
77
- maxLength: number;
78
- pattern: string;
79
- description: string;
80
- errorMessage: {
81
- pattern: string;
82
- maxLength: string;
83
- };
84
63
  };
85
64
  getValue: (user: User) => string;
86
65
  };
@@ -88,22 +67,31 @@ export declare const USER_FIELD_DEFINITIONS: {
88
67
  schema: {
89
68
  type: string;
90
69
  format: string;
91
- maxLength: number;
92
- pattern: string;
93
- description: string;
94
- errorMessage: {
95
- pattern: string;
96
- maxLength: string;
97
- };
98
70
  };
99
71
  getValue: (user: User) => string;
100
72
  };
101
73
  };
74
+ /** @deprecated Use AutoPopulateSource. */
102
75
  export type UserField = keyof typeof USER_FIELD_DEFINITIONS;
103
- export declare const autoPopulateValue: (user: User, props: {
76
+ type AutoPopulateProps = {
77
+ uischema?: {
78
+ options?: {
79
+ autoPopulate?: unknown;
80
+ };
81
+ };
82
+ };
83
+ interface AutoPopulatedValue {
104
84
  path: string;
105
- }) => string | undefined;
106
- export declare const autoPopulatePropertiesMonaco: {
107
- label: string;
108
- insertText: string;
109
- }[];
85
+ value: unknown;
86
+ }
87
+ export declare const autoPopulateValue: (user: User, props: AutoPopulateProps) => string | undefined;
88
+ export declare const getAutoPopulateControls: (element?: UISchemaElement) => ControlElement[];
89
+ export declare const getAutoPopulatedData: (uischema: UISchemaElement | undefined, user?: User) => AutoPopulatedValue[];
90
+ export declare const mergeAutoPopulatedData: (data: unknown, autoPopulatedData: AutoPopulatedValue[]) => any;
91
+ export declare const createAutoPopulateMiddleware: (uischema: UISchemaElement | undefined, user?: User) => Middleware;
92
+ /**
93
+ * Retained for compatibility with consumers of the previous data-schema
94
+ * autocomplete API. Auto-population is now configured in the UI schema.
95
+ */
96
+ export declare const autoPopulatePropertiesMonaco: never[];
97
+ export {};
@@ -14,6 +14,9 @@ export declare const OPTION_DEFINITIONS: {
14
14
  emailFirst: {
15
15
  schema: boolean;
16
16
  };
17
+ autoPopulate: {
18
+ schema: string;
19
+ };
17
20
  noDataMessage: {
18
21
  schema: string;
19
22
  };