@abgov/jsonforms-components 2.56.0 → 2.57.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
@@ -7142,59 +7142,78 @@ function useDebounce(value, delay) {
7142
7142
  const defineFields = fields => fields;
7143
7143
  const autoLabel = name => `${name} (auto from user profile)`;
7144
7144
  const buildInsertText = (key, schema) => `${key}": ${JSON.stringify(schema, null, 2)}`;
7145
+ const getNameParts = user => {
7146
+ const [first = '', last = ''] = ((user == null ? void 0 : user.name) || '').split(' ');
7147
+ return {
7148
+ first,
7149
+ last
7150
+ };
7151
+ };
7152
+ const fullNameSchema = {
7153
+ type: 'string',
7154
+ minLength: 3,
7155
+ description: 'Please enter your full name'
7156
+ };
7157
+ const firstNameSchema = {
7158
+ type: 'string',
7159
+ minLength: 3,
7160
+ description: 'Please enter your first name'
7161
+ };
7162
+ const lastNameSchema = {
7163
+ type: 'string',
7164
+ minLength: 3,
7165
+ description: 'Please enter your last name'
7166
+ };
7167
+ const emailSchema = {
7168
+ type: 'string',
7169
+ format: 'email',
7170
+ maxLength: 100,
7171
+ pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,}$',
7172
+ description: 'Please enter a valid email address (e.g., name@example.com).',
7173
+ errorMessage: {
7174
+ pattern: '(e.g., name@example.com).',
7175
+ maxLength: 'Email must be less than 100 characters.'
7176
+ }
7177
+ };
7145
7178
  const USER_FIELD_DEFINITIONS = defineFields({
7146
7179
  fullName: {
7147
- schema: {
7148
- type: 'string',
7149
- minLength: 3,
7150
- description: 'Please enter your full name'
7151
- },
7180
+ schema: fullNameSchema,
7152
7181
  getValue: user => user == null ? void 0 : user.name
7153
7182
  },
7154
7183
  name: {
7155
- schema: {
7156
- type: 'string',
7157
- minLength: 3,
7158
- description: 'Please enter your full name'
7159
- },
7184
+ schema: fullNameSchema,
7160
7185
  getValue: user => user == null ? void 0 : user.name
7161
7186
  },
7162
7187
  firstName: {
7163
- schema: {
7164
- type: 'string',
7165
- minLength: 3,
7166
- description: 'Please enter your first name'
7167
- },
7188
+ schema: firstNameSchema,
7189
+ getValue: user => getNameParts(user).first
7190
+ },
7191
+ givenName: {
7192
+ schema: firstNameSchema,
7168
7193
  getValue: user => getNameParts(user).first
7169
7194
  },
7170
7195
  lastName: {
7171
- schema: {
7172
- type: 'string',
7173
- minLength: 3,
7174
- description: 'Please enter your last name'
7175
- },
7196
+ schema: lastNameSchema,
7176
7197
  getValue: user => getNameParts(user).last
7177
7198
  },
7178
- userName: {
7179
- schema: {
7180
- type: 'string',
7181
- minLength: 3,
7182
- description: 'Please enter your username'
7183
- },
7184
- getValue: user => (user == null ? void 0 : user.preferredUsername) || (user == null ? void 0 : user.email) || ''
7199
+ familyName: {
7200
+ schema: lastNameSchema,
7201
+ getValue: user => getNameParts(user).last
7202
+ },
7203
+ surname: {
7204
+ schema: lastNameSchema,
7205
+ getValue: user => getNameParts(user).last
7185
7206
  },
7186
7207
  email: {
7187
- schema: {
7188
- type: 'string',
7189
- format: 'email',
7190
- maxLength: 100,
7191
- pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,}$',
7192
- description: 'Please enter a valid email address (e.g., name@example.com).',
7193
- errorMessage: {
7194
- pattern: '(e.g., name@example.com).',
7195
- maxLength: 'Email must be less than 100 characters.'
7196
- }
7197
- },
7208
+ schema: emailSchema,
7209
+ getValue: user => (user == null ? void 0 : user.email) || ''
7210
+ },
7211
+ emailAddress: {
7212
+ schema: emailSchema,
7213
+ getValue: user => (user == null ? void 0 : user.email) || ''
7214
+ },
7215
+ primaryEmail: {
7216
+ schema: emailSchema,
7198
7217
  getValue: user => (user == null ? void 0 : user.email) || ''
7199
7218
  }
7200
7219
  });
@@ -7207,13 +7226,6 @@ const autoPopulatePropertiesMonaco = Object.entries(USER_FIELD_DEFINITIONS).map(
7207
7226
  label: autoLabel(key),
7208
7227
  insertText: buildInsertText(key, field.schema)
7209
7228
  }));
7210
- const getNameParts = user => {
7211
- const [first = '', last = ''] = ((user == null ? void 0 : user.name) || '').split(' ');
7212
- return {
7213
- first,
7214
- last
7215
- };
7216
- };
7217
7229
 
7218
7230
  function fetchRegisterConfigFromOptions$1(options) {
7219
7231
  if (!(options != null && options.url) && !(options != null && options.urn)) return undefined;
@@ -10776,55 +10788,42 @@ const isFullName = createSchemaMatchTester(['firstName', 'middleName', 'lastName
10776
10788
  const FullNameTester = rankWith(4, isFullName);
10777
10789
 
10778
10790
  const FullNameControlReview = props => {
10779
- var _props$uischema;
10791
+ var _props$uischema, _props$schema$require, _props$schema;
10780
10792
  const context = useContext(JsonFormsStepperContext);
10781
10793
  const stepId = (_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.stepId;
10782
10794
  const {
10783
- label,
10784
- errors,
10785
- required,
10786
10795
  uischema,
10787
10796
  data,
10788
10797
  id
10789
10798
  } = props;
10790
- const renderRow = (fieldLabel, value, testId) => jsx("tr", {
10799
+ const requiredFields = (_props$schema$require = (_props$schema = props.schema) == null ? void 0 : _props$schema.required) != null ? _props$schema$require : [];
10800
+ const isMissing = value => value === undefined || value === null || value === '';
10801
+ const renderRow = (fieldLabel, value, fieldName, testId) => jsx("tr", {
10791
10802
  children: jsxs(PageReviewContainer, {
10792
10803
  colSpan: 3,
10793
- children: [jsx(ReviewHeader, {
10794
- children: jsx(ReviewLabel, {
10804
+ children: [jsxs(ReviewHeader, {
10805
+ children: [jsx(ReviewLabel, {
10795
10806
  children: fieldLabel
10796
- })
10797
- }), jsx(ReviewValue, {
10798
- children: jsx("div", {
10807
+ }), stepId !== undefined && jsx(GoabButton, {
10808
+ type: "tertiary",
10809
+ size: "compact",
10810
+ onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
10811
+ testId: `${fieldName}-change-btn`,
10812
+ children: "Change"
10813
+ })]
10814
+ }), jsxs(ReviewValue, {
10815
+ children: [jsx("div", {
10799
10816
  "data-testid": testId,
10800
- children: value
10801
- })
10817
+ children: value != null ? value : ''
10818
+ }), requiredFields.includes(fieldName) && isMissing(value) && jsx(GoabFormItem, {
10819
+ error: `${fieldLabel} is required`,
10820
+ label: ""
10821
+ })]
10802
10822
  })]
10803
10823
  })
10804
10824
  }, testId);
10805
10825
  return jsxs(Fragment, {
10806
- children: [jsx("tr", {
10807
- "data-testid": "full-name-header",
10808
- children: jsxs(PageReviewContainer, {
10809
- colSpan: 3,
10810
- children: [jsxs(ReviewHeader, {
10811
- children: [jsxs(ReviewLabel, {
10812
- children: [label, required && jsx(RequiredTextLabel, {
10813
- children: " (required)"
10814
- })]
10815
- }), stepId !== undefined && jsx(GoabButton, {
10816
- type: "tertiary",
10817
- size: "compact",
10818
- onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
10819
- testId: "full-name-change-btn",
10820
- children: "Change"
10821
- })]
10822
- }), errors && jsx(GoabFormItem, {
10823
- error: errors != null && errors.includes(REQUIRED_PROPERTY_ERROR) ? `${label} is required` : errors,
10824
- label: ""
10825
- })]
10826
- })
10827
- }), 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}`)]
10826
+ children: [renderRow('First name', data == null ? void 0 : data.firstName, 'firstName', `firstName-control-${id}`), (data == null ? void 0 : data.middleName) && renderRow('Middle name', data == null ? void 0 : data.middleName, 'middleName', `middleName-control-${id}`), renderRow('Last name', data == null ? void 0 : data.lastName, 'lastName', `lastName-control-${id}`)]
10828
10827
  });
10829
10828
  };
10830
10829
  const GoAInputBaseFullNameControlReview = withJsonFormsAllOfProps(FullNameControlReview);
@@ -10833,55 +10832,42 @@ const isFullNameDoB = createSchemaMatchTester(['firstName', 'middleName', 'lastN
10833
10832
  const FullNameDobTester = rankWith(4, isFullNameDoB);
10834
10833
 
10835
10834
  const FullNameDobReviewControl = props => {
10836
- var _uischema$options;
10835
+ var _uischema$options, _props$schema$require, _props$schema;
10837
10836
  const {
10838
10837
  data,
10839
10838
  id,
10840
- uischema,
10841
- label,
10842
- required,
10843
- errors
10839
+ uischema
10844
10840
  } = props;
10845
10841
  const context = useContext(JsonFormsStepperContext);
10846
10842
  const stepId = uischema == null || (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.stepId;
10847
- const renderRow = (fieldLabel, value, testId) => jsx("tr", {
10843
+ const requiredFields = (_props$schema$require = (_props$schema = props.schema) == null ? void 0 : _props$schema.required) != null ? _props$schema$require : [];
10844
+ const isMissing = value => value === undefined || value === null || value === '';
10845
+ const renderRow = (fieldLabel, value, fieldName, testId) => jsx("tr", {
10848
10846
  children: jsxs(PageReviewContainer, {
10849
10847
  colSpan: 3,
10850
- children: [jsx(ReviewHeader, {
10851
- children: jsx(ReviewLabel, {
10848
+ children: [jsxs(ReviewHeader, {
10849
+ children: [jsx(ReviewLabel, {
10852
10850
  children: fieldLabel
10853
- })
10854
- }), jsx(ReviewValue, {
10855
- children: jsx("div", {
10851
+ }), stepId !== undefined && jsx(GoabButton, {
10852
+ type: "tertiary",
10853
+ size: "compact",
10854
+ onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
10855
+ testId: `${fieldName}-change-btn`,
10856
+ children: "Change"
10857
+ })]
10858
+ }), jsxs(ReviewValue, {
10859
+ children: [jsx("div", {
10856
10860
  "data-testid": testId,
10857
- children: value
10858
- })
10861
+ children: value != null ? value : ''
10862
+ }), requiredFields.includes(fieldName) && isMissing(value) && jsx(GoabFormItem, {
10863
+ error: `${fieldLabel} is required`,
10864
+ label: ""
10865
+ })]
10859
10866
  })]
10860
10867
  })
10861
10868
  }, testId);
10862
10869
  return jsxs(Fragment, {
10863
- children: [jsx("tr", {
10864
- "data-testid": "fullname-dob-header",
10865
- children: jsxs(PageReviewContainer, {
10866
- colSpan: 3,
10867
- children: [jsxs(ReviewHeader, {
10868
- children: [jsxs(ReviewLabel, {
10869
- children: [label, required && jsx(RequiredTextLabel, {
10870
- children: " (required)"
10871
- })]
10872
- }), stepId !== undefined && jsx(GoabButton, {
10873
- type: "tertiary",
10874
- size: "compact",
10875
- onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
10876
- testId: "fullname-dob-change-btn",
10877
- children: "Change"
10878
- })]
10879
- }), errors && jsx(GoabFormItem, {
10880
- error: errors != null && errors.includes(REQUIRED_PROPERTY_ERROR) ? `${label} is required` : errors,
10881
- label: ""
10882
- })]
10883
- })
10884
- }), 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}`)]
10870
+ children: [renderRow('First name', data == null ? void 0 : data.firstName, 'firstName', `firstName-control-${id}`), (data == null ? void 0 : data.middleName) && renderRow('Middle name', data == null ? void 0 : data.middleName, 'middleName', `middleName-control-${id}`), renderRow('Last name', data == null ? void 0 : data.lastName, 'lastName', `lastName-control-${id}`), renderRow('Date of birth', data == null ? void 0 : data.dateOfBirth, 'dateOfBirth', `dob-control-${id}`)]
10885
10871
  });
10886
10872
  };
10887
10873
  const GoAInputBaseFullNameDobControlReview = withJsonFormsAllOfProps(FullNameDobReviewControl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.56.0",
3
+ "version": "2.57.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-03-19T15:19:54.516Z",
4
- "sourceCommit": "036c46eec46317c8be0c03cbe21211e036a1800c",
3
+ "generatedAt": "2026-03-20T15:52:41.902Z",
4
+ "sourceCommit": "aa3a0d1881ea0990b3ed15d966fe93ef1d5ebaf1",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 32,
7
7
  "renderers": [
@@ -24,6 +24,14 @@ export declare const USER_FIELD_DEFINITIONS: {
24
24
  };
25
25
  getValue: (user: User) => string;
26
26
  };
27
+ givenName: {
28
+ schema: {
29
+ type: string;
30
+ minLength: number;
31
+ description: string;
32
+ };
33
+ getValue: (user: User) => string;
34
+ };
27
35
  lastName: {
28
36
  schema: {
29
37
  type: string;
@@ -32,7 +40,15 @@ export declare const USER_FIELD_DEFINITIONS: {
32
40
  };
33
41
  getValue: (user: User) => string;
34
42
  };
35
- userName: {
43
+ familyName: {
44
+ schema: {
45
+ type: string;
46
+ minLength: number;
47
+ description: string;
48
+ };
49
+ getValue: (user: User) => string;
50
+ };
51
+ surname: {
36
52
  schema: {
37
53
  type: string;
38
54
  minLength: number;
@@ -54,6 +70,34 @@ export declare const USER_FIELD_DEFINITIONS: {
54
70
  };
55
71
  getValue: (user: User) => string;
56
72
  };
73
+ emailAddress: {
74
+ schema: {
75
+ type: string;
76
+ format: string;
77
+ maxLength: number;
78
+ pattern: string;
79
+ description: string;
80
+ errorMessage: {
81
+ pattern: string;
82
+ maxLength: string;
83
+ };
84
+ };
85
+ getValue: (user: User) => string;
86
+ };
87
+ primaryEmail: {
88
+ schema: {
89
+ type: string;
90
+ format: string;
91
+ maxLength: number;
92
+ pattern: string;
93
+ description: string;
94
+ errorMessage: {
95
+ pattern: string;
96
+ maxLength: string;
97
+ };
98
+ };
99
+ getValue: (user: User) => string;
100
+ };
57
101
  };
58
102
  export type UserField = keyof typeof USER_FIELD_DEFINITIONS;
59
103
  export declare const autoPopulateValue: (user: User, props: {