@abgov/jsonforms-components 2.81.0 → 2.81.1

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
@@ -3933,6 +3933,9 @@ var StepStatus;
3933
3933
  const getAddressLookupFieldLabel = fieldName => {
3934
3934
  return ADDRESS_LOOKUP_LABELS[fieldName] || fieldName;
3935
3935
  };
3936
+ const NO_ANSWER_MESSAGE = '(none given)';
3937
+ const BACK_TO_OVERVIEW_LABEL = 'Back to application overview';
3938
+ const NEXT_BUTTON_LABEL = 'Next';
3936
3939
 
3937
3940
  var classof$7 = classofRaw$2;
3938
3941
 
@@ -10247,6 +10250,17 @@ const getNavigationTargetFromParams = params => {
10247
10250
  } : undefined;
10248
10251
  };
10249
10252
 
10253
+ const getStepperPageOptions = uischema => {
10254
+ var _uischema$options$hid, _uischema$options, _uischema$options2, _uischema$options$toA, _uischema$options3, _uischema$options$sub, _uischema$options4, _uischema$options$noA, _uischema$options5;
10255
+ return {
10256
+ hideSubmit: (_uischema$options$hid = uischema == null || (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.hideSubmit) != null ? _uischema$options$hid : false,
10257
+ hideSummary: (uischema == null || (_uischema$options2 = uischema.options) == null ? void 0 : _uischema$options2.hideSummary) === true,
10258
+ toAppOverviewLabel: (_uischema$options$toA = uischema == null || (_uischema$options3 = uischema.options) == null ? void 0 : _uischema$options3.toAppOverviewLabel) != null ? _uischema$options$toA : BACK_TO_OVERVIEW_LABEL,
10259
+ submissionLabel: (_uischema$options$sub = uischema == null || (_uischema$options4 = uischema.options) == null ? void 0 : _uischema$options4.submissionLabel) != null ? _uischema$options$sub : NEXT_BUTTON_LABEL,
10260
+ noAnswerMessage: (_uischema$options$noA = uischema == null || (_uischema$options5 = uischema.options) == null ? void 0 : _uischema$options5.noAnswerMessage) != null ? _uischema$options$noA : NO_ANSWER_MESSAGE
10261
+ };
10262
+ };
10263
+
10250
10264
  const createStepperContextInitData = (props, options) => {
10251
10265
  var _uischema$options, _uischema$options2, _categorization$eleme, _props$activeId;
10252
10266
  const {
@@ -10440,6 +10454,7 @@ const JsonFormsStepperContextProvider = ({
10440
10454
  selectPath: () => {
10441
10455
  return snapshot.path;
10442
10456
  },
10457
+ selectStepperOptions: () => getStepperPageOptions(uischema),
10443
10458
  selectCategory: id => {
10444
10459
  return snapshot.categories[id];
10445
10460
  },
@@ -10478,7 +10493,7 @@ const JsonFormsStepperContextProvider = ({
10478
10493
  });
10479
10494
  }
10480
10495
  };
10481
- }, [stepperDispatch, snapshot, doValidatePage]);
10496
+ }, [stepperDispatch, snapshot, doValidatePage, uischema]);
10482
10497
  /* istanbul ignore next */
10483
10498
  useEffect(() => {
10484
10499
  var _ctx$core$errors, _ctx$core4;
@@ -10665,6 +10680,25 @@ const getEmptyRequiredStringErrors = (data, schema) => {
10665
10680
  return errors;
10666
10681
  };
10667
10682
 
10683
+ const StepperOptionsContext = /*#__PURE__*/createContext(undefined);
10684
+ // Carries the top-level uischema options to controls rendered without a stepper in context.
10685
+ const StepperOptionsProvider = ({
10686
+ uischema,
10687
+ children
10688
+ }) => {
10689
+ const options = useMemo(() => getStepperPageOptions(uischema), [uischema]);
10690
+ return jsx(StepperOptionsContext.Provider, {
10691
+ value: options,
10692
+ children: children
10693
+ });
10694
+ };
10695
+ const useStepperPageOptions = () => {
10696
+ var _ref, _stepperCtx$selectSte;
10697
+ const stepperCtx = useContext(JsonFormsStepperContext);
10698
+ const providedOptions = useContext(StepperOptionsContext);
10699
+ return (_ref = (_stepperCtx$selectSte = stepperCtx == null ? void 0 : stepperCtx.selectStepperOptions()) != null ? _stepperCtx$selectSte : providedOptions) != null ? _ref : getStepperPageOptions(undefined);
10700
+ };
10701
+
10668
10702
  /* eslint-disable @typescript-eslint/no-explicit-any */
10669
10703
  /**
10670
10704
  * jsdom implements neither of these, and scrollIntoView is missing on real elements often enough
@@ -12842,10 +12876,10 @@ const isObjectArrayEmpty = currentData => {
12842
12876
  const result = isEmpty(currentData) || JSON.stringify(currentData) === '[{}]';
12843
12877
  return result;
12844
12878
  };
12845
- const renderNoneGivenText = data => {
12879
+ const renderNoneGivenText = (data, noAnswerMessage) => {
12846
12880
  return !data ? jsxs(Fragment, {
12847
12881
  children: [jsx(NoneGivenTableText, {
12848
- children: "(none given)"
12882
+ children: noAnswerMessage
12849
12883
  }), jsx("br", {})]
12850
12884
  }) : data;
12851
12885
  };
@@ -12856,11 +12890,12 @@ const renderCellColumn = ({
12856
12890
  index,
12857
12891
  rowPath,
12858
12892
  element,
12859
- isRequired
12893
+ isRequired,
12894
+ noAnswerMessage
12860
12895
  }) => {
12861
12896
  const renderWarningCell = error => {
12862
12897
  return jsxs(HilightCellWarning, {
12863
- children: [renderNoneGivenText(data), error && jsxs(ObjectArrayWarningIconDiv, {
12898
+ children: [renderNoneGivenText(data, noAnswerMessage), error && jsxs(ObjectArrayWarningIconDiv, {
12864
12899
  children: [jsx(GoabIcon, {
12865
12900
  type: "warning",
12866
12901
  title: "warning",
@@ -12938,7 +12973,7 @@ const createHumanizeError = (error, schema, uischema) => {
12938
12973
  humanMessage = prettify(propertyMatch[1]) + ' is required';
12939
12974
  }
12940
12975
  }
12941
- } catch (err) {
12976
+ } catch (_unused) {
12942
12977
  const raw = error.message;
12943
12978
  const propertyMatch = raw == null ? void 0 : raw.match(/'([^']+)'/);
12944
12979
  if (propertyMatch && propertyMatch[1]) {
@@ -14030,6 +14065,9 @@ const GoAInputBaseTableReview = props => {
14030
14065
  visible
14031
14066
  } = props;
14032
14067
  const reportChange = useReviewChange();
14068
+ const {
14069
+ noAnswerMessage
14070
+ } = useStepperPageOptions();
14033
14071
  const showChangeButtons = useShowChangeButtons();
14034
14072
  const jsonForms = useJsonForms();
14035
14073
  const reviewLabel = typeof ((_uischema$options = uischema.options) == null ? void 0 : _uischema$options.reviewLabel) === 'string' ? uischema.options.reviewLabel : '';
@@ -14145,7 +14183,7 @@ const GoAInputBaseTableReview = props => {
14145
14183
  } else {
14146
14184
  activeError = humanizeAjvError(matchedError, rootSchema != null ? rootSchema : schema, uischema);
14147
14185
  }
14148
- } catch (err) {
14186
+ } catch (_unused) {
14149
14187
  var _matchedError$params;
14150
14188
  // Fallback: try to extract missing property name and create a friendly message
14151
14189
  if (matchedError.keyword === 'required' && (_matchedError$params = matchedError.params) != null && _matchedError$params.missingProperty) {
@@ -14198,7 +14236,6 @@ const GoAInputBaseTableReview = props => {
14198
14236
  reviewText = '';
14199
14237
  isBooleanRequiredError = true;
14200
14238
  }
14201
- // eslint-disable-next-line
14202
14239
  const stepId = (_uischema$options5 = uischema.options) == null ? void 0 : _uischema$options5.stepId;
14203
14240
  function handleChangeClick() {
14204
14241
  reportChange(stepId, uischema.scope);
@@ -14223,7 +14260,7 @@ const GoAInputBaseTableReview = props => {
14223
14260
  children: [showInlineValue ? jsx("div", {
14224
14261
  "data-testid": `review-value-${label}`,
14225
14262
  children: isValueEmpty ? jsx(NoneGivenText, {
14226
- children: "(none given)"
14263
+ children: noAnswerMessage
14227
14264
  }) : reviewText != null ? reviewText : ''
14228
14265
  }) : jsx(JsonFormsDispatch, {
14229
14266
  "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
@@ -15601,6 +15638,9 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
15601
15638
  handleChange,
15602
15639
  errors
15603
15640
  } = props;
15641
+ const {
15642
+ noAnswerMessage
15643
+ } = useStepperPageOptions();
15604
15644
  const element = (schema == null ? void 0 : schema.items) || (schema == null || (_schema$properties = schema.properties) == null || (_schema$properties = _schema$properties[rowPath]) == null ? void 0 : _schema$properties.items) || schema;
15605
15645
  const required = (element == null ? void 0 : element.required) || [];
15606
15646
  const properties = element == null ? void 0 : element.properties;
@@ -15707,7 +15747,8 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
15707
15747
  errors: errors !== undefined ? errors : [],
15708
15748
  element: key,
15709
15749
  rowPath,
15710
- index: i
15750
+ index: i,
15751
+ noAnswerMessage: noAnswerMessage != null ? noAnswerMessage : NO_ANSWER_MESSAGE
15711
15752
  })
15712
15753
  })]
15713
15754
  }, key);
@@ -16994,6 +17035,9 @@ const AddressLoopUpControlTableReview = props => {
16994
17035
  path
16995
17036
  } = props;
16996
17037
  const jsonForms = useJsonForms();
17038
+ const {
17039
+ noAnswerMessage
17040
+ } = useStepperPageOptions();
16997
17041
  const stepId = (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.stepId;
16998
17042
  const reportChange = useReviewChange();
16999
17043
  const showChangeButtons = useShowChangeButtons();
@@ -17116,7 +17160,7 @@ const AddressLoopUpControlTableReview = props => {
17116
17160
  })]
17117
17161
  }), jsxs(ReviewValue, {
17118
17162
  children: [!value ? jsx(NoneGivenText, {
17119
- children: "(none given)"
17163
+ children: noAnswerMessage
17120
17164
  }) : value, errorMessage && jsx(GoabFormItem, {
17121
17165
  error: errorMessage,
17122
17166
  label: ""
@@ -17914,60 +17958,63 @@ const FormStepperReviewer = props => {
17914
17958
  }
17915
17959
  return true;
17916
17960
  };
17917
- return jsxs(ReviewItem, {
17918
- children: [summaryPageTitle && !componentProps.readOnly && jsx(FormStepperSummaryH3, {
17919
- children: summaryPageTitle
17920
- }), categories.map((category, categoryIndex) => {
17921
- // Preserve index stability
17922
- if (!isVisible(category, data, '', ajv, undefined)) {
17923
- return null;
17924
- }
17925
- const categoryLabel = category.label || category.i18n || 'Unknown Category';
17926
- // Build visible elements list
17927
- const elementsToRender = category.elements.filter(field => hasVisibleContent(field)).map(e => {
17928
- const layout = e;
17929
- if (rescopeMaps.some(scope => {
17930
- var _layout$elements;
17931
- return (_layout$elements = layout.elements) == null ? void 0 : _layout$elements.map(el => el.scope).includes(scope);
17932
- })) {
17933
- return layout.elements;
17961
+ return jsx(StepperOptionsProvider, {
17962
+ uischema: uischema,
17963
+ children: jsxs(ReviewItem, {
17964
+ children: [summaryPageTitle && !componentProps.readOnly && jsx(FormStepperSummaryH3, {
17965
+ children: summaryPageTitle
17966
+ }), categories.map((category, categoryIndex) => {
17967
+ // Preserve index stability
17968
+ if (!isVisible(category, data, '', ajv, undefined)) {
17969
+ return null;
17934
17970
  }
17935
- return e;
17936
- }).flat();
17937
- // Do not render empty categories
17938
- if (elementsToRender.length === 0) {
17939
- return null;
17940
- }
17941
- return jsxs(ReviewItemSection, {
17942
- className: "jsonforms-table-review-section",
17943
- id: `jsonforms-table-review-section-${categoryIndex}`,
17944
- children: [jsx(ReviewItemHeader, {
17945
- children: jsx(ReviewItemTitle, {
17946
- children: categoryLabel
17947
- })
17948
- }), elementsToRender.map((element, elementIndex) => {
17949
- const stepperElement = Object.assign({}, element, {
17950
- options: Object.assign({}, element.options, {
17951
- stepId: categoryIndex
17971
+ const categoryLabel = category.label || category.i18n || 'Unknown Category';
17972
+ // Build visible elements list
17973
+ const elementsToRender = category.elements.filter(field => hasVisibleContent(field)).map(e => {
17974
+ const layout = e;
17975
+ if (rescopeMaps.some(scope => {
17976
+ var _layout$elements;
17977
+ return (_layout$elements = layout.elements) == null ? void 0 : _layout$elements.map(el => el.scope).includes(scope);
17978
+ })) {
17979
+ return layout.elements;
17980
+ }
17981
+ return e;
17982
+ }).flat();
17983
+ // Do not render empty categories
17984
+ if (elementsToRender.length === 0) {
17985
+ return null;
17986
+ }
17987
+ return jsxs(ReviewItemSection, {
17988
+ className: "jsonforms-table-review-section",
17989
+ id: `jsonforms-table-review-section-${categoryIndex}`,
17990
+ children: [jsx(ReviewItemHeader, {
17991
+ children: jsx(ReviewItemTitle, {
17992
+ children: categoryLabel
17952
17993
  })
17953
- });
17954
- return jsx(GoabTable, {
17955
- width: "100%",
17956
- mb: "m",
17957
- children: jsx("tbody", {
17958
- children: jsx(JsonFormsDispatch, {
17959
- "data-testid": "jsonforms-object-list-defined-elements-dispatch",
17960
- schema: schema,
17961
- uischema: stepperElement,
17962
- enabled: enabled,
17963
- renderers: GoABaseTableReviewRenderers$1,
17964
- cells: cells
17994
+ }), elementsToRender.map((element, elementIndex) => {
17995
+ const stepperElement = Object.assign({}, element, {
17996
+ options: Object.assign({}, element.options, {
17997
+ stepId: categoryIndex
17965
17998
  })
17966
- })
17967
- }, elementIndex);
17968
- })]
17969
- }, categoryIndex);
17970
- })]
17999
+ });
18000
+ return jsx(GoabTable, {
18001
+ width: "100%",
18002
+ mb: "m",
18003
+ children: jsx("tbody", {
18004
+ children: jsx(JsonFormsDispatch, {
18005
+ "data-testid": "jsonforms-object-list-defined-elements-dispatch",
18006
+ schema: schema,
18007
+ uischema: stepperElement,
18008
+ enabled: enabled,
18009
+ renderers: GoABaseTableReviewRenderers$1,
18010
+ cells: cells
18011
+ })
18012
+ })
18013
+ }, elementIndex);
18014
+ })]
18015
+ }, categoryIndex);
18016
+ })]
18017
+ })
17971
18018
  });
17972
18019
  };
17973
18020
  const FormStepperReviewControl = withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormStepperReviewer)));
@@ -17996,7 +18043,6 @@ const FormStepperView = props => {
17996
18043
  cells,
17997
18044
  renderers,
17998
18045
  visible,
17999
- t,
18000
18046
  enabled
18001
18047
  } = props;
18002
18048
  const enumerators = useContext(JsonFormContext);
@@ -18482,7 +18528,6 @@ const FormStepperPageReviewer = props => {
18482
18528
  withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormStepperPageReviewer)));
18483
18529
 
18484
18530
  const RenderPages = props => {
18485
- var _props$categoryProps$, _props$categoryProps$2, _props$categoryProps$3, _props$categoryProps$4, _props$categoryProps$5, _props$categoryProps$6, _props$categoryProps$7;
18486
18531
  const {
18487
18532
  data,
18488
18533
  schema,
@@ -18507,10 +18552,12 @@ const RenderPages = props => {
18507
18552
  validationTrigger,
18508
18553
  targetScope
18509
18554
  } = formStepperCtx.selectStepperState();
18510
- const hideSubmit = (_props$categoryProps$ = (_props$categoryProps$2 = props.categoryProps.uischema.options) == null ? void 0 : _props$categoryProps$2.hideSubmit) != null ? _props$categoryProps$ : false;
18511
- const toAppOverviewLabel = (_props$categoryProps$3 = (_props$categoryProps$4 = props.categoryProps.uischema.options) == null ? void 0 : _props$categoryProps$4.toAppOverviewLabel) != null ? _props$categoryProps$3 : 'Back to application overview';
18512
- const submissionLabel = (_props$categoryProps$5 = (_props$categoryProps$6 = props.categoryProps.uischema.options) == null ? void 0 : _props$categoryProps$6.submissionLabel) != null ? _props$categoryProps$5 : 'Next';
18513
- const hideSummary = (_props$categoryProps$7 = props.categoryProps.uischema.options) == null ? void 0 : _props$categoryProps$7.hideSummary;
18555
+ const {
18556
+ hideSubmit,
18557
+ toAppOverviewLabel,
18558
+ submissionLabel,
18559
+ hideSummary
18560
+ } = formStepperCtx.selectStepperOptions();
18514
18561
  const submitFormFunction = enumerators == null ? void 0 : enumerators.submitFunction.get('submit-form');
18515
18562
  const submitForm = submitFormFunction && submitFormFunction();
18516
18563
  const saveFormFunction = enumerators == null ? void 0 : enumerators.saveFunction.get('save-form');
@@ -18577,7 +18624,7 @@ const RenderPages = props => {
18577
18624
  id: `${path || `goa`}-form-pages`,
18578
18625
  children: jsxs(PageBorder, {
18579
18626
  children: [jsx(BackButton, {
18580
- text: toAppOverviewLabel,
18627
+ text: toAppOverviewLabel != null ? toAppOverviewLabel : BACK_TO_OVERVIEW_LABEL,
18581
18628
  link: () => {
18582
18629
  handleSave();
18583
18630
  goToTableOfContext();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.81.0",
3
+ "version": "2.81.1",
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-10-29T22:49:15.258Z",
4
- "sourceCommit": "9af2e48b5da50c3da9f7c86a79bcdcecee35ce31",
3
+ "generatedAt": "2026-11-02T14:56:18.675Z",
4
+ "sourceCommit": "33712e7aaecbf06104cab371d856e71d9616efe4",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 23,
7
7
  "renderers": [
@@ -4,6 +4,7 @@ import { StepperContextDataType, CategoryState } from './types';
4
4
  import { JsonFormStepperDispatch } from './reducer';
5
5
  import { JsonSchema } from '@jsonforms/core';
6
6
  import { ErrorObject } from 'ajv';
7
+ import { StepperPageOptions } from '../util/stepperOptions';
7
8
  export interface JsonFormsStepperContextProviderProps {
8
9
  children: ReactNode;
9
10
  StepperProps: CategorizationStepperLayoutRendererProps & {
@@ -27,6 +28,7 @@ export interface JsonFormsStepperContextProps {
27
28
  toggleShowReviewLink: (id: number) => void;
28
29
  validatePage: (id: number) => void;
29
30
  selectNumberOfCompletedCategories: () => number;
31
+ selectStepperOptions: () => StepperPageOptions;
30
32
  isProvided?: boolean;
31
33
  }
32
34
  export declare const JsonFormsStepperContext: import("react").Context<JsonFormsStepperContextProps | undefined>;
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { UISchemaElement } from '@jsonforms/core';
3
+ import { StepperPageOptions } from '../util/stepperOptions';
4
+ interface StepperOptionsProviderProps {
5
+ uischema: UISchemaElement;
6
+ children: ReactNode;
7
+ }
8
+ export declare const StepperOptionsProvider: ({ uischema, children }: StepperOptionsProviderProps) => JSX.Element;
9
+ export declare const useStepperPageOptions: () => StepperPageOptions;
10
+ export {};
@@ -1,4 +1,5 @@
1
1
  export * from './StepperContext';
2
+ export * from './StepperOptionsContext';
2
3
  export * from './types';
3
4
  export * from './reducer';
4
5
  export * from './util';
@@ -0,0 +1,9 @@
1
+ import { UISchemaElement } from '@jsonforms/core';
2
+ export interface StepperPageOptions {
3
+ hideSubmit?: boolean;
4
+ hideSummary?: boolean;
5
+ toAppOverviewLabel?: string;
6
+ submissionLabel?: string;
7
+ noAnswerMessage?: string;
8
+ }
9
+ export declare const getStepperPageOptions: (uischema?: UISchemaElement) => StepperPageOptions;
@@ -108,4 +108,5 @@ export interface RenderCellColumnProps {
108
108
  rowPath: string;
109
109
  index: number;
110
110
  element: string;
111
+ noAnswerMessage: string;
111
112
  }
@@ -17,6 +17,6 @@ export interface TableProps {
17
17
  columnLabels?: Record<string, string>;
18
18
  }
19
19
  export declare const isObjectArrayEmpty: (currentData: string) => boolean;
20
- export declare const renderNoneGivenText: (data: string | undefined) => string | import("react/jsx-runtime").JSX.Element;
21
- export declare const renderCellColumn: ({ data, error, errors, index, rowPath, element, isRequired, }: RenderCellColumnProps) => string | import("react/jsx-runtime").JSX.Element | null;
20
+ export declare const renderNoneGivenText: (data: string | undefined, noAnswerMessage: string) => string | import("react/jsx-runtime").JSX.Element;
21
+ export declare const renderCellColumn: ({ data, error, errors, index, rowPath, element, isRequired, noAnswerMessage, }: RenderCellColumnProps) => string | import("react/jsx-runtime").JSX.Element | null;
22
22
  export declare const createHumanizeError: (error: ErrorObject, schema: JsonSchema, uischema: UISchemaElement) => string | undefined;
@@ -27,3 +27,6 @@ export declare enum StepStatus {
27
27
  }
28
28
  export type StepStatusType = StepStatus.COMPLETED | StepStatus.NOT_STARTED | StepStatus.IN_PROGRESS;
29
29
  export declare const getAddressLookupFieldLabel: (fieldName: string) => string;
30
+ export declare const NO_ANSWER_MESSAGE = "(none given)";
31
+ export declare const BACK_TO_OVERVIEW_LABEL = "Back to application overview";
32
+ export declare const NEXT_BUTTON_LABEL = "Next";