@abgov/jsonforms-components 2.60.17 → 2.61.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
@@ -3786,6 +3786,19 @@ const validateSinWithLuhn = input => {
3786
3786
  }
3787
3787
  return sum % 10 === 0;
3788
3788
  };
3789
+ const getSinValidationError = (data, schema) => {
3790
+ const extraSchema = schema;
3791
+ if (!extraSchema || extraSchema.title !== sinTitle || typeof data !== 'string') {
3792
+ return undefined;
3793
+ }
3794
+ if (data.length === 11 && !validateSinWithLuhn(Number(data.replace(/\D/g, '')))) {
3795
+ return data === '' ? '' : invalidSin;
3796
+ }
3797
+ if (data.length > 0 && data.length < 11) {
3798
+ return extraSchema.errorMessage;
3799
+ }
3800
+ return undefined;
3801
+ };
3789
3802
  /**
3790
3803
  * Gets the required fields in the If/Then/Else json schema condition.
3791
3804
  * @param props - ControlProps
@@ -3850,13 +3863,9 @@ const checkFieldValidity = (props, rootData) => {
3850
3863
  schema
3851
3864
  } = props;
3852
3865
  const labelToUpdate = getControlLabelText(props);
3853
- const extraSchema = schema;
3854
- if (extraSchema && data && (extraSchema == null ? void 0 : extraSchema.title) === sinTitle) {
3855
- if (data.length === 11 && !validateSinWithLuhn(data)) {
3856
- return data === '' ? '' : invalidSin;
3857
- } else if (data.length > 0 && data.length < 11) {
3858
- return extraSchema.errorMessage;
3859
- }
3866
+ const sinValidationError = getSinValidationError(data, schema);
3867
+ if (sinValidationError) {
3868
+ return sinValidationError;
3860
3869
  }
3861
3870
  const rootRequired = getRequiredIfThen(props);
3862
3871
  const requiredByCondition = isRequiredBySchema(props.rootSchema, rootData, props.path, {
@@ -10114,6 +10123,10 @@ const GoAInputBaseTableReview = props => {
10114
10123
  if (!activeError && typeof errors === 'string' && errors.trim() !== '') {
10115
10124
  activeError = errors;
10116
10125
  }
10126
+ const sinValidationError = getSinValidationError(data, schema);
10127
+ if (sinValidationError) {
10128
+ activeError = sinValidationError;
10129
+ }
10117
10130
  if (activeError && /\sis required$/i.test(activeError)) {
10118
10131
  activeError = `${labelToUpdate} is required`;
10119
10132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.60.17",
3
+ "version": "2.61.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-04-29T21:25:28.694Z",
4
- "sourceCommit": "4a8e24eeb967cbbf32d54077d2a3aa489e565b67",
3
+ "generatedAt": "2026-04-30T22:54:59.184Z",
4
+ "sourceCommit": "4906b4dee2b46cdb6f63ab7960e7a1f904a2bd51",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 33,
7
7
  "renderers": [
@@ -32,6 +32,7 @@ export declare const isNilOrEmptyString: (value: string | null | undefined) => b
32
32
  */
33
33
  export declare const isNilOrEmptyValue: (value: unknown, includeEmptyArray?: boolean) => boolean;
34
34
  export declare const validateSinWithLuhn: (input: number) => boolean;
35
+ export declare const getSinValidationError: (data: unknown, schema?: JsonSchema) => string | undefined;
35
36
  /**
36
37
  * Gets the required fields in the If/Then/Else json schema condition.
37
38
  * @param props - ControlProps