@abgov/jsonforms-components 2.60.0 → 2.60.2

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
@@ -3713,16 +3713,11 @@ const areAllUppercase = label => {
3713
3713
  return /^[^a-z]*$/.test(label);
3714
3714
  };
3715
3715
  const getExplicitControlLabel = props => {
3716
- var _props$uischema, _props$schema, _props$uischema2;
3717
- const optionText = (_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.text;
3718
- if (typeof optionText === 'string' && optionText.trim()) {
3719
- return optionText.trim();
3720
- }
3721
- if (typeof ((_props$schema = props.schema) == null ? void 0 : _props$schema.title) === 'string' && props.schema.title.trim()) {
3722
- return props.schema.title.trim();
3723
- }
3724
- const uiLabel = (_props$uischema2 = props.uischema) == null ? void 0 : _props$uischema2.label;
3725
- if (typeof uiLabel === 'string' && uiLabel.trim()) {
3716
+ var _props$uischema, _props$uischema2, _props$schema;
3717
+ // uischema.label has highest priority. An explicit empty string suppresses the
3718
+ // auto-generated label (and prevents options.text from leaking into the form-item label).
3719
+ const uiLabel = (_props$uischema = props.uischema) == null ? void 0 : _props$uischema.label;
3720
+ if (typeof uiLabel === 'string') {
3726
3721
  return uiLabel.trim();
3727
3722
  }
3728
3723
  if (typeof uiLabel === 'object' && uiLabel !== null && 'text' in uiLabel) {
@@ -3731,6 +3726,13 @@ const getExplicitControlLabel = props => {
3731
3726
  return text.trim();
3732
3727
  }
3733
3728
  }
3729
+ const optionText = (_props$uischema2 = props.uischema) == null || (_props$uischema2 = _props$uischema2.options) == null ? void 0 : _props$uischema2.text;
3730
+ if (typeof optionText === 'string' && optionText.trim()) {
3731
+ return optionText.trim();
3732
+ }
3733
+ if (typeof ((_props$schema = props.schema) == null ? void 0 : _props$schema.title) === 'string' && props.schema.title.trim()) {
3734
+ return props.schema.title.trim();
3735
+ }
3734
3736
  return undefined;
3735
3737
  };
3736
3738
  const getGeneratedLabelFromScope = scope => {
@@ -3744,7 +3746,7 @@ const getGeneratedLabelFromScope = scope => {
3744
3746
  const getControlLabelText = props => {
3745
3747
  var _props$uischema3;
3746
3748
  const explicitLabel = getExplicitControlLabel(props);
3747
- if (explicitLabel) {
3749
+ if (explicitLabel !== undefined) {
3748
3750
  return explicitLabel;
3749
3751
  }
3750
3752
  if ((_props$uischema3 = props.uischema) != null && (_props$uischema3 = _props$uischema3.scope) != null && _props$uischema3.startsWith('#/')) {
@@ -7286,7 +7288,7 @@ const GoAInputText = props => {
7286
7288
  });
7287
7289
  };
7288
7290
  const InnerGoAInputText = props => {
7289
- var _ref, _ref2, _schema$default, _uischema$options$com, _uischema$options, _props$uischema, _props$uischema2, _uischema$options2, _uischema$options3, _uischema$options$com2, _uischema$options4, _uischema$options5, _uischema$options6;
7291
+ var _uischema$options$com, _uischema$options, _props$uischema, _props$uischema2, _uischema$options2, _uischema$options3, _uischema$options$com2, _uischema$options4, _uischema$options5, _uischema$options6;
7290
7292
  const {
7291
7293
  data,
7292
7294
  config,
@@ -7302,7 +7304,8 @@ const InnerGoAInputText = props => {
7302
7304
  setIsVisited
7303
7305
  } = props;
7304
7306
  const user = useRegisterUser();
7305
- const initialValue = (_ref = (_ref2 = (_schema$default = schema.default) != null ? _schema$default : user && autoPopulateValue(user, props)) != null ? _ref2 : data) != null ? _ref : '';
7307
+ const initialValue = data;
7308
+ const [manualInput, setManualInput] = useState(false);
7306
7309
  const [localValue, setLocalValue] = useState(initialValue);
7307
7310
  const debouncedValue = useDebounce(localValue, 300);
7308
7311
  useEffect(() => {
@@ -7311,13 +7314,13 @@ const InnerGoAInputText = props => {
7311
7314
  useEffect(() => {
7312
7315
  if (!user || data) return;
7313
7316
  const autoPopulatedValue = schema.default || user && autoPopulateValue(user, props);
7314
- if (autoPopulatedValue && autoPopulatedValue !== data) {
7317
+ if (autoPopulatedValue && autoPopulatedValue !== data && !manualInput) {
7315
7318
  handleChange(props.path, autoPopulatedValue);
7316
7319
  }
7317
7320
  // eslint-disable-next-line react-hooks/exhaustive-deps
7318
- }, [schema, user]);
7321
+ }, [user]);
7319
7322
  useEffect(() => {
7320
- if (typeof handleChange === 'function' && (schema == null ? void 0 : schema.default) !== undefined) {
7323
+ if (typeof handleChange === 'function' && (schema == null ? void 0 : schema.default) !== undefined && !manualInput) {
7321
7324
  handleChange(props.path, schema.default);
7322
7325
  }
7323
7326
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -7410,6 +7413,7 @@ const InnerGoAInputText = props => {
7410
7413
  formattedValue = formatSin(detail.value);
7411
7414
  }
7412
7415
  setLocalValue(formattedValue);
7416
+ setManualInput(true);
7413
7417
  if (isVisited === false && setIsVisited) {
7414
7418
  setIsVisited();
7415
7419
  }
@@ -8491,7 +8495,7 @@ const GoABaseInputReviewComponent = props => {
8491
8495
  if (((_uischema$options5 = uischema.options) == null ? void 0 : _uischema$options5.radio) === true) {
8492
8496
  reviewText = data ? `Yes` : `No`;
8493
8497
  } else {
8494
- reviewText = data ? `Yes (${checkboxLabel})` : `No (${checkboxLabel})`;
8498
+ reviewText = data ? checkboxLabel ? `Yes (${checkboxLabel})` : `Yes` : checkboxLabel ? `No (${checkboxLabel})` : `No`;
8495
8499
  }
8496
8500
  }
8497
8501
  if (isTime) {
@@ -10056,9 +10060,19 @@ const GoAInputBaseTableReview = props => {
10056
10060
  if (activeError && /\sis required$/i.test(activeError)) {
10057
10061
  activeError = `${labelToUpdate} is required`;
10058
10062
  }
10063
+ // For required boolean fields (e.g. anyOf: [{enum: [true]}]), suppress the raw AJV
10064
+ // "must be equal to one of the allowed values" error and show a friendly message instead.
10065
+ if ((schema == null ? void 0 : schema.type) === 'boolean' && activeError && activeError.toLowerCase().includes('must be equal')) {
10066
+ activeError = data === false ? `${labelToUpdate} is required` : undefined;
10067
+ }
10059
10068
  if (required && isNilOrEmptyValue(data, true) && !activeError) {
10060
10069
  activeError = `${labelToUpdate} is required`;
10061
10070
  }
10071
+ // If a required checkbox is unchecked, show only the validation message in
10072
+ // review mode (not a contradictory "No (...)" value line).
10073
+ if ((schema == null ? void 0 : schema.type) === 'boolean' && data === false && activeError && /\sis required$/i.test(activeError)) {
10074
+ reviewText = '';
10075
+ }
10062
10076
  // eslint-disable-next-line
10063
10077
  const stepId = (_uischema$options4 = uischema.options) == null ? void 0 : _uischema$options4.stepId;
10064
10078
  const showInlineValue = reviewText === null || reviewText === undefined || typeof reviewText === 'string' || typeof reviewText === 'number' || /*#__PURE__*/React.isValidElement(reviewText) || Array.isArray(reviewText) && reviewText.length === 0;
@@ -10234,6 +10248,20 @@ const GoAEmailInput = props => {
10234
10248
  const stepperState = formStepperCtx == null || formStepperCtx.selectStepperState == null ? void 0 : formStepperCtx.selectStepperState();
10235
10249
  const currentCategory = stepperState == null || (_stepperState$categor = stepperState.categories) == null ? void 0 : _stepperState$categor[stepperState == null ? void 0 : stepperState.activeId];
10236
10250
  const showReviewLink = currentCategory == null ? void 0 : currentCategory.showReviewPageLink;
10251
+ const [localValue, setLocalValue] = useState(data);
10252
+ const debouncedValue = useDebounce(localValue, 300);
10253
+ /* istanbul ignore next */
10254
+ useEffect(() => {
10255
+ if (debouncedValue === data) return;
10256
+ // Only sync if debouncedValue differs from data and is not initial empty state
10257
+ if (debouncedValue !== data && (debouncedValue !== '' || data !== undefined)) {
10258
+ onChangeForInputControl({
10259
+ value: debouncedValue,
10260
+ controlProps: props
10261
+ });
10262
+ }
10263
+ }, [debouncedValue]);
10264
+ const [manualInput, setManualInput] = useState(false);
10237
10265
  const [isVisited, setIsVisited] = useState(false);
10238
10266
  useEffect(() => {
10239
10267
  if (showReviewLink === true) {
@@ -10248,7 +10276,7 @@ const GoAEmailInput = props => {
10248
10276
  useEffect(() => {
10249
10277
  if (!user || data) return;
10250
10278
  const autoPopulatedValue = schema.default || user && autoPopulateValue(user, props);
10251
- if (autoPopulatedValue && autoPopulatedValue !== data) {
10279
+ if (autoPopulatedValue && autoPopulatedValue !== data && !manualInput) {
10252
10280
  handleChange(props.path, autoPopulatedValue);
10253
10281
  }
10254
10282
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -10279,14 +10307,11 @@ const GoAEmailInput = props => {
10279
10307
  disabled: !enabled,
10280
10308
  readonly: readOnly,
10281
10309
  onChange: detail => {
10310
+ setManualInput(true);
10282
10311
  if (!isVisited) {
10283
10312
  setIsVisited(true);
10284
10313
  }
10285
- onChangeForInputControl({
10286
- name: detail.name,
10287
- value: detail.value,
10288
- controlProps: props
10289
- });
10314
+ setLocalValue(detail.value);
10290
10315
  },
10291
10316
  onBlur: detail => {
10292
10317
  if (!isVisited) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.60.0",
3
+ "version": "2.60.2",
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",
@@ -20,7 +20,7 @@
20
20
  "pluralize": "^8.0.0"
21
21
  },
22
22
  "dependencies": {
23
- "axios": "1.13.5",
23
+ "axios": "1.15.0",
24
24
  "lodash": "^4.17.23",
25
25
  "styled-components": "^6.0.0"
26
26
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-04-08T16:11:13.566Z",
4
- "sourceCommit": "6e09c179d6bc219c658e0626bf92dcce5f77c112",
3
+ "generatedAt": "2026-04-15T21:58:29.714Z",
4
+ "sourceCommit": "437fc5583187822f070dbda79b67b20daa47557d",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 33,
7
7
  "renderers": [