@abgov/jsonforms-components 2.1.6 → 2.3.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
@@ -1,7 +1,7 @@
1
1
  import * as runtime from 'react/jsx-runtime';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
3
  import React, { createContext, useContext, useReducer, useMemo, useEffect, useState, useRef, useCallback } from 'react';
4
- import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoARadioGroup, GoARadioItem, GoACheckbox, GoAIcon, GoAGrid, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAModal, GoAButtonGroup, GoATable, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoADropdown, GoADropdownItem, GoADetails, GoASpinner } from '@abgov/react-components';
4
+ import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoARadioGroup, GoARadioItem, GoACheckbox, GoAIcon, GoAGrid, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAModal, GoAButtonGroup, GoABadge, GoATable, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoADropdown, GoADropdownItem, GoADetails, GoASpinner } from '@abgov/react-components';
5
5
  import styled from 'styled-components';
6
6
  import axios from 'axios';
7
7
  import get$1 from 'lodash/get';
@@ -5435,7 +5435,12 @@ let _$6 = t => t,
5435
5435
  _t14$1,
5436
5436
  _t15$1,
5437
5437
  _t16$1,
5438
- _t17$1;
5438
+ _t17$1,
5439
+ _t18$1,
5440
+ _t19$1,
5441
+ _t20,
5442
+ _t21,
5443
+ _t22;
5439
5444
  const ReviewItem = styled.div(_t$6 || (_t$6 = _$6`
5440
5445
  display: flex;
5441
5446
  flex-direction: column;
@@ -5536,6 +5541,30 @@ const TableReviewPageTitleRow = styled.div(_t16$1 || (_t16$1 = _$6`
5536
5541
  const TableReviewCategoryLabel = styled.h3(_t17$1 || (_t17$1 = _$6`
5537
5542
  color: var(--goa-color-text-secondary) !important;
5538
5543
  `));
5544
+ const CategoryStatus = styled.td(_t18$1 || (_t18$1 = _$6`
5545
+ width: var(--goa-space-xl);
5546
+ padding-right: var(--goa-space-xl);
5547
+ `));
5548
+ const TocPageRef = styled.td(_t19$1 || (_t19$1 = _$6`
5549
+ padding-left: var(--goa-space-xl);
5550
+ `));
5551
+ const TocTitle = styled.h1(_t20 || (_t20 = _$6`
5552
+ padding: 0;
5553
+ margin: 0;
5554
+ padding-left: var(--goa-space-xl);
5555
+ padding-bottom: var(--goa-space-3xl);
5556
+ `));
5557
+ const TocSubtitle = styled.h2(_t21 || (_t21 = _$6`
5558
+ padding: 0;
5559
+ margin: 0;
5560
+ padding-left: var(--goa-space-xl);
5561
+ `));
5562
+ const CompletionStatus = styled.div(_t22 || (_t22 = _$6`
5563
+ padding: 0;
5564
+ margin: 0;
5565
+ padding-left: var(--goa-space-xl);
5566
+ padding-bottom: var(--goa-space-xl);
5567
+ `));
5539
5568
 
5540
5569
  class ContextProviderClass {
5541
5570
  addDataByUrl(key, url, processDataFunction, token) {
@@ -6485,6 +6514,165 @@ const BackButton = ({
6485
6514
  });
6486
6515
  };
6487
6516
 
6517
+ var aCallable$5 = aCallable$9;
6518
+ var toObject = toObject$8;
6519
+ var IndexedObject = indexedObject;
6520
+ var lengthOfArrayLike$1 = lengthOfArrayLike$7;
6521
+
6522
+ var $TypeError$6 = TypeError;
6523
+
6524
+ var REDUCE_EMPTY = 'Reduce of empty array with no initial value';
6525
+
6526
+ // `Array.prototype.{ reduce, reduceRight }` methods implementation
6527
+ var createMethod = function (IS_RIGHT) {
6528
+ return function (that, callbackfn, argumentsLength, memo) {
6529
+ var O = toObject(that);
6530
+ var self = IndexedObject(O);
6531
+ var length = lengthOfArrayLike$1(O);
6532
+ aCallable$5(callbackfn);
6533
+ if (length === 0 && argumentsLength < 2) throw new $TypeError$6(REDUCE_EMPTY);
6534
+ var index = IS_RIGHT ? length - 1 : 0;
6535
+ var i = IS_RIGHT ? -1 : 1;
6536
+ if (argumentsLength < 2) while (true) {
6537
+ if (index in self) {
6538
+ memo = self[index];
6539
+ index += i;
6540
+ break;
6541
+ }
6542
+ index += i;
6543
+ if (IS_RIGHT ? index < 0 : length <= index) {
6544
+ throw new $TypeError$6(REDUCE_EMPTY);
6545
+ }
6546
+ }
6547
+ for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
6548
+ memo = callbackfn(memo, self[index], index, O);
6549
+ }
6550
+ return memo;
6551
+ };
6552
+ };
6553
+
6554
+ var arrayReduce = {
6555
+ // `Array.prototype.reduce` method
6556
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
6557
+ left: createMethod(false),
6558
+ // `Array.prototype.reduceRight` method
6559
+ // https://tc39.es/ecma262/#sec-array.prototype.reduceright
6560
+ right: createMethod(true)
6561
+ };
6562
+
6563
+ var fails$2 = fails$s;
6564
+
6565
+ var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
6566
+ var method = [][METHOD_NAME];
6567
+ return !!method && fails$2(function () {
6568
+ // eslint-disable-next-line no-useless-call -- required for testing
6569
+ method.call(null, argument || function () { return 1; }, 1);
6570
+ });
6571
+ };
6572
+
6573
+ var global$8 = global$p;
6574
+ var classof$1 = classofRaw$2;
6575
+
6576
+ var engineIsNode = classof$1(global$8.process) === 'process';
6577
+
6578
+ var $$9 = _export;
6579
+ var $reduce = arrayReduce.left;
6580
+ var arrayMethodIsStrict = arrayMethodIsStrict$1;
6581
+ var CHROME_VERSION = engineV8Version;
6582
+ var IS_NODE$4 = engineIsNode;
6583
+
6584
+ // Chrome 80-82 has a critical bug
6585
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
6586
+ var CHROME_BUG = !IS_NODE$4 && CHROME_VERSION > 79 && CHROME_VERSION < 83;
6587
+ var FORCED$1 = CHROME_BUG || !arrayMethodIsStrict('reduce');
6588
+
6589
+ // `Array.prototype.reduce` method
6590
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
6591
+ $$9({ target: 'Array', proto: true, forced: FORCED$1 }, {
6592
+ reduce: function reduce(callbackfn /* , initialValue */) {
6593
+ var length = arguments.length;
6594
+ return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
6595
+ }
6596
+ });
6597
+
6598
+ var PageStatus;
6599
+ (function (PageStatus) {
6600
+ PageStatus["Complete"] = "Completed";
6601
+ PageStatus["Incomplete"] = "Incomplete";
6602
+ PageStatus["NotStarted"] = "Not started";
6603
+ })(PageStatus || (PageStatus = {}));
6604
+ const getCategoryStatus = category => {
6605
+ return category.isVisited ? category.isCompleted && category.isValid ? PageStatus.Complete : PageStatus.Incomplete : PageStatus.NotStarted;
6606
+ };
6607
+ const getCategoryStatusBadge = category => {
6608
+ const status = getCategoryStatus(category);
6609
+ const badgeType = status === PageStatus.Complete ? 'success' : 'information';
6610
+ return jsx(GoABadge, {
6611
+ type: badgeType,
6612
+ content: status,
6613
+ ariaLabel: status
6614
+ });
6615
+ };
6616
+
6617
+ const ApplicationStatus = ({
6618
+ categories
6619
+ }) => {
6620
+ const total = categories.length;
6621
+ const completed = categories.reduce((acc, cat) => acc + (getCategoryStatus(cat) === PageStatus.Complete ? 1 : 0), 0);
6622
+ const type = total === completed ? 'success' : 'important';
6623
+ const heading = total === completed ? 'Application complete' : 'Application incomplete';
6624
+ const message = `You have completed ${completed} of ${total} sections.`;
6625
+ return jsx(CompletionStatus, {
6626
+ children: jsx(GoACallout, {
6627
+ type: type,
6628
+ heading: heading,
6629
+ size: "medium",
6630
+ maxWidth: '50%',
6631
+ children: message
6632
+ })
6633
+ });
6634
+ };
6635
+
6636
+ /* eslint-disable jsx-a11y/anchor-is-valid */
6637
+ const TableOfContents = props => {
6638
+ var _a;
6639
+ const testid = 'table-of-contents';
6640
+ return jsx(PageBorder, {
6641
+ children: jsxs("div", {
6642
+ "data-testid": testid,
6643
+ children: [props.title && jsx(TocTitle, {
6644
+ children: props.title
6645
+ }), jsx(ApplicationStatus, {
6646
+ categories: props.categories
6647
+ }), props.subtitle && jsx(TocSubtitle, {
6648
+ children: props.subtitle
6649
+ }), jsx(GoATable, {
6650
+ width: "100%",
6651
+ children: jsx("tbody", {
6652
+ children: (_a = props.categories) === null || _a === void 0 ? void 0 : _a.map((category, index) => {
6653
+ return jsxs("tr", {
6654
+ children: [jsx(TocPageRef, {
6655
+ children: jsx("a", {
6656
+ "data-testid": `page-ref-${index}`,
6657
+ href: "#",
6658
+ onClick: e => {
6659
+ e.preventDefault();
6660
+ props.onClick(index);
6661
+ },
6662
+ children: category.label
6663
+ })
6664
+ }), jsx(CategoryStatus, {
6665
+ children: getCategoryStatusBadge(category)
6666
+ })]
6667
+ });
6668
+ })
6669
+ })
6670
+ })]
6671
+ })
6672
+ });
6673
+ };
6674
+ rankWith(1, uiTypeIs('TaskSection'));
6675
+
6488
6676
  const FormStepperPageReviewer = props => {
6489
6677
  const {
6490
6678
  uischema,
@@ -6579,35 +6767,18 @@ const FormStepperPageReviewer = props => {
6579
6767
  };
6580
6768
  withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormStepperPageReviewer)));
6581
6769
 
6582
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6583
- const FormPageStepper = props => {
6584
- const formStepperCtx = useContext(JsonFormsStepperContext);
6585
- /**
6586
- * StepperCtx can only be provided once to prevent issues from categorization in categorization
6587
- * */
6588
- if ((formStepperCtx === null || formStepperCtx === void 0 ? void 0 : formStepperCtx.isProvided) === true) {
6589
- return jsx(FormPagesView, Object.assign({}, props));
6590
- }
6591
- return jsx(JsonFormsStepperContextProvider, {
6592
- StepperProps: Object.assign({}, props),
6593
- children: jsx(FormPagesView, Object.assign({}, props))
6594
- });
6595
- };
6596
- const FormPagesView = props => {
6770
+ const RenderPages = props => {
6597
6771
  const {
6598
- uischema,
6599
6772
  data,
6600
6773
  schema,
6601
6774
  path,
6602
6775
  cells,
6603
6776
  renderers,
6604
- visible,
6605
- t
6606
- } = props;
6777
+ visible
6778
+ } = props.categoryProps;
6607
6779
  const enumerators = useContext(JsonFormContext);
6608
6780
  const formStepperCtx = useContext(JsonFormsStepperContext);
6609
6781
  const {
6610
- validatePage,
6611
6782
  goToPage,
6612
6783
  toggleShowReviewLink
6613
6784
  } = formStepperCtx;
@@ -6630,9 +6801,6 @@ const FormPagesView = props => {
6630
6801
  const onCloseModal = () => {
6631
6802
  setIsOpen(false);
6632
6803
  };
6633
- useEffect(() => {
6634
- validatePage(activeId);
6635
- }, [data]);
6636
6804
  return jsxs("div", {
6637
6805
  "data-testid": "form-stepper-test-wrapper",
6638
6806
  children: [jsx(Visible, {
@@ -6658,11 +6826,7 @@ const FormPagesView = props => {
6658
6826
  style: {
6659
6827
  marginTop: '1.5rem'
6660
6828
  },
6661
- children: [index > 0 && jsx(BackButton, {
6662
- testId: "back-button",
6663
- link: () => goToPage(activeId - 1),
6664
- text: "Back"
6665
- }), jsxs(PageRenderPadding, {
6829
+ children: [props.renderBackButton(index, activeId), jsxs(PageRenderPadding, {
6666
6830
  children: [jsxs("h3", {
6667
6831
  children: ["Step ", index + 1, " of ", categories.length]
6668
6832
  }), jsx(RenderStepElements, Object.assign({}, categoryProps))]
@@ -6690,7 +6854,7 @@ const FormPagesView = props => {
6690
6854
  }
6691
6855
  }), isOnReview && jsxs("div", {
6692
6856
  "data-testid": "stepper-pages-review-page",
6693
- children: [jsx(FormStepperPageReviewer, Object.assign({}, props, {
6857
+ children: [jsx(FormStepperPageReviewer, Object.assign({}, props.categoryProps, {
6694
6858
  navigationFunc: goToPage
6695
6859
  })), jsx(PageRenderPadding, {
6696
6860
  children: jsx(GoAButtonGroup, {
@@ -6727,6 +6891,71 @@ const FormPagesView = props => {
6727
6891
  })]
6728
6892
  });
6729
6893
  };
6894
+
6895
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6896
+ const FormPageStepper = props => {
6897
+ const formStepperCtx = useContext(JsonFormsStepperContext);
6898
+ /**
6899
+ * StepperCtx can only be provided once to prevent issues from categorization in categorization
6900
+ * */
6901
+ if ((formStepperCtx === null || formStepperCtx === void 0 ? void 0 : formStepperCtx.isProvided) === true) {
6902
+ return jsx(FormPagesView, Object.assign({}, props));
6903
+ }
6904
+ return jsx(JsonFormsStepperContextProvider, {
6905
+ StepperProps: Object.assign({}, props),
6906
+ children: jsx(FormPagesView, Object.assign({}, props))
6907
+ });
6908
+ };
6909
+ const FormPagesView = props => {
6910
+ var _a, _b, _c, _d;
6911
+ const data = props.data;
6912
+ const formStepperCtx = useContext(JsonFormsStepperContext);
6913
+ const {
6914
+ validatePage,
6915
+ goToPage
6916
+ } = formStepperCtx;
6917
+ const {
6918
+ categories,
6919
+ activeId
6920
+ } = formStepperCtx.selectStepperState();
6921
+ useEffect(() => {
6922
+ validatePage(activeId);
6923
+ }, [data]);
6924
+ const [showTOC, setShowTOC] = useState(true);
6925
+ const handleGoToPage = index => {
6926
+ setShowTOC(false);
6927
+ goToPage(index);
6928
+ };
6929
+ // Make sure the back button on the first page takes us to the Table of Contents.
6930
+ const renderBackButton = (index, activeId) => {
6931
+ if (index > 0) {
6932
+ return jsx(BackButton, {
6933
+ testId: "back-button",
6934
+ link: () => goToPage(activeId - 1),
6935
+ text: "Back"
6936
+ });
6937
+ }
6938
+ return jsx(BackButton, {
6939
+ testId: "back-button",
6940
+ link: () => setShowTOC(true),
6941
+ text: "Back"
6942
+ });
6943
+ };
6944
+ if (showTOC) {
6945
+ const tocProps = {
6946
+ categories,
6947
+ onClick: handleGoToPage,
6948
+ title: (_b = (_a = props.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.title,
6949
+ subtitle: (_d = (_c = props.uischema) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.subtitle
6950
+ };
6951
+ return jsx(TableOfContents, Object.assign({}, tocProps));
6952
+ } else {
6953
+ return jsx(RenderPages, {
6954
+ categoryProps: props,
6955
+ renderBackButton: renderBackButton
6956
+ });
6957
+ }
6958
+ };
6730
6959
  const FormStepperPagesControl = withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormPageStepper)));
6731
6960
 
6732
6961
  // Ensure that all children (Category) have valid elements or things tend
@@ -7030,7 +7259,7 @@ var isArrayIteratorMethod$1 = function (it) {
7030
7259
  return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$3] === it);
7031
7260
  };
7032
7261
 
7033
- var classof$1 = classof$9;
7262
+ var classof = classof$9;
7034
7263
  var getMethod$1 = getMethod$5;
7035
7264
  var isNullOrUndefined$1 = isNullOrUndefined$6;
7036
7265
  var Iterators = iterators;
@@ -7041,21 +7270,21 @@ var ITERATOR$2 = wellKnownSymbol$3('iterator');
7041
7270
  var getIteratorMethod$2 = function (it) {
7042
7271
  if (!isNullOrUndefined$1(it)) return getMethod$1(it, ITERATOR$2)
7043
7272
  || getMethod$1(it, '@@iterator')
7044
- || Iterators[classof$1(it)];
7273
+ || Iterators[classof(it)];
7045
7274
  };
7046
7275
 
7047
7276
  var call$5 = functionCall;
7048
- var aCallable$5 = aCallable$9;
7277
+ var aCallable$4 = aCallable$9;
7049
7278
  var anObject$4 = anObject$f;
7050
7279
  var tryToString$2 = tryToString$4;
7051
7280
  var getIteratorMethod$1 = getIteratorMethod$2;
7052
7281
 
7053
- var $TypeError$6 = TypeError;
7282
+ var $TypeError$5 = TypeError;
7054
7283
 
7055
7284
  var getIterator$1 = function (argument, usingIterator) {
7056
7285
  var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
7057
- if (aCallable$5(iteratorMethod)) return anObject$4(call$5(iteratorMethod, argument));
7058
- throw new $TypeError$6(tryToString$2(argument) + ' is not iterable');
7286
+ if (aCallable$4(iteratorMethod)) return anObject$4(call$5(iteratorMethod, argument));
7287
+ throw new $TypeError$5(tryToString$2(argument) + ' is not iterable');
7059
7288
  };
7060
7289
 
7061
7290
  var call$4 = functionCall;
@@ -7087,13 +7316,13 @@ var call$3 = functionCall;
7087
7316
  var anObject$2 = anObject$f;
7088
7317
  var tryToString$1 = tryToString$4;
7089
7318
  var isArrayIteratorMethod = isArrayIteratorMethod$1;
7090
- var lengthOfArrayLike$1 = lengthOfArrayLike$7;
7319
+ var lengthOfArrayLike = lengthOfArrayLike$7;
7091
7320
  var isPrototypeOf$1 = objectIsPrototypeOf;
7092
7321
  var getIterator = getIterator$1;
7093
7322
  var getIteratorMethod = getIteratorMethod$2;
7094
7323
  var iteratorClose = iteratorClose$1;
7095
7324
 
7096
- var $TypeError$5 = TypeError;
7325
+ var $TypeError$4 = TypeError;
7097
7326
 
7098
7327
  var Result = function (stopped, result) {
7099
7328
  this.stopped = stopped;
@@ -7129,10 +7358,10 @@ var iterate$3 = function (iterable, unboundFunction, options) {
7129
7358
  iterator = iterable;
7130
7359
  } else {
7131
7360
  iterFn = getIteratorMethod(iterable);
7132
- if (!iterFn) throw new $TypeError$5(tryToString$1(iterable) + ' is not iterable');
7361
+ if (!iterFn) throw new $TypeError$4(tryToString$1(iterable) + ' is not iterable');
7133
7362
  // optimisation for array iterators
7134
7363
  if (isArrayIteratorMethod(iterFn)) {
7135
- for (index = 0, length = lengthOfArrayLike$1(iterable); length > index; index++) {
7364
+ for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
7136
7365
  result = callFn(iterable[index]);
7137
7366
  if (result && isPrototypeOf$1(ResultPrototype, result)) return result;
7138
7367
  } return new Result(false);
@@ -7160,13 +7389,13 @@ var createProperty$1 = function (object, key, value) {
7160
7389
  else object[key] = value;
7161
7390
  };
7162
7391
 
7163
- var $$9 = _export;
7392
+ var $$8 = _export;
7164
7393
  var iterate$2 = iterate$3;
7165
7394
  var createProperty = createProperty$1;
7166
7395
 
7167
7396
  // `Object.fromEntries` method
7168
7397
  // https://github.com/tc39/proposal-object-from-entries
7169
- $$9({ target: 'Object', stat: true }, {
7398
+ $$8({ target: 'Object', stat: true }, {
7170
7399
  fromEntries: function fromEntries(iterable) {
7171
7400
  var obj = {};
7172
7401
  iterate$2(iterable, function (k, v) {
@@ -7176,35 +7405,35 @@ $$9({ target: 'Object', stat: true }, {
7176
7405
  }
7177
7406
  });
7178
7407
 
7179
- var global$8 = global$p;
7180
- var fails$2 = fails$s;
7408
+ var global$7 = global$p;
7409
+ var fails$1 = fails$s;
7181
7410
  var uncurryThis$1 = functionUncurryThis;
7182
7411
  var toString$1 = toString$f;
7183
7412
  var trim = stringTrim.trim;
7184
7413
  var whitespaces = whitespaces$3;
7185
7414
 
7186
- var $parseInt$1 = global$8.parseInt;
7187
- var Symbol$1 = global$8.Symbol;
7415
+ var $parseInt$1 = global$7.parseInt;
7416
+ var Symbol$1 = global$7.Symbol;
7188
7417
  var ITERATOR$1 = Symbol$1 && Symbol$1.iterator;
7189
7418
  var hex = /^[+-]?0x/i;
7190
7419
  var exec = uncurryThis$1(hex.exec);
7191
- var FORCED$1 = $parseInt$1(whitespaces + '08') !== 8 || $parseInt$1(whitespaces + '0x16') !== 22
7420
+ var FORCED = $parseInt$1(whitespaces + '08') !== 8 || $parseInt$1(whitespaces + '0x16') !== 22
7192
7421
  // MS Edge 18- broken with boxed symbols
7193
- || (ITERATOR$1 && !fails$2(function () { $parseInt$1(Object(ITERATOR$1)); }));
7422
+ || (ITERATOR$1 && !fails$1(function () { $parseInt$1(Object(ITERATOR$1)); }));
7194
7423
 
7195
7424
  // `parseInt` method
7196
7425
  // https://tc39.es/ecma262/#sec-parseint-string-radix
7197
- var numberParseInt = FORCED$1 ? function parseInt(string, radix) {
7426
+ var numberParseInt = FORCED ? function parseInt(string, radix) {
7198
7427
  var S = trim(toString$1(string));
7199
7428
  return $parseInt$1(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));
7200
7429
  } : $parseInt$1;
7201
7430
 
7202
- var $$8 = _export;
7431
+ var $$7 = _export;
7203
7432
  var $parseInt = numberParseInt;
7204
7433
 
7205
7434
  // `parseInt` method
7206
7435
  // https://tc39.es/ecma262/#sec-parseint-string-radix
7207
- $$8({ global: true, forced: parseInt !== $parseInt }, {
7436
+ $$7({ global: true, forced: parseInt !== $parseInt }, {
7208
7437
  parseInt: $parseInt
7209
7438
  });
7210
7439
 
@@ -8186,7 +8415,7 @@ const GenerateRows = (Cell, schema, rowPath, enabled, cells, uischema) => {
8186
8415
  cellPath: rowPath,
8187
8416
  enabled
8188
8417
  };
8189
- return jsx(Cell, Object.assign({}, props), rowPath);
8418
+ return jsx(Cell, Object.assign({}, props), `${rowPath}`);
8190
8419
  }
8191
8420
  };
8192
8421
  const getValidColumnProps = scopedSchema => {
@@ -8274,19 +8503,19 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
8274
8503
  return jsxs(Fragment, {
8275
8504
  children: [
8276
8505
  // eslint-disable-next-line
8277
- (_a = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _a === void 0 ? void 0 : _a.map(element => {
8506
+ (_a = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _a === void 0 ? void 0 : _a.map((element, index) => {
8278
8507
  return jsx(JsonFormsDispatch, {
8279
8508
  "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
8280
8509
  schema: schema,
8281
8510
  uischema: element,
8282
- path: rowPath,
8511
+ path: `${rowPath}-${index}`,
8283
8512
  enabled: enabled,
8284
8513
  renderers: renderers,
8285
8514
  cells: cells
8286
8515
  }, rowPath);
8287
8516
  }),
8288
8517
  // eslint-disable-next-line
8289
- (_d = (_c = (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.detail) === null || _c === void 0 ? void 0 : _c.elements) === null || _d === void 0 ? void 0 : _d.map(element => {
8518
+ (_d = (_c = (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.detail) === null || _c === void 0 ? void 0 : _c.elements) === null || _d === void 0 ? void 0 : _d.map((element, index) => {
8290
8519
  return jsx(JsonFormsDispatch, {
8291
8520
  "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
8292
8521
  schema: schema,
@@ -8295,7 +8524,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
8295
8524
  enabled: enabled,
8296
8525
  renderers: renderers,
8297
8526
  cells: cells
8298
- }, rowPath);
8527
+ }, `${rowPath}-${index}`);
8299
8528
  }), ((_e = uiSchemaElementsForNotDefined === null || uiSchemaElementsForNotDefined === void 0 ? void 0 : uiSchemaElementsForNotDefined.elements) === null || _e === void 0 ? void 0 : _e.length) > 0 && jsx(JsonFormsDispatch, {
8300
8529
  schema: schema,
8301
8530
  uischema: uiSchemaElementsForNotDefined,
@@ -8303,7 +8532,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
8303
8532
  enabled: enabled,
8304
8533
  renderers: renderers,
8305
8534
  cells: cells
8306
- })]
8535
+ }, `${rowPath}`)]
8307
8536
  });
8308
8537
  });
8309
8538
  const NonEmptyCell = ownProps => {
@@ -8774,7 +9003,7 @@ const AddressInputs = ({
8774
9003
  });
8775
9004
  };
8776
9005
 
8777
- var $$7 = _export;
9006
+ var $$6 = _export;
8778
9007
  var uncurryThis = functionUncurryThisClause;
8779
9008
  var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
8780
9009
  var toLength = toLength$5;
@@ -8795,7 +9024,7 @@ var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
8795
9024
 
8796
9025
  // `String.prototype.endsWith` method
8797
9026
  // https://tc39.es/ecma262/#sec-string.prototype.endswith
8798
- $$7({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
9027
+ $$6({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
8799
9028
  endsWith: function endsWith(searchString /* , endPosition = @length */) {
8800
9029
  var that = toString(requireObjectCoercible(this));
8801
9030
  notARegExp(searchString);
@@ -10237,87 +10466,6 @@ const createDefaultAjv = (...schemas) => {
10237
10466
  return ajv;
10238
10467
  };
10239
10468
 
10240
- var aCallable$4 = aCallable$9;
10241
- var toObject = toObject$8;
10242
- var IndexedObject = indexedObject;
10243
- var lengthOfArrayLike = lengthOfArrayLike$7;
10244
-
10245
- var $TypeError$4 = TypeError;
10246
-
10247
- var REDUCE_EMPTY = 'Reduce of empty array with no initial value';
10248
-
10249
- // `Array.prototype.{ reduce, reduceRight }` methods implementation
10250
- var createMethod = function (IS_RIGHT) {
10251
- return function (that, callbackfn, argumentsLength, memo) {
10252
- var O = toObject(that);
10253
- var self = IndexedObject(O);
10254
- var length = lengthOfArrayLike(O);
10255
- aCallable$4(callbackfn);
10256
- if (length === 0 && argumentsLength < 2) throw new $TypeError$4(REDUCE_EMPTY);
10257
- var index = IS_RIGHT ? length - 1 : 0;
10258
- var i = IS_RIGHT ? -1 : 1;
10259
- if (argumentsLength < 2) while (true) {
10260
- if (index in self) {
10261
- memo = self[index];
10262
- index += i;
10263
- break;
10264
- }
10265
- index += i;
10266
- if (IS_RIGHT ? index < 0 : length <= index) {
10267
- throw new $TypeError$4(REDUCE_EMPTY);
10268
- }
10269
- }
10270
- for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
10271
- memo = callbackfn(memo, self[index], index, O);
10272
- }
10273
- return memo;
10274
- };
10275
- };
10276
-
10277
- var arrayReduce = {
10278
- // `Array.prototype.reduce` method
10279
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
10280
- left: createMethod(false),
10281
- // `Array.prototype.reduceRight` method
10282
- // https://tc39.es/ecma262/#sec-array.prototype.reduceright
10283
- right: createMethod(true)
10284
- };
10285
-
10286
- var fails$1 = fails$s;
10287
-
10288
- var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
10289
- var method = [][METHOD_NAME];
10290
- return !!method && fails$1(function () {
10291
- // eslint-disable-next-line no-useless-call -- required for testing
10292
- method.call(null, argument || function () { return 1; }, 1);
10293
- });
10294
- };
10295
-
10296
- var global$7 = global$p;
10297
- var classof = classofRaw$2;
10298
-
10299
- var engineIsNode = classof(global$7.process) === 'process';
10300
-
10301
- var $$6 = _export;
10302
- var $reduce = arrayReduce.left;
10303
- var arrayMethodIsStrict = arrayMethodIsStrict$1;
10304
- var CHROME_VERSION = engineV8Version;
10305
- var IS_NODE$4 = engineIsNode;
10306
-
10307
- // Chrome 80-82 has a critical bug
10308
- // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
10309
- var CHROME_BUG = !IS_NODE$4 && CHROME_VERSION > 79 && CHROME_VERSION < 83;
10310
- var FORCED = CHROME_BUG || !arrayMethodIsStrict('reduce');
10311
-
10312
- // `Array.prototype.reduce` method
10313
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
10314
- $$6({ target: 'Array', proto: true, forced: FORCED }, {
10315
- reduce: function reduce(callbackfn /* , initialValue */) {
10316
- var length = arguments.length;
10317
- return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
10318
- }
10319
- });
10320
-
10321
10469
  var isPrototypeOf = objectIsPrototypeOf;
10322
10470
 
10323
10471
  var $TypeError$3 = TypeError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.1.6",
3
+ "version": "2.3.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",
@@ -0,0 +1,5 @@
1
+ import { CategoriesState } from './context';
2
+ export interface ApplicationStatusProps {
3
+ categories: CategoriesState;
4
+ }
5
+ export declare const ApplicationStatus: ({ categories }: ApplicationStatusProps) => JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { CategoryState } from './context';
2
+ export declare enum PageStatus {
3
+ Complete = "Completed",
4
+ Incomplete = "Incomplete",
5
+ NotStarted = "Not started"
6
+ }
7
+ export declare const getCategoryStatus: (category: CategoryState) => string;
8
+ export declare const getCategoryStatusBadge: (category: CategoryState) => JSX.Element;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { CategorizationStepperLayoutRendererProps } from './types';
3
+ export interface PageRenderingProps {
4
+ categoryProps: CategorizationStepperLayoutRendererProps;
5
+ renderBackButton: (index: number, activeId: number) => JSX.Element;
6
+ }
7
+ export declare const RenderPages: (props: PageRenderingProps) => JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { RankedTester } from '@jsonforms/core';
2
+ import { CategoriesState } from './context';
3
+ export interface TocProps {
4
+ categories: CategoriesState;
5
+ onClick: (id: number) => void;
6
+ title: string | undefined;
7
+ subtitle: string | undefined;
8
+ }
9
+ export declare const TableOfContents: (props: TocProps) => JSX.Element;
10
+ export declare const TableOfContentsTester: RankedTester;
@@ -16,3 +16,8 @@ export declare const TableReviewItemSection: import("styled-components/dist/type
16
16
  export declare const TableReviewItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
17
17
  export declare const TableReviewPageTitleRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
18
18
  export declare const TableReviewCategoryLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
19
+ export declare const CategoryStatus: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, never>> & string;
20
+ export declare const TocPageRef: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, never>> & string;
21
+ export declare const TocTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
22
+ export declare const TocSubtitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
23
+ export declare const CompletionStatus: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;