@opencrvs/toolkit 1.9.6-rc.ea8c258 → 1.9.6-rc.f071f7d

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.
@@ -5278,6 +5278,7 @@ declare const NameField: z.ZodObject<z.objectUtil.extendShape<{
5278
5278
  description: string;
5279
5279
  defaultMessage: string;
5280
5280
  }>>;
5281
+ hideSubFieldError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
5281
5282
  }, "strip", z.ZodTypeAny, {
5282
5283
  name?: {
5283
5284
  firstname?: {
@@ -5303,6 +5304,7 @@ declare const NameField: z.ZodObject<z.objectUtil.extendShape<{
5303
5304
  maxLength?: number | undefined;
5304
5305
  prefix?: TranslationConfig | undefined;
5305
5306
  postfix?: TranslationConfig | undefined;
5307
+ hideSubFieldError?: boolean | undefined;
5306
5308
  }, {
5307
5309
  name?: {
5308
5310
  firstname?: {
@@ -5360,6 +5362,7 @@ declare const NameField: z.ZodObject<z.objectUtil.extendShape<{
5360
5362
  description: string;
5361
5363
  defaultMessage: string;
5362
5364
  } | undefined;
5365
+ hideSubFieldError?: boolean | undefined;
5363
5366
  }>>>;
5364
5367
  }>, "strip", z.ZodTypeAny, {
5365
5368
  type: "NAME";
@@ -5441,6 +5444,7 @@ declare const NameField: z.ZodObject<z.objectUtil.extendShape<{
5441
5444
  maxLength?: number | undefined;
5442
5445
  prefix?: TranslationConfig | undefined;
5443
5446
  postfix?: TranslationConfig | undefined;
5447
+ hideSubFieldError?: boolean | undefined;
5444
5448
  } | undefined;
5445
5449
  }, {
5446
5450
  type: "NAME";
@@ -5574,6 +5578,7 @@ declare const NameField: z.ZodObject<z.objectUtil.extendShape<{
5574
5578
  description: string;
5575
5579
  defaultMessage: string;
5576
5580
  } | undefined;
5581
+ hideSubFieldError?: boolean | undefined;
5577
5582
  } | undefined;
5578
5583
  }>;
5579
5584
  declare const PhoneField: z.ZodObject<z.objectUtil.extendShape<{
@@ -230,6 +230,15 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
230
230
  }, {
231
231
  data?: any;
232
232
  }>>> | z.ZodObject<{
233
+ numericValue: z.ZodNumber;
234
+ unit: z.ZodString;
235
+ }, "strip", z.ZodTypeAny, {
236
+ numericValue: number;
237
+ unit: string;
238
+ }, {
239
+ numericValue: number;
240
+ unit: string;
241
+ }> | z.ZodObject<{
233
242
  numericValue: z.ZodOptional<z.ZodNumber>;
234
243
  unit: z.ZodOptional<z.ZodString>;
235
244
  }, "strip", z.ZodTypeAny, {
@@ -239,6 +248,15 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
239
248
  numericValue?: number | undefined;
240
249
  unit?: string | undefined;
241
250
  }> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
251
+ numericValue: z.ZodNumber;
252
+ unit: z.ZodString;
253
+ }, "strip", z.ZodTypeAny, {
254
+ numericValue: number;
255
+ unit: string;
256
+ }, {
257
+ numericValue: number;
258
+ unit: string;
259
+ }>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
242
260
  numericValue: z.ZodOptional<z.ZodNumber>;
243
261
  unit: z.ZodOptional<z.ZodString>;
244
262
  }, "strip", z.ZodTypeAny, {
@@ -2209,7 +2209,12 @@ var NameField = BaseField.extend({
2209
2209
  order: import_zod16.z.array(import_zod16.z.enum(["firstname", "middlename", "surname"])).optional(),
2210
2210
  maxLength: import_zod16.z.number().optional().describe("Maximum length of the text"),
2211
2211
  prefix: TranslationConfig.optional(),
2212
- postfix: TranslationConfig.optional()
2212
+ postfix: TranslationConfig.optional(),
2213
+ hideSubFieldError: import_zod16.z.boolean().default(false).optional().describe(
2214
+ `If true, hides the field's validation error message. Useful for composite components like ADDRESS or NAME where errors are shown at the sub-field level instead of the parent
2215
+ field level. When enabled, errors are hidden at the composite component level on the form page but remain visible on the review page. It doesn't interfere with the sub-field's
2216
+ validation error messages.`
2217
+ )
2213
2218
  }).default({
2214
2219
  name: {
2215
2220
  firstname: { required: true },
@@ -3009,7 +3014,7 @@ function mapFieldTypeToZod(field3, actionType) {
3009
3014
  schema = NumberFieldValue;
3010
3015
  break;
3011
3016
  case FieldType.NUMBER_WITH_UNIT:
3012
- schema = NumberWithUnitFieldUpdateValue;
3017
+ schema = field3.required ? NumberWithUnitFieldValue : NumberWithUnitFieldUpdateValue;
3013
3018
  break;
3014
3019
  case FieldType.CHECKBOX:
3015
3020
  schema = CheckboxFieldValue;
@@ -3400,7 +3405,7 @@ function isFieldVisible(field3, form, context) {
3400
3405
  }
3401
3406
  function isFieldEmptyAndNotRequired(field3, form) {
3402
3407
  const fieldValue = form[field3.id];
3403
- return !field3.required && (fieldValue === void 0 || fieldValue === "");
3408
+ return !field3.required && (fieldValue === void 0 || fieldValue === "" || fieldValue && typeof fieldValue === "object" && Object.values(fieldValue).every((v) => v === void 0 || v === ""));
3404
3409
  }
3405
3410
  function isFieldEnabled(field3, form, context) {
3406
3411
  return isFieldConditionMet(field3, form, ConditionalType.ENABLE, context);
@@ -1731,7 +1731,12 @@ var NameField = BaseField.extend({
1731
1731
  order: import_zod16.z.array(import_zod16.z.enum(["firstname", "middlename", "surname"])).optional(),
1732
1732
  maxLength: import_zod16.z.number().optional().describe("Maximum length of the text"),
1733
1733
  prefix: TranslationConfig.optional(),
1734
- postfix: TranslationConfig.optional()
1734
+ postfix: TranslationConfig.optional(),
1735
+ hideSubFieldError: import_zod16.z.boolean().default(false).optional().describe(
1736
+ `If true, hides the field's validation error message. Useful for composite components like ADDRESS or NAME where errors are shown at the sub-field level instead of the parent
1737
+ field level. When enabled, errors are hidden at the composite component level on the form page but remain visible on the review page. It doesn't interfere with the sub-field's
1738
+ validation error messages.`
1739
+ )
1735
1740
  }).default({
1736
1741
  name: {
1737
1742
  firstname: { required: true },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.9.6-rc.ea8c258",
3
+ "version": "1.9.6-rc.f071f7d",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {