@abgov/jsonforms-components 2.43.8 → 2.44.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
@@ -8204,8 +8204,8 @@ const GoAInputBaseTableReview = props => {
8204
8204
  const stepId = (_uischema$options3 = uischema.options) == null ? void 0 : _uischema$options3.stepId;
8205
8205
  return jsxs("tr", {
8206
8206
  "data-testid": `input-base-table-${label}-row`,
8207
- children: [labelToUpdate && jsx(PageReviewNameCol, {
8208
- children: jsx("strong", {
8207
+ children: [jsx(PageReviewNameCol, {
8208
+ children: labelToUpdate && jsx("strong", {
8209
8209
  children: labelToUpdate
8210
8210
  })
8211
8211
  }), jsx(PageReviewValueCol, {
@@ -8543,9 +8543,6 @@ let _$6 = t => t,
8543
8543
  const ReviewItem = styled.div(_t$7 || (_t$7 = _$6`
8544
8544
  display: flex;
8545
8545
  flex-direction: column;
8546
- div:empty {
8547
- display: none;
8548
- }
8549
8546
  `));
8550
8547
  const CompletionStatus = styled.div(_t2$4 || (_t2$4 = _$6`
8551
8548
  padding: 0;
@@ -9625,7 +9622,7 @@ const renderCellColumn = ({
9625
9622
  return null;
9626
9623
  };
9627
9624
 
9628
- const _excluded$3 = ["label", "path", "schema", "rootSchema", "uischema", "errors", "visible", "enabled", "cells", "data", "config", "isStepperReview", "handleChange", "removeItems"];
9625
+ const _excluded$4 = ["label", "path", "schema", "rootSchema", "uischema", "errors", "visible", "enabled", "cells", "data", "config", "isStepperReview", "handleChange", "removeItems"];
9629
9626
  const GenerateRows$1 = (Cell, schema, rowPath, enabled, openDeleteDialog, handleChange, cells, uischema, isInReview, count, data, errors) => {
9630
9627
  if ((schema == null ? void 0 : schema.type) === 'object') {
9631
9628
  const props = {
@@ -9995,7 +9992,7 @@ const ObjectArrayControl = props => {
9995
9992
  config,
9996
9993
  isStepperReview
9997
9994
  } = props,
9998
- additionalProps = _objectWithoutPropertiesLoose(props, _excluded$3);
9995
+ additionalProps = _objectWithoutPropertiesLoose(props, _excluded$4);
9999
9996
  const parsedData = data;
10000
9997
  const openDeleteDialog = useCallback((rowIndex, name) => {
10001
9998
  setOpen(true);
@@ -10310,7 +10307,7 @@ $$1({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
10310
10307
  }
10311
10308
  });
10312
10309
 
10313
- const _excluded$2 = ["label", "path", "schema", "rootSchema", "uischema", "errors", "openDeleteDialog", "visible", "enabled", "cells", "data", "config"];
10310
+ const _excluded$3 = ["label", "path", "schema", "rootSchema", "uischema", "errors", "openDeleteDialog", "visible", "enabled", "cells", "data", "config"];
10314
10311
  const getItemsTitle = schema => {
10315
10312
  const items = schema == null ? void 0 : schema.items;
10316
10313
  if (items && !Array.isArray(items) && typeof items === 'object') {
@@ -11028,7 +11025,7 @@ class ListWithDetailControl extends React.Component {
11028
11025
  data,
11029
11026
  config
11030
11027
  } = _this$props,
11031
- additionalProps = _objectWithoutPropertiesLoose(_this$props, _excluded$2);
11028
+ additionalProps = _objectWithoutPropertiesLoose(_this$props, _excluded$3);
11032
11029
  const controlElement = uischema;
11033
11030
  // eslint-disable-next-line
11034
11031
  const listTitle = (_ref = (_ref2 = (_ref3 = (_uischema$label = uischema == null ? void 0 : uischema.label) != null ? _uischema$label : uischema == null || (_uischema$options15 = uischema.options) == null ? void 0 : _uischema$options15.title) != null ? _ref3 : getItemsTitle(schema)) != null ? _ref2 : schema == null ? void 0 : schema.title) != null ? _ref : label;
@@ -11803,7 +11800,7 @@ const RenderLink = props => {
11803
11800
  });
11804
11801
  };
11805
11802
 
11806
- const _excluded$1 = ["isParent", "showLabel"];
11803
+ const _excluded$2 = ["isParent", "showLabel"];
11807
11804
  const HelpContentReviewComponent = () => {
11808
11805
  return jsx(Fragment, {
11809
11806
  children: " "
@@ -11848,7 +11845,7 @@ const HelpContentComponent = _ref => {
11848
11845
  isParent = true,
11849
11846
  showLabel = true
11850
11847
  } = _ref,
11851
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
11848
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
11852
11849
  const labelClass = isParent ? 'parent-label' : 'child-label';
11853
11850
  const marginClass = isParent ? 'parent-margin' : 'child-margin';
11854
11851
  // eslint-disable-next-line
@@ -12032,8 +12029,9 @@ const TableHelpContentComponent = props => {
12032
12029
  };
12033
12030
  const TableLayoutRenderer = withJsonFormsLayoutProps(TableLayoutRendererComponent);
12034
12031
  const TableGroupLayoutRenderer = withJsonFormsLayoutProps(TableGroupLayoutRendererComponent);
12035
- const TableHelpContentRenderer = withJsonFormsControlProps(TableHelpContentComponent);
12032
+ withJsonFormsControlProps(TableHelpContentComponent);
12036
12033
 
12034
+ const EmptyHelpContentRenderer = () => null;
12037
12035
  const GoABaseTableReviewRenderers$1 = [
12038
12036
  // controls
12039
12037
  {
@@ -12101,7 +12099,7 @@ const GoABaseTableReviewRenderers$1 = [
12101
12099
  renderer: TableGroupLayoutRenderer
12102
12100
  }, {
12103
12101
  tester: HelpContentTester,
12104
- renderer: TableHelpContentRenderer
12102
+ renderer: EmptyHelpContentRenderer
12105
12103
  }];
12106
12104
  [
12107
12105
  // controls
@@ -12167,7 +12165,7 @@ const GoABaseTableReviewRenderers$1 = [
12167
12165
  renderer: TableGroupLayoutRenderer
12168
12166
  }, {
12169
12167
  tester: HelpContentTester,
12170
- renderer: TableHelpContentRenderer
12168
+ renderer: EmptyHelpContentRenderer
12171
12169
  }];
12172
12170
  const FormStepperReviewer = props => {
12173
12171
  var _uischema$options$com, _uischema$options, _componentProps$readO;
@@ -12586,6 +12584,30 @@ const SummaryRow = ({
12586
12584
  });
12587
12585
  };
12588
12586
 
12587
+ const _excluded$1 = ["type"];
12588
+ const AdditionalInstructionsRow = ({
12589
+ additionalInstructions,
12590
+ componentProps
12591
+ }) => {
12592
+ const validTypes = ['information', 'important', 'emergency', 'success', 'event'];
12593
+ const calloutType = (componentProps == null ? void 0 : componentProps.type) || 'information';
12594
+ const type = validTypes.includes(calloutType) ? calloutType : 'information';
12595
+ const _ref = componentProps || {},
12596
+ otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
12597
+ return jsx("tr", {
12598
+ children: jsx("td", {
12599
+ colSpan: 2,
12600
+ children: jsx(GoabCallout, Object.assign({
12601
+ type: type,
12602
+ mt: "xl",
12603
+ mb: "l"
12604
+ }, otherProps, {
12605
+ children: additionalInstructions
12606
+ }))
12607
+ })
12608
+ });
12609
+ };
12610
+
12589
12611
  function mergeOrphanSections(sections) {
12590
12612
  const result = [];
12591
12613
  for (const section of sections) {
@@ -12644,9 +12666,20 @@ const TaskList = ({
12644
12666
  title,
12645
12667
  subtitle,
12646
12668
  isValid,
12647
- hideSummary
12669
+ hideSummary,
12670
+ additionalInstructions
12648
12671
  }) => {
12649
12672
  const testid = 'table-of-contents';
12673
+ const instructionsConfig = useMemo(() => {
12674
+ if (!additionalInstructions) return null;
12675
+ if (typeof additionalInstructions === 'string') {
12676
+ return {
12677
+ content: additionalInstructions,
12678
+ componentProps: {}
12679
+ };
12680
+ }
12681
+ return additionalInstructions;
12682
+ }, [additionalInstructions]);
12650
12683
  // Merge and expand sections
12651
12684
  const mergedSections = useMemo(() => {
12652
12685
  const sections = mergeOrphanSections(getCategorySections(categories));
@@ -12691,7 +12724,10 @@ const TaskList = ({
12691
12724
  onClick: onClick
12692
12725
  }, `cat-${category.label}-${idx}`) : null;
12693
12726
  })]
12694
- }, index)), !hideSummary ? jsx(SummaryRow, {
12727
+ }, index)), instructionsConfig && jsx(AdditionalInstructionsRow, {
12728
+ additionalInstructions: instructionsConfig.content,
12729
+ componentProps: instructionsConfig.componentProps
12730
+ }, "additional-instructions"), !hideSummary ? jsx(SummaryRow, {
12695
12731
  index: globalIndex,
12696
12732
  isValid: isValid,
12697
12733
  onClick: onClick
@@ -13021,7 +13057,7 @@ const FormPagesView = props => {
13021
13057
  goToPage(index);
13022
13058
  };
13023
13059
  if (categories.length + 1 === activeId) {
13024
- var _props$uischema, _props$uischema2, _props$uischema3;
13060
+ var _props$uischema, _props$uischema2, _props$uischema3, _props$uischema4;
13025
13061
  const patchedCategories = categories.map(c => {
13026
13062
  const scopes = getCategoryScopes(c);
13027
13063
  const hasData = hasDataInScopes(data, scopes);
@@ -13039,7 +13075,8 @@ const FormPagesView = props => {
13039
13075
  title: (_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.title,
13040
13076
  subtitle: (_props$uischema2 = props.uischema) == null || (_props$uischema2 = _props$uischema2.options) == null ? void 0 : _props$uischema2.subtitle,
13041
13077
  isValid: completedCount === visibleCats.length,
13042
- hideSummary: (_props$uischema3 = props.uischema) == null || (_props$uischema3 = _props$uischema3.options) == null ? void 0 : _props$uischema3.hideSummary
13078
+ hideSummary: (_props$uischema3 = props.uischema) == null || (_props$uischema3 = _props$uischema3.options) == null ? void 0 : _props$uischema3.hideSummary,
13079
+ additionalInstructions: (_props$uischema4 = props.uischema) == null || (_props$uischema4 = _props$uischema4.options) == null ? void 0 : _props$uischema4.additionalInstructions
13043
13080
  };
13044
13081
  return jsx(TaskList, Object.assign({}, tocProps));
13045
13082
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.43.8",
3
+ "version": "2.44.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,6 +1,14 @@
1
1
  import React from 'react';
2
2
  import { RankedTester } from '@jsonforms/core';
3
+ import { GoabCalloutType } from '@abgov/ui-components-common';
3
4
  import { CategoriesState } from '../context';
5
+ export interface AdditionalInstructionsConfig {
6
+ content: string;
7
+ componentProps?: {
8
+ type?: GoabCalloutType | string;
9
+ [key: string]: unknown;
10
+ };
11
+ }
4
12
  export interface TocProps {
5
13
  categories: CategoriesState;
6
14
  onClick: (id: number) => void;
@@ -8,6 +16,7 @@ export interface TocProps {
8
16
  subtitle?: string;
9
17
  isValid: boolean;
10
18
  hideSummary: boolean;
19
+ additionalInstructions?: string | AdditionalInstructionsConfig;
11
20
  }
12
21
  export declare const TaskList: React.FC<TocProps>;
13
22
  export declare const TableOfContentsTester: RankedTester;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { GoabCalloutType } from '@abgov/ui-components-common';
3
+ interface AdditionalInstructionsRowProps {
4
+ additionalInstructions: string;
5
+ componentProps?: {
6
+ type?: GoabCalloutType | string;
7
+ [key: string]: unknown;
8
+ };
9
+ }
10
+ export declare const AdditionalInstructionsRow: React.FC<AdditionalInstructionsRowProps>;
11
+ export {};