@abgov/jsonforms-components 2.73.1 → 2.74.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
@@ -12791,6 +12791,33 @@ class ListWithDetailControl extends React.Component {
12791
12791
  }
12792
12792
  }
12793
12793
 
12794
+ // clean-code-ignore: RULE-19 — covered by ./useReviewChange.spec.tsx, colocated. The rule looks for a
12795
+ // .test.ts sibling; the hook has to be exercised through a rendered component, so its spec is .tsx.
12796
+ /**
12797
+ * The single way a review summary's Change button reports a click.
12798
+ *
12799
+ * Two things have to happen and neither is optional. The stepper moves to the page, which is all a
12800
+ * host needs when the summary and the form are the same JsonForms instance. The review context is
12801
+ * also told, and that is the only signal a host whose summary lives on a *different* page can see —
12802
+ * it is what turns into a deep link back into the form.
12803
+ *
12804
+ * Renderers used to wire these up one at a time, and every renderer except the plain-input one
12805
+ * called goToPage alone, so a composite control's Change button was silently inert for a cross-page
12806
+ * host. Going through here makes forgetting the second half impossible.
12807
+ */
12808
+ const useReviewChange = () => {
12809
+ const stepperContext = useContext(JsonFormsStepperContext);
12810
+ const reviewContext = useReviewContext();
12811
+ return useCallback((stepId, scope) => {
12812
+ // Outside a stepper there is no page to move to, but the host may still resolve the field's
12813
+ // own page from the scope, so the report below happens either way.
12814
+ if (stepId !== undefined) {
12815
+ stepperContext == null || stepperContext.goToPage(stepId, scope);
12816
+ }
12817
+ reviewContext == null || reviewContext.onChangeDispatch(stepId, scope != null ? scope : '');
12818
+ }, [stepperContext, reviewContext]);
12819
+ };
12820
+
12794
12821
  const GoAInputBaseTableReview = props => {
12795
12822
  var _uischema$options, _uischema$scope2, _jsonForms$core, _uischema$options4, _uischema$options5, _uischema$options6;
12796
12823
  const {
@@ -12806,8 +12833,7 @@ const GoAInputBaseTableReview = props => {
12806
12833
  required,
12807
12834
  visible
12808
12835
  } = props;
12809
- const context = useContext(JsonFormsStepperContext);
12810
- const reviewCtx = useReviewContext();
12836
+ const reportChange = useReviewChange();
12811
12837
  const showChangeButtons = useShowChangeButtons();
12812
12838
  const jsonForms = useJsonForms();
12813
12839
  const reviewLabel = typeof ((_uischema$options = uischema.options) == null ? void 0 : _uischema$options.reviewLabel) === 'string' ? uischema.options.reviewLabel : '';
@@ -12979,8 +13005,7 @@ const GoAInputBaseTableReview = props => {
12979
13005
  // eslint-disable-next-line
12980
13006
  const stepId = (_uischema$options5 = uischema.options) == null ? void 0 : _uischema$options5.stepId;
12981
13007
  function handleChangeClick() {
12982
- context == null || context.goToPage(stepId, uischema.scope);
12983
- reviewCtx == null || reviewCtx.onChangeDispatch(stepId, uischema.scope);
13008
+ reportChange(stepId, uischema.scope);
12984
13009
  }
12985
13010
  const showInlineValue = reviewText === null || reviewText === undefined || typeof reviewText === 'string' || typeof reviewText === 'number' || /*#__PURE__*/React.isValidElement(reviewText) || Array.isArray(reviewText) && reviewText.length === 0;
12986
13011
  const isValueEmpty = !isBooleanRequiredError && (reviewText === null || reviewText === undefined || reviewText === '' || Array.isArray(reviewText) && reviewText.length === 0);
@@ -13521,7 +13546,7 @@ const FullNameTester = rankWith(4, isFullName);
13521
13546
 
13522
13547
  const FullNameControlReview = props => {
13523
13548
  var _props$uischema, _props$schema$require, _props$schema;
13524
- const context = useContext(JsonFormsStepperContext);
13549
+ const reportChange = useReviewChange();
13525
13550
  const showChangeButtons = useShowChangeButtons();
13526
13551
  const stepId = (_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.stepId;
13527
13552
  const {
@@ -13543,7 +13568,7 @@ const FullNameControlReview = props => {
13543
13568
  })]
13544
13569
  }), showChangeButtons && stepId !== undefined && !((_uischema$options = uischema.options) != null && (_uischema$options = _uischema$options.componentProps) != null && _uischema$options.readOnly) && jsx(GoabButton, {
13545
13570
  type: "text",
13546
- onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
13571
+ onClick: () => reportChange(stepId, uischema.scope),
13547
13572
  testId: `${fieldName}-change-btn`,
13548
13573
  children: "Change"
13549
13574
  })]
@@ -13575,7 +13600,7 @@ const FullNameDobReviewControl = props => {
13575
13600
  id,
13576
13601
  uischema
13577
13602
  } = props;
13578
- const context = useContext(JsonFormsStepperContext);
13603
+ const reportChange = useReviewChange();
13579
13604
  const showChangeButtons = useShowChangeButtons();
13580
13605
  const stepId = uischema == null || (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.stepId;
13581
13606
  const requiredFields = (_props$schema$require = (_props$schema = props.schema) == null ? void 0 : _props$schema.required) != null ? _props$schema$require : [];
@@ -13593,7 +13618,7 @@ const FullNameDobReviewControl = props => {
13593
13618
  }), showChangeButtons && stepId !== undefined && !((_uischema$options2 = uischema.options) != null && (_uischema$options2 = _uischema$options2.componentProps) != null && _uischema$options2.readOnly) && jsx(GoabButton, {
13594
13619
  type: "text",
13595
13620
  size: "compact",
13596
- onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
13621
+ onClick: () => reportChange(stepId, uischema.scope),
13597
13622
  testId: `${fieldName}-change-btn`,
13598
13623
  children: "Change"
13599
13624
  })]
@@ -13962,7 +13987,7 @@ const ContractInfoControl = props => {
13962
13987
 
13963
13988
  const ContractInfoControlReview = props => {
13964
13989
  var _props$uischema, _schema$required, _options$enableEmail, _options$enablePhone, _options$emailFirst;
13965
- const context = useContext(JsonFormsStepperContext);
13990
+ const reportChange = useReviewChange();
13966
13991
  const showChangeButtons = useShowChangeButtons();
13967
13992
  const stepId = (_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.stepId;
13968
13993
  const {
@@ -13984,7 +14009,7 @@ const ContractInfoControlReview = props => {
13984
14009
  }), showChangeButtons && stepId !== undefined && !((_uischema$options = uischema.options) != null && (_uischema$options = _uischema$options.componentProps) != null && _uischema$options.readOnly) && jsx(GoabButton, {
13985
14010
  type: "text",
13986
14011
  size: "compact",
13987
- onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
14012
+ onClick: () => reportChange(stepId, uischema.scope),
13988
14013
  testId: `${fieldName}-change-btn`,
13989
14014
  children: "Change"
13990
14015
  })]
@@ -14611,7 +14636,7 @@ const ObjectArrayControl = props => {
14611
14636
  const [open, setOpen] = useState(false);
14612
14637
  const [rowData, setRowData] = useState(0);
14613
14638
  const [maxItemsError, setMaxItemsError] = useState('');
14614
- const context = useContext(JsonFormsStepperContext);
14639
+ const reportChange = useReviewChange();
14615
14640
  const showChangeButtons = useShowChangeButtons();
14616
14641
  const {
14617
14642
  label,
@@ -14798,7 +14823,7 @@ const ObjectArrayControl = props => {
14798
14823
  size: "compact",
14799
14824
  onClick: () => {
14800
14825
  var _uischema$options8;
14801
- return context == null ? void 0 : context.goToPage((_uischema$options8 = uischema.options) == null ? void 0 : _uischema$options8.stepId);
14826
+ return reportChange((_uischema$options8 = uischema.options) == null ? void 0 : _uischema$options8.stepId, uischema.scope);
14802
14827
  },
14803
14828
  children: "Change"
14804
14829
  })]
@@ -15316,7 +15341,7 @@ const AddressLoopUpControlTableReview = props => {
15316
15341
  } = props;
15317
15342
  const jsonForms = useJsonForms();
15318
15343
  const stepId = (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.stepId;
15319
- const formStepperCtx = useContext(JsonFormsStepperContext);
15344
+ const reportChange = useReviewChange();
15320
15345
  const showChangeButtons = useShowChangeButtons();
15321
15346
  const isAlbertaAddress = (schema == null || (_schema$properties2 = schema.properties) == null || (_schema$properties2 = _schema$properties2.subdivisionCode) == null ? void 0 : _schema$properties2.const) === 'AB';
15322
15347
  const provinces = [{
@@ -15429,7 +15454,7 @@ const AddressLoopUpControlTableReview = props => {
15429
15454
  }), showButton && showChangeButtons && stepId !== undefined && !((_uischema$options2 = uischema.options) != null && (_uischema$options2 = _uischema$options2.componentProps) != null && _uischema$options2.readOnly) && jsx(GoabButton, {
15430
15455
  type: "text",
15431
15456
  size: "compact",
15432
- onClick: () => formStepperCtx == null ? void 0 : formStepperCtx.goToPage(stepId, targetScope),
15457
+ onClick: () => reportChange(stepId, targetScope),
15433
15458
  testId: "address-change-btn",
15434
15459
  children: "Change"
15435
15460
  })]
@@ -15455,7 +15480,7 @@ const AddressLoopUpControlTableReview = props => {
15455
15480
  }), showChangeButtons && stepId !== undefined && !((_uischema$options3 = uischema.options) != null && (_uischema$options3 = _uischema$options3.componentProps) != null && _uischema$options3.readOnly) && jsx(GoabButton, {
15456
15481
  type: "text",
15457
15482
  size: "compact",
15458
- onClick: () => formStepperCtx == null ? void 0 : formStepperCtx.goToPage(stepId, targetScope),
15483
+ onClick: () => reportChange(stepId, targetScope),
15459
15484
  testId: "address-change-btn",
15460
15485
  children: "Change"
15461
15486
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.73.1",
3
+ "version": "2.74.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-08-27T22:10:25.781Z",
4
- "sourceCommit": "8963e4fedf4c8f323ddc21c852273f0d75b2f99f",
3
+ "generatedAt": "2026-09-03T20:26:40.184Z",
4
+ "sourceCommit": "a9f11f1d8a8d4394f1d1bdfcd5591d245e024d51",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 33,
7
7
  "renderers": [
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The single way a review summary's Change button reports a click.
3
+ *
4
+ * Two things have to happen and neither is optional. The stepper moves to the page, which is all a
5
+ * host needs when the summary and the form are the same JsonForms instance. The review context is
6
+ * also told, and that is the only signal a host whose summary lives on a *different* page can see —
7
+ * it is what turns into a deep link back into the form.
8
+ *
9
+ * Renderers used to wire these up one at a time, and every renderer except the plain-input one
10
+ * called goToPage alone, so a composite control's Change button was silently inert for a cross-page
11
+ * host. Going through here makes forgetting the second half impossible.
12
+ */
13
+ export declare const useReviewChange: () => ((stepId: number | undefined, scope?: string) => void);