@abgov/jsonforms-components 2.52.4 → 2.52.6

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
@@ -3054,6 +3054,7 @@ $$z({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$3 }, {
3054
3054
  const sinTitle = 'Social insurance number';
3055
3055
  const invalidSin = 'Social insurance number is invalid';
3056
3056
  const DEFAULT_MAX_ITEMS = 50;
3057
+ const REQUIRED_PROPERTY_ERROR = 'is a required property';
3057
3058
 
3058
3059
  /**
3059
3060
  * Sets the first word to be capitalized so that it is sentence cased.
@@ -9374,7 +9375,7 @@ const MainTab = ({
9374
9375
  acc.fields[field] = prettify$1(missingFromNested) + ' is required';
9375
9376
  } else {
9376
9377
  const raw = e.message;
9377
- if (raw && (raw.includes('must have required property') || raw.includes('is a required property'))) {
9378
+ if (raw && (raw.includes('must have required property') || raw.includes(REQUIRED_PROPERTY_ERROR))) {
9378
9379
  const m = raw.match(/'([^']+)'/);
9379
9380
  if (m && m[1]) acc.fields[field] = prettify$1(m[1]) + ' is required';else acc.fields[field] = raw;
9380
9381
  } else {
@@ -9392,7 +9393,7 @@ const MainTab = ({
9392
9393
  acc.row = prettify$1(missingFromNested) + ' is required';
9393
9394
  } else {
9394
9395
  const raw = e == null ? void 0 : e.message;
9395
- if (raw && (raw.includes('must have required property') || raw.includes('is a required property'))) {
9396
+ if (raw && (raw.includes('must have required property') || raw.includes(REQUIRED_PROPERTY_ERROR))) {
9396
9397
  const m = raw.match(/'([^']+)'/);
9397
9398
  if (m && m[1]) acc.row = prettify$1(m[1]) + ' is required';else acc.row = raw;
9398
9399
  } else {
@@ -9405,7 +9406,7 @@ const MainTab = ({
9405
9406
  }
9406
9407
  if (!acc.fields[field]) {
9407
9408
  let msg = humanizeAjvError(e, core.schema, core.uischema);
9408
- if (typeof msg === 'string' && (msg.includes('must have required property') || msg.includes('is a required property'))) {
9409
+ if (typeof msg === 'string' && (msg.includes('must have required property') || msg.includes(REQUIRED_PROPERTY_ERROR))) {
9409
9410
  const propertyMatch = msg.match(/'([^']+)'/);
9410
9411
  if (propertyMatch && propertyMatch[1]) {
9411
9412
  msg = prettify$1(propertyMatch[1]) + ' is required';
@@ -9757,6 +9758,24 @@ const GoAInputBaseTableReview = props => {
9757
9758
  }
9758
9759
  let reviewText = data;
9759
9760
  const isBoolean = typeof data === 'boolean';
9761
+ const getArrayDisplayValues = () => {
9762
+ var _itemSchema$oneOf;
9763
+ if (!Array.isArray(data)) {
9764
+ return [];
9765
+ }
9766
+ const itemSchema = schema == null ? void 0 : schema.items;
9767
+ const oneOf = (_itemSchema$oneOf = itemSchema == null ? void 0 : itemSchema.oneOf) != null ? _itemSchema$oneOf : [];
9768
+ const titleByConst = new Map();
9769
+ oneOf.forEach(option => {
9770
+ var _option$title;
9771
+ if (!(option != null && option.const)) return;
9772
+ titleByConst.set(option.const, (_option$title = option.title) != null ? _option$title : option.const);
9773
+ });
9774
+ return data.map(value => {
9775
+ const raw = typeof value === 'string' ? value : String(value);
9776
+ return titleByConst.get(raw) || raw;
9777
+ });
9778
+ };
9760
9779
  if (isBoolean) {
9761
9780
  var _uischema$options2, _uischema$options3;
9762
9781
  let checkboxLabel = '';
@@ -9776,6 +9795,18 @@ const GoAInputBaseTableReview = props => {
9776
9795
  }
9777
9796
  }
9778
9797
  }
9798
+ if (Array.isArray(data) && data.length > 0) {
9799
+ const displayValues = getArrayDisplayValues();
9800
+ reviewText = jsx("ul", {
9801
+ style: {
9802
+ margin: 0,
9803
+ paddingLeft: '1.25rem'
9804
+ },
9805
+ children: displayValues.map((value, index) => jsx("li", {
9806
+ children: value
9807
+ }, `${value}-${index}`))
9808
+ });
9809
+ }
9779
9810
  // Helper to extract errors manually from global state, bypassing "touched" filter
9780
9811
  const normalizePath = p => p.replace(/\[(\d+)\]/g, '.$1').replace(/^\./, '').replace(/\//g, '.');
9781
9812
  const findMatchingError = currentErrors => {
@@ -9849,7 +9880,7 @@ const GoAInputBaseTableReview = props => {
9849
9880
  children: "Change"
9850
9881
  })]
9851
9882
  }), jsxs(ReviewValue, {
9852
- children: [typeof reviewText === 'string' || typeof reviewText === 'number' ? jsx("div", {
9883
+ children: [typeof reviewText === 'string' || typeof reviewText === 'number' || /*#__PURE__*/React.isValidElement(reviewText) ? jsx("div", {
9853
9884
  "data-testid": `review-value-${label}`,
9854
9885
  children: reviewText
9855
9886
  }) : jsx(JsonFormsDispatch, {
@@ -9859,11 +9890,9 @@ const GoAInputBaseTableReview = props => {
9859
9890
  enabled: enabled,
9860
9891
  renderers: jsonForms.renderers,
9861
9892
  cells: cells
9862
- }), activeError && jsxs(WarningIconDiv, {
9863
- children: [jsx(GoabIcon, {
9864
- type: "warning",
9865
- size: "small"
9866
- }), activeError]
9893
+ }), activeError && jsx(GoabFormItem, {
9894
+ error: activeError,
9895
+ label: ""
9867
9896
  })]
9868
9897
  })]
9869
9898
  })
@@ -10013,7 +10042,7 @@ const GoAEmailInput = props => {
10013
10042
  }, [showReviewLink]);
10014
10043
  const splitErrors = (errors != null ? errors : '').split(/\r?\n/).map(e => e.trim()).filter(Boolean);
10015
10044
  const primaryLabel = (defaultSchema == null ? void 0 : defaultSchema.label) || defaultLabel;
10016
- const splintIndex = splitErrors.findIndex(e => e === 'is a required property');
10045
+ const splintIndex = splitErrors.findIndex(e => e === REQUIRED_PROPERTY_ERROR);
10017
10046
  splitErrors[splintIndex] = `${primaryLabel} is required`;
10018
10047
  const finalErrors = splitErrors.join('\n');
10019
10048
  return jsx(Visible, {
@@ -10633,11 +10662,9 @@ const FullNameControlReview = props => {
10633
10662
  testId: "full-name-change-btn",
10634
10663
  children: "Change"
10635
10664
  })]
10636
- }), errors && jsxs(WarningIconDiv, {
10637
- children: [jsx(GoabIcon, {
10638
- type: "warning",
10639
- size: "small"
10640
- }), errors != null && errors.includes('is a required property') ? `${label} is required` : errors]
10665
+ }), errors && jsx(GoabFormItem, {
10666
+ error: errors != null && errors.includes(REQUIRED_PROPERTY_ERROR) ? `${label} is required` : errors,
10667
+ label: ""
10641
10668
  })]
10642
10669
  })
10643
10670
  }), renderRow('First name', data == null ? void 0 : data.firstName, `firstName-control-${id}`), (data == null ? void 0 : data.middleName) && renderRow('Middle name', data == null ? void 0 : data.middleName, `middleName-control-${id}`), renderRow('Last name', data == null ? void 0 : data.lastName, `lastName-control-${id}`)]
@@ -10692,11 +10719,9 @@ const FullNameDobReviewControl = props => {
10692
10719
  testId: "fullname-dob-change-btn",
10693
10720
  children: "Change"
10694
10721
  })]
10695
- }), errors && jsxs(WarningIconDiv, {
10696
- children: [jsx(GoabIcon, {
10697
- type: "warning",
10698
- size: "small"
10699
- }), errors != null && errors.includes('is a required property') ? `${label} is required` : errors]
10722
+ }), errors && jsx(GoabFormItem, {
10723
+ error: errors != null && errors.includes(REQUIRED_PROPERTY_ERROR) ? `${label} is required` : errors,
10724
+ label: ""
10700
10725
  })]
10701
10726
  })
10702
10727
  }), renderRow('First name', data == null ? void 0 : data.firstName, `firstName-control-${id}`), (data == null ? void 0 : data.middleName) && renderRow('Middle name', data == null ? void 0 : data.middleName, `middleName-control-${id}`), renderRow('Last name', data == null ? void 0 : data.lastName, `lastName-control-${id}`), renderRow('Date of birth', data == null ? void 0 : data.dateOfBirth, `dob-control-${id}`)]
@@ -11206,7 +11231,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
11206
11231
  if (error) {
11207
11232
  try {
11208
11233
  humanMessage = humanizeAjvError(error, schema, uischema);
11209
- if (typeof humanMessage === 'string' && (humanMessage.includes('must have required property') || humanMessage.includes('is a required property'))) {
11234
+ if (typeof humanMessage === 'string' && (humanMessage.includes('must have required property') || humanMessage.includes(REQUIRED_PROPERTY_ERROR))) {
11210
11235
  const propertyMatch = humanMessage.match(/'([^']+)'/);
11211
11236
  if (propertyMatch && propertyMatch[1]) {
11212
11237
  humanMessage = prettify(propertyMatch[1]) + ' is required';
@@ -12130,7 +12155,7 @@ const AddressLoopUpControlTableReview = props => {
12130
12155
  } catch (err) {
12131
12156
  // fallback to parsing the raw message
12132
12157
  const raw = matched.message;
12133
- if (raw != null && raw.includes('must have required property') || raw != null && raw.includes('is a required property')) {
12158
+ if (raw != null && raw.includes('must have required property') || raw != null && raw.includes(REQUIRED_PROPERTY_ERROR)) {
12134
12159
  const propertyMatch = raw.match(/'([^']+)'/);
12135
12160
  if (propertyMatch && propertyMatch[1]) {
12136
12161
  return prettify(propertyMatch[1]) + ' is required';
@@ -12146,12 +12171,12 @@ const AddressLoopUpControlTableReview = props => {
12146
12171
  // Build the target scope for the address control
12147
12172
  const targetScope = (uischema == null ? void 0 : uischema.scope) || (path ? `#/properties/${path}` : undefined);
12148
12173
  const renderRow = (label, value, propName, showButton = false) => {
12149
- var _error, _error2;
12150
12174
  let error = getError(propName);
12151
12175
  const required = isRequired(propName);
12152
12176
  if (required && !value && !error) {
12153
12177
  error = `${label} is required`;
12154
12178
  }
12179
+ const errorMessage = error && (error.includes(REQUIRED_PROPERTY_ERROR) || error.includes('required property')) ? `${label} is required` : error;
12155
12180
  return jsx("tr", {
12156
12181
  children: jsxs(PageReviewContainer, {
12157
12182
  colSpan: 3,
@@ -12168,11 +12193,9 @@ const AddressLoopUpControlTableReview = props => {
12168
12193
  children: "Change"
12169
12194
  })]
12170
12195
  }), jsxs(ReviewValue, {
12171
- children: [value, error && jsxs(WarningIconDiv, {
12172
- children: [jsx(GoabIcon, {
12173
- type: "warning",
12174
- size: "small"
12175
- }), (_error = error) != null && _error.includes('is a required property') || (_error2 = error) != null && _error2.includes('required property') ? `${label} is required` : error]
12196
+ children: [value, errorMessage && jsx(GoabFormItem, {
12197
+ error: errorMessage,
12198
+ label: ""
12176
12199
  })]
12177
12200
  })]
12178
12201
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.52.4",
3
+ "version": "2.52.6",
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-03-11T20:34:29.251Z",
4
- "sourceCommit": "f6ef75a475c4b947ccfa5973b95b3863c853bd54",
3
+ "generatedAt": "2026-03-12T17:06:12.099Z",
4
+ "sourceCommit": "8e70c36cadefa29ed84a8d37cfaab8454a468304",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 32,
7
7
  "renderers": [
@@ -1,3 +1,4 @@
1
1
  export declare const sinTitle = "Social insurance number";
2
2
  export declare const invalidSin = "Social insurance number is invalid";
3
3
  export declare const DEFAULT_MAX_ITEMS = 50;
4
+ export declare const REQUIRED_PROPERTY_ERROR = "is a required property";