@abgov/jsonforms-components 1.10.1 → 1.11.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,13 +1,13 @@
1
1
  import { withAjvProps, materialSliderControlTester, MaterialSliderControl, materialObjectControlTester, MaterialObjectRenderer, materialAllOfControlTester, MaterialAllOfRenderer, materialAnyOfControlTester, MaterialAnyOfRenderer, materialOneOfControlTester, MaterialOneOfRenderer, materialOneOfRadioGroupControlTester, MaterialOneOfRadioGroupControl, materialOneOfEnumControlTester, MaterialOneOfEnumControl, materialHorizontalLayoutTester, materialVerticalLayoutTester, materialArrayLayoutTester, MaterialArrayLayout, materialAnyOfStringOrEnumControlTester, MaterialAnyOfStringOrEnumControl, materialEnumArrayRendererTester, MaterialEnumArrayRenderer, materialBooleanCellTester, MaterialBooleanCell, materialBooleanToggleCellTester, MaterialBooleanToggleCell, materialEnumCellTester, MaterialEnumCell, materialOneOfEnumCellTester, MaterialOneOfEnumCell } from '@jsonforms/material-renderers';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import React, { createContext, useContext, useEffect, useMemo, useState, useCallback } from 'react';
3
4
  import { GoACallout, GoAInputDate, GoAFormItem, GoAInput, GoATextArea, GoAInputDateTime, GoAInputTime, GoADropdown, GoADropdownItem, GoARadioGroup, GoARadioItem, GoACheckbox, GoAFormStepper, GoAFormStep, GoAPages, GoAGrid, GoAButton, GoAModal, GoAButtonGroup, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoADetails } from '@abgov/react-components';
4
5
  import styled from 'styled-components';
5
6
  import { rankWith, uiTypeIs, isDateControl, isStringControl, and, optionIs, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, isDescriptionHidden, isVisible, isEnabled, deriveLabelForUISchemaElement, schemaTypeIs, formatIs, createDefaultValue, Paths, or, isObjectArrayControl, isPrimitiveArrayControl, withIncreasedRank, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
6
- import { withJsonFormsRendererProps, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, withJsonFormsLayoutProps, JsonFormsDispatch, useJsonForms, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
7
- import React, { createContext, useEffect, useContext, useState, useMemo, useCallback } from 'react';
7
+ import { withJsonFormsRendererProps, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsLayoutProps, useJsonForms, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
8
8
  import merge from 'lodash/merge';
9
9
  import axios from 'axios';
10
- import isEmpty from 'lodash/isEmpty';
10
+ import isEmpty$1 from 'lodash/isEmpty';
11
11
  import range from 'lodash/range';
12
12
  import Ajv from 'ajv';
13
13
 
@@ -1556,122 +1556,8 @@ for (var COLLECTION_NAME in DOMIterables) {
1556
1556
 
1557
1557
  handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1558
1558
 
1559
- var wellKnownSymbol$5 = wellKnownSymbol$c;
1560
-
1561
- var TO_STRING_TAG$1 = wellKnownSymbol$5('toStringTag');
1562
- var test = {};
1563
-
1564
- test[TO_STRING_TAG$1] = 'z';
1565
-
1566
- var toStringTagSupport = String(test) === '[object z]';
1567
-
1568
- var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1569
- var isCallable$3 = isCallable$h;
1570
- var classofRaw = classofRaw$1;
1571
- var wellKnownSymbol$4 = wellKnownSymbol$c;
1572
-
1573
- var TO_STRING_TAG = wellKnownSymbol$4('toStringTag');
1574
- var $Object = Object;
1575
-
1576
- // ES3 wrong here
1577
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
1578
-
1579
- // fallback for IE11 Script Access Denied error
1580
- var tryGet = function (it, key) {
1581
- try {
1582
- return it[key];
1583
- } catch (error) { /* empty */ }
1584
- };
1585
-
1586
- // getting tag from ES6+ `Object.prototype.toString`
1587
- var classof$3 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1588
- var O, tag, result;
1589
- return it === undefined ? 'Undefined' : it === null ? 'Null'
1590
- // @@toStringTag case
1591
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1592
- // builtinTag case
1593
- : CORRECT_ARGUMENTS ? classofRaw(O)
1594
- // ES3 arguments fallback
1595
- : (result = classofRaw(O)) === 'Object' && isCallable$3(O.callee) ? 'Arguments' : result;
1596
- };
1597
-
1598
- var classof$2 = classof$3;
1599
-
1600
- var $String = String;
1601
-
1602
- var toString$5 = function (argument) {
1603
- if (classof$2(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
1604
- return $String(argument);
1605
- };
1606
-
1607
- var makeBuiltIn = makeBuiltIn$3.exports;
1608
- var defineProperty$1 = objectDefineProperty;
1609
-
1610
- var defineBuiltInAccessor$1 = function (target, name, descriptor) {
1611
- if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
1612
- if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
1613
- return defineProperty$1.f(target, name, descriptor);
1614
- };
1615
-
1616
- var $$4 = _export;
1617
1559
  var DESCRIPTORS$1 = descriptors;
1618
- var global$4 = global$f;
1619
1560
  var uncurryThis$6 = functionUncurryThis;
1620
- var hasOwn$1 = hasOwnProperty_1;
1621
- var isCallable$2 = isCallable$h;
1622
- var isPrototypeOf$1 = objectIsPrototypeOf;
1623
- var toString$4 = toString$5;
1624
- var defineBuiltInAccessor = defineBuiltInAccessor$1;
1625
- var copyConstructorProperties = copyConstructorProperties$2;
1626
-
1627
- var NativeSymbol = global$4.Symbol;
1628
- var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
1629
-
1630
- if (DESCRIPTORS$1 && isCallable$2(NativeSymbol) && (!('description' in SymbolPrototype) ||
1631
- // Safari 12 bug
1632
- NativeSymbol().description !== undefined
1633
- )) {
1634
- var EmptyStringDescriptionStore = {};
1635
- // wrap Symbol constructor for correct work with undefined description
1636
- var SymbolWrapper = function Symbol() {
1637
- var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$4(arguments[0]);
1638
- var result = isPrototypeOf$1(SymbolPrototype, this)
1639
- ? new NativeSymbol(description)
1640
- // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
1641
- : description === undefined ? NativeSymbol() : NativeSymbol(description);
1642
- if (description === '') EmptyStringDescriptionStore[result] = true;
1643
- return result;
1644
- };
1645
-
1646
- copyConstructorProperties(SymbolWrapper, NativeSymbol);
1647
- SymbolWrapper.prototype = SymbolPrototype;
1648
- SymbolPrototype.constructor = SymbolWrapper;
1649
-
1650
- var NATIVE_SYMBOL = String(NativeSymbol('description detection')) === 'Symbol(description detection)';
1651
- var thisSymbolValue = uncurryThis$6(SymbolPrototype.valueOf);
1652
- var symbolDescriptiveString = uncurryThis$6(SymbolPrototype.toString);
1653
- var regexp = /^Symbol\((.*)\)[^)]+$/;
1654
- var replace$2 = uncurryThis$6(''.replace);
1655
- var stringSlice$4 = uncurryThis$6(''.slice);
1656
-
1657
- defineBuiltInAccessor(SymbolPrototype, 'description', {
1658
- configurable: true,
1659
- get: function description() {
1660
- var symbol = thisSymbolValue(this);
1661
- if (hasOwn$1(EmptyStringDescriptionStore, symbol)) return '';
1662
- var string = symbolDescriptiveString(symbol);
1663
- var desc = NATIVE_SYMBOL ? stringSlice$4(string, 7, -1) : replace$2(string, regexp, '$1');
1664
- return desc === '' ? undefined : desc;
1665
- }
1666
- });
1667
-
1668
- $$4({ global: true, constructor: true, forced: true }, {
1669
- Symbol: SymbolWrapper
1670
- });
1671
- }
1672
-
1673
- var DESCRIPTORS = descriptors;
1674
- var uncurryThis$5 = functionUncurryThis;
1675
1561
  var call$6 = functionCall;
1676
1562
  var fails$7 = fails$i;
1677
1563
  var objectKeys = objectKeys$2;
@@ -1683,17 +1569,17 @@ var IndexedObject = indexedObject;
1683
1569
  // eslint-disable-next-line es/no-object-assign -- safe
1684
1570
  var $assign = Object.assign;
1685
1571
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1686
- var defineProperty = Object.defineProperty;
1687
- var concat$1 = uncurryThis$5([].concat);
1572
+ var defineProperty$1 = Object.defineProperty;
1573
+ var concat$1 = uncurryThis$6([].concat);
1688
1574
 
1689
1575
  // `Object.assign` method
1690
1576
  // https://tc39.es/ecma262/#sec-object.assign
1691
1577
  var objectAssign = !$assign || fails$7(function () {
1692
1578
  // should have correct order of operations (Edge bug)
1693
- if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
1579
+ if (DESCRIPTORS$1 && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
1694
1580
  enumerable: true,
1695
1581
  get: function () {
1696
- defineProperty(this, 'b', {
1582
+ defineProperty$1(this, 'b', {
1697
1583
  value: 3,
1698
1584
  enumerable: false
1699
1585
  });
@@ -1722,18 +1608,18 @@ var objectAssign = !$assign || fails$7(function () {
1722
1608
  var key;
1723
1609
  while (length > j) {
1724
1610
  key = keys[j++];
1725
- if (!DESCRIPTORS || call$6(propertyIsEnumerable, S, key)) T[key] = S[key];
1611
+ if (!DESCRIPTORS$1 || call$6(propertyIsEnumerable, S, key)) T[key] = S[key];
1726
1612
  }
1727
1613
  } return T;
1728
1614
  } : $assign;
1729
1615
 
1730
- var $$3 = _export;
1616
+ var $$4 = _export;
1731
1617
  var assign = objectAssign;
1732
1618
 
1733
1619
  // `Object.assign` method
1734
1620
  // https://tc39.es/ecma262/#sec-object.assign
1735
1621
  // eslint-disable-next-line es/no-object-assign -- required for testing
1736
- $$3({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1622
+ $$4({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1737
1623
  assign: assign
1738
1624
  });
1739
1625
 
@@ -1743,6 +1629,54 @@ const FormFieldWrapper = styled.div(_t$7 || (_t$7 = _$7`
1743
1629
  margin-bottom: var(--goa-space-l);
1744
1630
  `));
1745
1631
 
1632
+ var wellKnownSymbol$5 = wellKnownSymbol$c;
1633
+
1634
+ var TO_STRING_TAG$1 = wellKnownSymbol$5('toStringTag');
1635
+ var test = {};
1636
+
1637
+ test[TO_STRING_TAG$1] = 'z';
1638
+
1639
+ var toStringTagSupport = String(test) === '[object z]';
1640
+
1641
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1642
+ var isCallable$3 = isCallable$h;
1643
+ var classofRaw = classofRaw$1;
1644
+ var wellKnownSymbol$4 = wellKnownSymbol$c;
1645
+
1646
+ var TO_STRING_TAG = wellKnownSymbol$4('toStringTag');
1647
+ var $Object = Object;
1648
+
1649
+ // ES3 wrong here
1650
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
1651
+
1652
+ // fallback for IE11 Script Access Denied error
1653
+ var tryGet = function (it, key) {
1654
+ try {
1655
+ return it[key];
1656
+ } catch (error) { /* empty */ }
1657
+ };
1658
+
1659
+ // getting tag from ES6+ `Object.prototype.toString`
1660
+ var classof$3 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1661
+ var O, tag, result;
1662
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
1663
+ // @@toStringTag case
1664
+ : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1665
+ // builtinTag case
1666
+ : CORRECT_ARGUMENTS ? classofRaw(O)
1667
+ // ES3 arguments fallback
1668
+ : (result = classofRaw(O)) === 'Object' && isCallable$3(O.callee) ? 'Arguments' : result;
1669
+ };
1670
+
1671
+ var classof$2 = classof$3;
1672
+
1673
+ var $String = String;
1674
+
1675
+ var toString$5 = function (argument) {
1676
+ if (classof$2(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
1677
+ return $String(argument);
1678
+ };
1679
+
1746
1680
  var anObject$3 = anObject$9;
1747
1681
 
1748
1682
  // `RegExp.prototype.flags` getter implementation
@@ -1762,10 +1696,10 @@ var regexpFlags$1 = function () {
1762
1696
  };
1763
1697
 
1764
1698
  var fails$6 = fails$i;
1765
- var global$3 = global$f;
1699
+ var global$4 = global$f;
1766
1700
 
1767
1701
  // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
1768
- var $RegExp$2 = global$3.RegExp;
1702
+ var $RegExp$2 = global$4.RegExp;
1769
1703
 
1770
1704
  var UNSUPPORTED_Y$1 = fails$6(function () {
1771
1705
  var re = $RegExp$2('a', 'y');
@@ -1793,10 +1727,10 @@ var regexpStickyHelpers = {
1793
1727
  };
1794
1728
 
1795
1729
  var fails$5 = fails$i;
1796
- var global$2 = global$f;
1730
+ var global$3 = global$f;
1797
1731
 
1798
1732
  // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
1799
- var $RegExp$1 = global$2.RegExp;
1733
+ var $RegExp$1 = global$3.RegExp;
1800
1734
 
1801
1735
  var regexpUnsupportedDotAll = fails$5(function () {
1802
1736
  var re = $RegExp$1('.', 's');
@@ -1804,10 +1738,10 @@ var regexpUnsupportedDotAll = fails$5(function () {
1804
1738
  });
1805
1739
 
1806
1740
  var fails$4 = fails$i;
1807
- var global$1 = global$f;
1741
+ var global$2 = global$f;
1808
1742
 
1809
1743
  // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
1810
- var $RegExp = global$1.RegExp;
1744
+ var $RegExp = global$2.RegExp;
1811
1745
 
1812
1746
  var regexpUnsupportedNcg = fails$4(function () {
1813
1747
  var re = $RegExp('(?<a>b)', 'g');
@@ -1818,8 +1752,8 @@ var regexpUnsupportedNcg = fails$4(function () {
1818
1752
  /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
1819
1753
  /* eslint-disable regexp/no-useless-quantifier -- testing */
1820
1754
  var call$5 = functionCall;
1821
- var uncurryThis$4 = functionUncurryThis;
1822
- var toString$3 = toString$5;
1755
+ var uncurryThis$5 = functionUncurryThis;
1756
+ var toString$4 = toString$5;
1823
1757
  var regexpFlags = regexpFlags$1;
1824
1758
  var stickyHelpers = regexpStickyHelpers;
1825
1759
  var shared = shared$4;
@@ -1831,10 +1765,10 @@ var UNSUPPORTED_NCG = regexpUnsupportedNcg;
1831
1765
  var nativeReplace = shared('native-string-replace', String.prototype.replace);
1832
1766
  var nativeExec = RegExp.prototype.exec;
1833
1767
  var patchedExec = nativeExec;
1834
- var charAt$3 = uncurryThis$4(''.charAt);
1835
- var indexOf = uncurryThis$4(''.indexOf);
1836
- var replace$1 = uncurryThis$4(''.replace);
1837
- var stringSlice$3 = uncurryThis$4(''.slice);
1768
+ var charAt$3 = uncurryThis$5(''.charAt);
1769
+ var indexOf = uncurryThis$5(''.indexOf);
1770
+ var replace$2 = uncurryThis$5(''.replace);
1771
+ var stringSlice$4 = uncurryThis$5(''.slice);
1838
1772
 
1839
1773
  var UPDATES_LAST_INDEX_WRONG = (function () {
1840
1774
  var re1 = /a/;
@@ -1855,7 +1789,7 @@ if (PATCH) {
1855
1789
  patchedExec = function exec(string) {
1856
1790
  var re = this;
1857
1791
  var state = getInternalState(re);
1858
- var str = toString$3(string);
1792
+ var str = toString$4(string);
1859
1793
  var raw = state.raw;
1860
1794
  var result, reCopy, lastIndex, match, i, object, group;
1861
1795
 
@@ -1874,12 +1808,12 @@ if (PATCH) {
1874
1808
  var strCopy = str;
1875
1809
 
1876
1810
  if (sticky) {
1877
- flags = replace$1(flags, 'y', '');
1811
+ flags = replace$2(flags, 'y', '');
1878
1812
  if (indexOf(flags, 'g') === -1) {
1879
1813
  flags += 'g';
1880
1814
  }
1881
1815
 
1882
- strCopy = stringSlice$3(str, re.lastIndex);
1816
+ strCopy = stringSlice$4(str, re.lastIndex);
1883
1817
  // Support anchored sticky behavior.
1884
1818
  if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$3(str, re.lastIndex - 1) !== '\n')) {
1885
1819
  source = '(?: ' + source + ')';
@@ -1900,8 +1834,8 @@ if (PATCH) {
1900
1834
 
1901
1835
  if (sticky) {
1902
1836
  if (match) {
1903
- match.input = stringSlice$3(match.input, charsAdded);
1904
- match[0] = stringSlice$3(match[0], charsAdded);
1837
+ match.input = stringSlice$4(match.input, charsAdded);
1838
+ match[0] = stringSlice$4(match[0], charsAdded);
1905
1839
  match.index = re.lastIndex;
1906
1840
  re.lastIndex += match[0].length;
1907
1841
  } else re.lastIndex = 0;
@@ -1932,12 +1866,12 @@ if (PATCH) {
1932
1866
 
1933
1867
  var regexpExec$2 = patchedExec;
1934
1868
 
1935
- var $$2 = _export;
1869
+ var $$3 = _export;
1936
1870
  var exec = regexpExec$2;
1937
1871
 
1938
1872
  // `RegExp.prototype.exec` method
1939
1873
  // https://tc39.es/ecma262/#sec-regexp.prototype.exec
1940
- $$2({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
1874
+ $$3({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
1941
1875
  exec: exec
1942
1876
  });
1943
1877
 
@@ -2028,18 +1962,18 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
2028
1962
  if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
2029
1963
  };
2030
1964
 
2031
- var uncurryThis$3 = functionUncurryThis;
1965
+ var uncurryThis$4 = functionUncurryThis;
2032
1966
  var toIntegerOrInfinity$1 = toIntegerOrInfinity$4;
2033
- var toString$2 = toString$5;
1967
+ var toString$3 = toString$5;
2034
1968
  var requireObjectCoercible$2 = requireObjectCoercible$5;
2035
1969
 
2036
- var charAt$2 = uncurryThis$3(''.charAt);
2037
- var charCodeAt = uncurryThis$3(''.charCodeAt);
2038
- var stringSlice$2 = uncurryThis$3(''.slice);
1970
+ var charAt$2 = uncurryThis$4(''.charAt);
1971
+ var charCodeAt = uncurryThis$4(''.charCodeAt);
1972
+ var stringSlice$3 = uncurryThis$4(''.slice);
2039
1973
 
2040
1974
  var createMethod = function (CONVERT_TO_STRING) {
2041
1975
  return function ($this, pos) {
2042
- var S = toString$2(requireObjectCoercible$2($this));
1976
+ var S = toString$3(requireObjectCoercible$2($this));
2043
1977
  var position = toIntegerOrInfinity$1(pos);
2044
1978
  var size = S.length;
2045
1979
  var first, second;
@@ -2051,7 +1985,7 @@ var createMethod = function (CONVERT_TO_STRING) {
2051
1985
  ? charAt$2(S, position)
2052
1986
  : first
2053
1987
  : CONVERT_TO_STRING
2054
- ? stringSlice$2(S, position, position + 2)
1988
+ ? stringSlice$3(S, position, position + 2)
2055
1989
  : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
2056
1990
  };
2057
1991
  };
@@ -2073,13 +2007,13 @@ var advanceStringIndex$1 = function (S, index, unicode) {
2073
2007
  return index + (unicode ? charAt$1(S, index).length : 1);
2074
2008
  };
2075
2009
 
2076
- var uncurryThis$2 = functionUncurryThis;
2010
+ var uncurryThis$3 = functionUncurryThis;
2077
2011
  var toObject = toObject$4;
2078
2012
 
2079
2013
  var floor = Math.floor;
2080
- var charAt = uncurryThis$2(''.charAt);
2081
- var replace = uncurryThis$2(''.replace);
2082
- var stringSlice$1 = uncurryThis$2(''.slice);
2014
+ var charAt = uncurryThis$3(''.charAt);
2015
+ var replace$1 = uncurryThis$3(''.replace);
2016
+ var stringSlice$2 = uncurryThis$3(''.slice);
2083
2017
  // eslint-disable-next-line redos/no-vulnerable -- safe
2084
2018
  var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
2085
2019
  var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
@@ -2094,15 +2028,15 @@ var getSubstitution$1 = function (matched, str, position, captures, namedCapture
2094
2028
  namedCaptures = toObject(namedCaptures);
2095
2029
  symbols = SUBSTITUTION_SYMBOLS;
2096
2030
  }
2097
- return replace(replacement, symbols, function (match, ch) {
2031
+ return replace$1(replacement, symbols, function (match, ch) {
2098
2032
  var capture;
2099
2033
  switch (charAt(ch, 0)) {
2100
2034
  case '$': return '$';
2101
2035
  case '&': return matched;
2102
- case '`': return stringSlice$1(str, 0, position);
2103
- case "'": return stringSlice$1(str, tailPos);
2036
+ case '`': return stringSlice$2(str, 0, position);
2037
+ case "'": return stringSlice$2(str, tailPos);
2104
2038
  case '<':
2105
- capture = namedCaptures[stringSlice$1(ch, 1, -1)];
2039
+ capture = namedCaptures[stringSlice$2(ch, 1, -1)];
2106
2040
  break;
2107
2041
  default: // \d\d?
2108
2042
  var n = +ch;
@@ -2121,7 +2055,7 @@ var getSubstitution$1 = function (matched, str, position, captures, namedCapture
2121
2055
 
2122
2056
  var call$2 = functionCall;
2123
2057
  var anObject$2 = anObject$9;
2124
- var isCallable$1 = isCallable$h;
2058
+ var isCallable$2 = isCallable$h;
2125
2059
  var classof$1 = classofRaw$1;
2126
2060
  var regexpExec = regexpExec$2;
2127
2061
 
@@ -2131,7 +2065,7 @@ var $TypeError$1 = TypeError;
2131
2065
  // https://tc39.es/ecma262/#sec-regexpexec
2132
2066
  var regexpExecAbstract = function (R, S) {
2133
2067
  var exec = R.exec;
2134
- if (isCallable$1(exec)) {
2068
+ if (isCallable$2(exec)) {
2135
2069
  var result = call$2(exec, R, S);
2136
2070
  if (result !== null) anObject$2(result);
2137
2071
  return result;
@@ -2142,15 +2076,15 @@ var regexpExecAbstract = function (R, S) {
2142
2076
 
2143
2077
  var apply = functionApply;
2144
2078
  var call$1 = functionCall;
2145
- var uncurryThis$1 = functionUncurryThis;
2079
+ var uncurryThis$2 = functionUncurryThis;
2146
2080
  var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
2147
2081
  var fails$2 = fails$i;
2148
2082
  var anObject$1 = anObject$9;
2149
- var isCallable = isCallable$h;
2083
+ var isCallable$1 = isCallable$h;
2150
2084
  var isNullOrUndefined = isNullOrUndefined$3;
2151
2085
  var toIntegerOrInfinity = toIntegerOrInfinity$4;
2152
2086
  var toLength = toLength$2;
2153
- var toString$1 = toString$5;
2087
+ var toString$2 = toString$5;
2154
2088
  var requireObjectCoercible$1 = requireObjectCoercible$5;
2155
2089
  var advanceStringIndex = advanceStringIndex$1;
2156
2090
  var getMethod = getMethod$2;
@@ -2161,10 +2095,10 @@ var wellKnownSymbol$2 = wellKnownSymbol$c;
2161
2095
  var REPLACE = wellKnownSymbol$2('replace');
2162
2096
  var max = Math.max;
2163
2097
  var min = Math.min;
2164
- var concat = uncurryThis$1([].concat);
2165
- var push = uncurryThis$1([].push);
2166
- var stringIndexOf$1 = uncurryThis$1(''.indexOf);
2167
- var stringSlice = uncurryThis$1(''.slice);
2098
+ var concat = uncurryThis$2([].concat);
2099
+ var push = uncurryThis$2([].push);
2100
+ var stringIndexOf$1 = uncurryThis$2(''.indexOf);
2101
+ var stringSlice$1 = uncurryThis$2(''.slice);
2168
2102
 
2169
2103
  var maybeToString = function (it) {
2170
2104
  return it === undefined ? it : String(it);
@@ -2208,13 +2142,13 @@ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa
2208
2142
  var replacer = isNullOrUndefined(searchValue) ? undefined : getMethod(searchValue, REPLACE);
2209
2143
  return replacer
2210
2144
  ? call$1(replacer, searchValue, O, replaceValue)
2211
- : call$1(nativeReplace, toString$1(O), searchValue, replaceValue);
2145
+ : call$1(nativeReplace, toString$2(O), searchValue, replaceValue);
2212
2146
  },
2213
2147
  // `RegExp.prototype[@@replace]` method
2214
2148
  // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
2215
2149
  function (string, replaceValue) {
2216
2150
  var rx = anObject$1(this);
2217
- var S = toString$1(string);
2151
+ var S = toString$2(string);
2218
2152
 
2219
2153
  if (
2220
2154
  typeof replaceValue == 'string' &&
@@ -2225,8 +2159,8 @@ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa
2225
2159
  if (res.done) return res.value;
2226
2160
  }
2227
2161
 
2228
- var functionalReplace = isCallable(replaceValue);
2229
- if (!functionalReplace) replaceValue = toString$1(replaceValue);
2162
+ var functionalReplace = isCallable$1(replaceValue);
2163
+ if (!functionalReplace) replaceValue = toString$2(replaceValue);
2230
2164
 
2231
2165
  var global = rx.global;
2232
2166
  var fullUnicode;
@@ -2244,7 +2178,7 @@ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa
2244
2178
  push(results, result);
2245
2179
  if (!global) break;
2246
2180
 
2247
- var matchStr = toString$1(result[0]);
2181
+ var matchStr = toString$2(result[0]);
2248
2182
  if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
2249
2183
  }
2250
2184
 
@@ -2253,7 +2187,7 @@ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa
2253
2187
  for (var i = 0; i < results.length; i++) {
2254
2188
  result = results[i];
2255
2189
 
2256
- var matched = toString$1(result[0]);
2190
+ var matched = toString$2(result[0]);
2257
2191
  var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
2258
2192
  var captures = [];
2259
2193
  var replacement;
@@ -2267,17 +2201,17 @@ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa
2267
2201
  if (functionalReplace) {
2268
2202
  var replacerArgs = concat([matched], captures, position, S);
2269
2203
  if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
2270
- replacement = toString$1(apply(replaceValue, undefined, replacerArgs));
2204
+ replacement = toString$2(apply(replaceValue, undefined, replacerArgs));
2271
2205
  } else {
2272
2206
  replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
2273
2207
  }
2274
2208
  if (position >= nextSourcePosition) {
2275
- accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;
2209
+ accumulatedResult += stringSlice$1(S, nextSourcePosition, position) + replacement;
2276
2210
  nextSourcePosition = position + matched.length;
2277
2211
  }
2278
2212
  }
2279
2213
 
2280
- return accumulatedResult + stringSlice(S, nextSourcePosition);
2214
+ return accumulatedResult + stringSlice$1(S, nextSourcePosition);
2281
2215
  }
2282
2216
  ];
2283
2217
  }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
@@ -2302,10 +2236,7 @@ const controlScopeMatchesLabel = (scope, label) => {
2302
2236
  // Get the property name in the string from the scope
2303
2237
  const splitIdName = (_c = (_b = (_a = scope.replace(' ', '').split('/')) === null || _a === void 0 ? void 0 : _a.at(-1)) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : '';
2304
2238
  const labelWithNoSpaces = label.replace(' ', '').toLowerCase();
2305
- if (splitIdName === labelWithNoSpaces) {
2306
- return true;
2307
- }
2308
- return false;
2239
+ return splitIdName === labelWithNoSpaces;
2309
2240
  };
2310
2241
  /**
2311
2242
  * Gets the label text in sentence case
@@ -2370,6 +2301,43 @@ const isValidDate = function isValidDate(date) {
2370
2301
  }
2371
2302
  };
2372
2303
 
2304
+ const StepperContext = /*#__PURE__*/createContext({
2305
+ updateStatus: status => {},
2306
+ // return true because in the default case we don't want the
2307
+ // input controls to take action if it is false.
2308
+ isInitialized: _ => true,
2309
+ stepId: 0
2310
+ });
2311
+ const isEmpty = value => {
2312
+ return value === undefined || value === null || typeof value === 'string' && value.length < 1;
2313
+ };
2314
+ const getCompletionStatus = (table, step) => {
2315
+ const nonEmptyCount = getNonEmptyCount(table, step);
2316
+ if (nonEmptyCount === 0) {
2317
+ return undefined;
2318
+ }
2319
+ const requiredCount = getRequiredCount(table, step);
2320
+ const requiredNonEmptyCount = getNonEmptyRequiredCount(table, step);
2321
+ if (requiredNonEmptyCount === requiredCount) {
2322
+ return 'complete';
2323
+ }
2324
+ return 'incomplete';
2325
+ };
2326
+ const getNonEmptyCount = (table, step) => {
2327
+ const nonEmptyStatuses = Object.keys(table).filter(k => table[k].step === step && !isEmpty(table[k].value));
2328
+ return nonEmptyStatuses.length;
2329
+ };
2330
+ const getRequiredCount = (table, step) => {
2331
+ const requiredStatuses = Object.keys(table).filter(k => {
2332
+ return table[k].step === step && table[k].required;
2333
+ });
2334
+ return requiredStatuses.length;
2335
+ };
2336
+ const getNonEmptyRequiredCount = (table, step) => {
2337
+ const requiredNonEmptyStatuses = Object.keys(table).filter(k => table[k].step === step && table[k].required && !isEmpty(table[k].value));
2338
+ return requiredNonEmptyStatuses.length;
2339
+ };
2340
+
2373
2341
  // Used locally for callout presentation
2374
2342
  const callout = props => {
2375
2343
  const componentProps = Object.assign({
@@ -2748,25 +2716,43 @@ const Visible = styled.div(_t2$4 || (_t2$4 = _$6`
2748
2716
 
2749
2717
  const GoAInputBaseControl = props => {
2750
2718
  var _a, _b, _c;
2751
- // eslint-disable-next-line
2752
2719
  const {
2753
- id,
2754
- description,
2755
- errors,
2756
2720
  uischema,
2757
2721
  visible,
2758
- config,
2759
2722
  label,
2760
2723
  input,
2761
2724
  required
2762
2725
  } = props;
2763
- errors.length === 0;
2764
2726
  const InnerComponent = input;
2765
2727
  const labelToUpdate = getLabelText(uischema.scope, label || '');
2766
2728
  let modifiedErrors = checkFieldValidity(props);
2767
2729
  if (modifiedErrors === 'should be equal to one of the allowed values' && ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.enumContext)) {
2768
2730
  modifiedErrors = '';
2769
2731
  }
2732
+ const getStepStatus = (props, value) => {
2733
+ return {
2734
+ id: props.id,
2735
+ value: value,
2736
+ required: props.required || false,
2737
+ type: props.schema.type,
2738
+ step: stepperContext.stepId
2739
+ };
2740
+ };
2741
+ const stepperContext = useContext(StepperContext);
2742
+ const handlerWithStepperUpdate = (path, value) => {
2743
+ stepperContext.updateStatus(getStepStatus(props, value));
2744
+ props.handleChange(path, value);
2745
+ };
2746
+ const modifiedProps = Object.assign(Object.assign({}, props), {
2747
+ handleChange: handlerWithStepperUpdate
2748
+ });
2749
+ useEffect(() => {
2750
+ if (!stepperContext.isInitialized(props.id)) {
2751
+ const status = getStepStatus(props, props.data);
2752
+ stepperContext.updateStatus(status);
2753
+ }
2754
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2755
+ }, []);
2770
2756
  return jsx(Visible, {
2771
2757
  visible: visible,
2772
2758
  children: jsx(FormFieldWrapper, {
@@ -2775,12 +2761,78 @@ const GoAInputBaseControl = props => {
2775
2761
  error: modifiedErrors,
2776
2762
  label: (props === null || props === void 0 ? void 0 : props.noLabel) === true ? '' : labelToUpdate,
2777
2763
  helpText: typeof ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help) === 'string' ? (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help : '',
2778
- children: jsx(InnerComponent, Object.assign({}, props))
2764
+ children: jsx(InnerComponent, Object.assign({}, modifiedProps))
2779
2765
  })
2780
2766
  })
2781
2767
  });
2782
2768
  };
2783
2769
 
2770
+ var makeBuiltIn = makeBuiltIn$3.exports;
2771
+ var defineProperty = objectDefineProperty;
2772
+
2773
+ var defineBuiltInAccessor$1 = function (target, name, descriptor) {
2774
+ if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
2775
+ if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
2776
+ return defineProperty.f(target, name, descriptor);
2777
+ };
2778
+
2779
+ var $$2 = _export;
2780
+ var DESCRIPTORS = descriptors;
2781
+ var global$1 = global$f;
2782
+ var uncurryThis$1 = functionUncurryThis;
2783
+ var hasOwn$1 = hasOwnProperty_1;
2784
+ var isCallable = isCallable$h;
2785
+ var isPrototypeOf$1 = objectIsPrototypeOf;
2786
+ var toString$1 = toString$5;
2787
+ var defineBuiltInAccessor = defineBuiltInAccessor$1;
2788
+ var copyConstructorProperties = copyConstructorProperties$2;
2789
+
2790
+ var NativeSymbol = global$1.Symbol;
2791
+ var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
2792
+
2793
+ if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) ||
2794
+ // Safari 12 bug
2795
+ NativeSymbol().description !== undefined
2796
+ )) {
2797
+ var EmptyStringDescriptionStore = {};
2798
+ // wrap Symbol constructor for correct work with undefined description
2799
+ var SymbolWrapper = function Symbol() {
2800
+ var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$1(arguments[0]);
2801
+ var result = isPrototypeOf$1(SymbolPrototype, this)
2802
+ ? new NativeSymbol(description)
2803
+ // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
2804
+ : description === undefined ? NativeSymbol() : NativeSymbol(description);
2805
+ if (description === '') EmptyStringDescriptionStore[result] = true;
2806
+ return result;
2807
+ };
2808
+
2809
+ copyConstructorProperties(SymbolWrapper, NativeSymbol);
2810
+ SymbolWrapper.prototype = SymbolPrototype;
2811
+ SymbolPrototype.constructor = SymbolWrapper;
2812
+
2813
+ var NATIVE_SYMBOL = String(NativeSymbol('description detection')) === 'Symbol(description detection)';
2814
+ var thisSymbolValue = uncurryThis$1(SymbolPrototype.valueOf);
2815
+ var symbolDescriptiveString = uncurryThis$1(SymbolPrototype.toString);
2816
+ var regexp = /^Symbol\((.*)\)[^)]+$/;
2817
+ var replace = uncurryThis$1(''.replace);
2818
+ var stringSlice = uncurryThis$1(''.slice);
2819
+
2820
+ defineBuiltInAccessor(SymbolPrototype, 'description', {
2821
+ configurable: true,
2822
+ get: function description() {
2823
+ var symbol = thisSymbolValue(this);
2824
+ if (hasOwn$1(EmptyStringDescriptionStore, symbol)) return '';
2825
+ var string = symbolDescriptiveString(symbol);
2826
+ var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
2827
+ return desc === '' ? undefined : desc;
2828
+ }
2829
+ });
2830
+
2831
+ $$2({ global: true, constructor: true, forced: true }, {
2832
+ Symbol: SymbolWrapper
2833
+ });
2834
+ }
2835
+
2784
2836
  const GoAInputText = props => {
2785
2837
  var _a, _b, _c, _d, _e, _f, _g;
2786
2838
  const {
@@ -2789,10 +2841,6 @@ const GoAInputText = props => {
2789
2841
  id,
2790
2842
  enabled,
2791
2843
  uischema,
2792
- isValid,
2793
- errors,
2794
- path,
2795
- handleChange,
2796
2844
  schema,
2797
2845
  label
2798
2846
  } = props;
@@ -2812,9 +2860,9 @@ const GoAInputText = props => {
2812
2860
  // maxLength={appliedUiSchemaOptions?.maxLength}
2813
2861
  name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
2814
2862
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2815
- // Dont use handleChange in the onChange event, use the keyPress or onBlur.
2863
+ // Don't use handleChange in the onChange event, use the keyPress or onBlur.
2816
2864
  // If you use it onChange along with keyPress event it will cause a
2817
- // side effect that causes the validation to render when it shouldnt.
2865
+ // side effect that causes the validation to render when it shouldn't.
2818
2866
  onChange: (name, value) => {},
2819
2867
  onKeyPress: (name, value, key) => {
2820
2868
  onKeyPressForTextControl({
@@ -3328,6 +3376,8 @@ function ContextProvider(props) {
3328
3376
  * Grabs data stored under a given key
3329
3377
  *
3330
3378
  */
3379
+ // FIXME give some clue as to what data is being fetched.
3380
+ // e.g.is it getFormContextData?
3331
3381
  function getData(key) {
3332
3382
  const dataFunction = baseEnumerator.data.get(key);
3333
3383
  return dataFunction && dataFunction();
@@ -3634,38 +3684,6 @@ const BooleanRadioControl = props => jsx(GoAInputBaseControl, Object.assign({},
3634
3684
  const GoABooleanRadioControlTester = rankWith(3, and(isBooleanControl, optionIs('radio', true)));
3635
3685
  const GoABooleanRadioControl = withJsonFormsControlProps(BooleanRadioControl);
3636
3686
 
3637
- /******************************************************************************
3638
- Copyright (c) Microsoft Corporation.
3639
-
3640
- Permission to use, copy, modify, and/or distribute this software for any
3641
- purpose with or without fee is hereby granted.
3642
-
3643
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3644
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3645
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3646
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3647
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3648
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3649
- PERFORMANCE OF THIS SOFTWARE.
3650
- ***************************************************************************** */
3651
-
3652
- function __rest(s, e) {
3653
- var t = {};
3654
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
3655
- t[p] = s[p];
3656
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
3657
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3658
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
3659
- t[p[i]] = s[p[i]];
3660
- }
3661
- return t;
3662
- }
3663
-
3664
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
3665
- var e = new Error(message);
3666
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3667
- };
3668
-
3669
3687
  let _$5 = t => t,
3670
3688
  _t$5,
3671
3689
  _t2$3;
@@ -3909,36 +3927,57 @@ requiredFields) => elements.map((element, index) => {
3909
3927
  return null;
3910
3928
  });
3911
3929
 
3912
- const FormStepper = _a => {
3913
- var _b, _c, _d;
3914
- var {
3915
- uischema,
3916
- data,
3917
- schema,
3918
- // eslint-disable-next-line
3919
- ajv,
3920
- path,
3921
- cells,
3922
- renderers,
3923
- config,
3924
- visible,
3925
- enabled,
3926
- t
3927
- } = _a;
3928
- __rest(_a, ["uischema", "data", "schema", "ajv", "path", "cells", "renderers", "config", "visible", "enabled", "t"]);
3930
+ const RenderStepElements = props => {
3931
+ return (
3932
+ /*
3933
+ [Mar-04-2024][Paul Li] the GoAPages internal state cannot handle the hidden/display well. We need extra hide/display control to it appropriately.
3934
+ */
3935
+ jsx(Visible, {
3936
+ visible: props.categoryIndex === props.step - 1,
3937
+ children: props.category.elements.map((uiSchema, index) => {
3938
+ return jsx(JsonFormsDispatch, {
3939
+ schema: props.schema,
3940
+ uischema: uiSchema,
3941
+ renderers: props.renderers,
3942
+ cells: props.cells,
3943
+ path: props.path,
3944
+ visible: props.visible,
3945
+ enabled: props.enabled && !props.disabledCategoryMap[props.categoryIndex]
3946
+ }, index);
3947
+ })
3948
+ })
3949
+ );
3950
+ };
3951
+
3952
+ const FormStepper = props => {
3953
+ var _a, _b, _c, _d;
3954
+ const {
3955
+ uischema,
3956
+ data,
3957
+ schema,
3958
+ ajv,
3959
+ path,
3960
+ cells,
3961
+ renderers,
3962
+ visible,
3963
+ enabled,
3964
+ t
3965
+ } = props;
3929
3966
  const enumerators = useContext(JsonFormContext);
3930
3967
  const submitFormFunction = enumerators.submitFunction.get('submit-form');
3931
3968
  const submitForm = submitFormFunction && submitFormFunction();
3932
3969
  const categorization = uischema;
3933
3970
  const rawCategories = JSON.parse(JSON.stringify(categorization));
3934
- const [step, setStep] = useState(1);
3935
- const [isFormValid, setIsFormValid] = useState(false);
3936
- const [showNextBtn, setShowNextBtn] = useState(true);
3937
- const [isOpen, setIsOpen] = useState(false);
3938
- const [categories, setCategories] = useState(categorization.elements);
3971
+ const [step, setStep] = React.useState(0);
3972
+ const [isFormValid, setIsFormValid] = React.useState(false);
3973
+ const [showNextBtn, setShowNextBtn] = React.useState(true);
3974
+ const [isOpen, setIsOpen] = React.useState(false);
3975
+ const [categories, setCategories] = React.useState(categorization.elements);
3976
+ const [inputStatuses, setInputStatuses] = React.useState({});
3977
+ const [stepStatuses, setStepStatuses] = React.useState([]);
3939
3978
  useEffect(() => {
3940
- const cates = categorization.elements.filter(category => isVisible(category, data, '', ajv));
3941
- setCategories(cates);
3979
+ const cats = categorization.elements.filter(category => isVisible(category, data, '', ajv));
3980
+ setCategories(cats);
3942
3981
  }, [categorization, data, ajv]);
3943
3982
  const disabledCategoryMap = categories.map(c => !isEnabled(c, data, '', ajv));
3944
3983
  const handleSubmit = () => {
@@ -3950,14 +3989,19 @@ const FormStepper = _a => {
3950
3989
  };
3951
3990
  const onSubmit = () => {
3952
3991
  setIsOpen(false);
3953
- console.log('submitted', data);
3954
3992
  };
3955
3993
  const CategoryLabels = useMemo(() => {
3956
- return categories.map(e => deriveLabelForUISchemaElement(e, t));
3994
+ return categories.map(c => deriveLabelForUISchemaElement(c, t));
3957
3995
  }, [categories, t]);
3958
3996
  useEffect(() => {}, [categories.length]);
3959
- // eslint-disable-next-line react-hooks/exhaustive-deps
3960
- const validateFormData = formData => {
3997
+ useEffect(() => {
3998
+ const statuses = Array(categories.length);
3999
+ categories.forEach((_, i) => {
4000
+ statuses[i] = getCompletionStatus(inputStatuses, i + 1);
4001
+ });
4002
+ setStepStatuses(statuses);
4003
+ }, [inputStatuses, categories]);
4004
+ useEffect(() => {
3961
4005
  const newSchema = JSON.parse(JSON.stringify(schema));
3962
4006
  Object.keys(newSchema.properties || {}).forEach(propertyName => {
3963
4007
  var _a;
@@ -3968,12 +4012,15 @@ const FormStepper = _a => {
3968
4012
  }
3969
4013
  });
3970
4014
  const validate = ajv.compile(newSchema);
3971
- return validate(formData);
3972
- };
4015
+ setIsFormValid(validate(data));
4016
+ }, [ajv, data, schema]);
3973
4017
  useEffect(() => {
3974
- const valid = validateFormData(data);
3975
- setIsFormValid(valid);
3976
- }, [data, validateFormData]);
4018
+ var _a, _b;
4019
+ // Override the "controlled Navigation", if property is supplied
4020
+ // Default: no controlled nav.
4021
+ setStep(((_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.controlledNav) ? 1 : 0);
4022
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4023
+ }, []);
3977
4024
  if ((categories === null || categories === void 0 ? void 0 : categories.length) < 1) {
3978
4025
  // eslint-disable-next-line
3979
4026
  return jsx(Fragment, {});
@@ -3992,67 +4039,43 @@ const FormStepper = _a => {
3992
4039
  }
3993
4040
  setPage(page);
3994
4041
  }
3995
- function setTab(page) {
4042
+ const getNextStep = step => {
3996
4043
  const rawCategoryLabels = rawCategories.elements.map(category => category.label);
3997
4044
  if (rawCategoryLabels.length !== CategoryLabels.length) {
3998
- if (page > 1 && page <= rawCategoryLabels.length) {
3999
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4000
- const selectedTabLabel = rawCategoryLabels[page - 1];
4045
+ if (step > 1 && step <= rawCategoryLabels.length) {
4046
+ const selectedTabLabel = rawCategoryLabels[step - 1];
4001
4047
  const selectedTab = CategoryLabels.indexOf(selectedTabLabel);
4002
- const newStep = selectedTab !== -1 ? selectedTab + 1 : page;
4003
- page = newStep;
4048
+ const newStep = selectedTab !== -1 ? selectedTab + 1 : step;
4049
+ return newStep;
4004
4050
  }
4005
- if (page > rawCategoryLabels.length) {
4006
- page = page - 1;
4051
+ if (step > rawCategoryLabels.length) {
4052
+ return step - 1;
4007
4053
  }
4008
4054
  }
4055
+ return step;
4056
+ };
4057
+ function setTab(page) {
4058
+ page = getNextStep(page);
4009
4059
  setStep(page);
4010
4060
  if (page < 1 || page > categories.length + 1) return;
4011
- if (categories.length + 1 === page) {
4012
- setShowNextBtn(false);
4013
- } else {
4014
- setShowNextBtn(true);
4015
- }
4061
+ setShowNextBtn(categories.length + 1 !== page);
4016
4062
  }
4017
4063
  function setPage(page) {
4018
4064
  setStep(page);
4019
4065
  if (page < 1 || page > categories.length + 1) return;
4020
- if (categories.length + 1 === page) {
4021
- setShowNextBtn(false);
4022
- } else {
4023
- setShowNextBtn(true);
4024
- }
4066
+ setShowNextBtn(categories.length + 1 !== page);
4025
4067
  }
4026
- // eslint-disable-next-line react-hooks/rules-of-hooks
4027
- useEffect(() => {
4028
- setStep(0);
4029
- // eslint-disable-next-line react-hooks/exhaustive-deps
4030
- }, []);
4031
- const renderStepElements = (category, indexOfCategory) => {
4032
- return (
4033
- /*
4034
- [Mar-04-2024][Paul Li] the GoAPages internal state cannot handle the hidden/display well. We need extra hide/display control to it appropriately.
4035
- */
4036
- jsx(Visible, {
4037
- visible: indexOfCategory === step - 1,
4038
- children: category.elements.map((elementUiSchema, index) => {
4039
- return jsx(JsonFormsDispatch, {
4040
- schema: schema,
4041
- uischema: elementUiSchema,
4042
- renderers: renderers,
4043
- cells: cells,
4044
- path: path,
4045
- visible: visible,
4046
- enabled: enabled && !disabledCategoryMap[indexOfCategory]
4047
- }, index);
4048
- })
4049
- })
4050
- );
4051
- };
4052
4068
  const changePage = index => {
4053
4069
  setPage(index + 1);
4054
4070
  };
4055
- const readOnly = (_d = (_c = (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.componentProps) === null || _c === void 0 ? void 0 : _c.readOnly) !== null && _d !== void 0 ? _d : false;
4071
+ const updateInputStatus = inputStatus => {
4072
+ inputStatuses[inputStatus.id] = inputStatus;
4073
+ setInputStatuses(Object.assign({}, inputStatuses));
4074
+ };
4075
+ const isInputInitialized = inputId => {
4076
+ return inputId in inputStatuses;
4077
+ };
4078
+ const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
4056
4079
  return jsx("div", {
4057
4080
  "data-testid": "form-stepper-test-wrapper",
4058
4081
  children: jsx(Visible, {
@@ -4061,32 +4084,51 @@ const FormStepper = _a => {
4061
4084
  id: `${path || `goa`}-form-stepper`,
4062
4085
  className: "formStepper",
4063
4086
  children: [jsxs(GoAFormStepper, {
4064
- testId: "form-stepper-test",
4087
+ testId: ((_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.testId) || 'form-stepper-test',
4065
4088
  step: step,
4066
4089
  onChange: step => {
4067
4090
  setTab(step);
4068
4091
  },
4069
- children: [categories === null || categories === void 0 ? void 0 : categories.map((category, index) => {
4092
+ children: [categories === null || categories === void 0 ? void 0 : categories.map((_, index) => {
4070
4093
  return jsx(GoAFormStep, {
4071
4094
  text: `${CategoryLabels[index]}`,
4072
- status: 'incomplete'
4095
+ status: stepStatuses[index]
4073
4096
  }, `${CategoryLabels[index]}-tab`);
4074
4097
  }), jsx(GoAFormStep, {
4075
- text: "Review",
4076
- status: "incomplete"
4098
+ text: "Review"
4077
4099
  })]
4078
4100
  }), jsxs(GoAPages, {
4079
4101
  current: step,
4080
4102
  mb: "xl",
4081
4103
  children: [categories === null || categories === void 0 ? void 0 : categories.map((category, index) => {
4104
+ const props = {
4105
+ category,
4106
+ categoryIndex: index,
4107
+ step: index + 1,
4108
+ schema,
4109
+ enabled,
4110
+ visible,
4111
+ path,
4112
+ disabledCategoryMap,
4113
+ renderers,
4114
+ cells
4115
+ };
4082
4116
  return jsx("div", {
4083
4117
  "data-testid": `step_${index}-content`,
4084
4118
  style: {
4085
4119
  marginTop: '1.5rem'
4086
4120
  },
4087
- children: renderStepElements(category, index)
4121
+ children: jsx(StepperContext.Provider, {
4122
+ value: {
4123
+ stepId: index + 1,
4124
+ updateStatus: updateInputStatus,
4125
+ isInitialized: isInputInitialized
4126
+ },
4127
+ children: RenderStepElements(props)
4128
+ })
4088
4129
  }, `${CategoryLabels[index]}`);
4089
4130
  }), jsxs("div", {
4131
+ "data-testid": "summary_step-content",
4090
4132
  children: [jsx("h3", {
4091
4133
  style: {
4092
4134
  flex: 1,
@@ -4119,6 +4161,7 @@ const FormStepper = _a => {
4119
4161
  type: "secondary",
4120
4162
  disabled: disabledCategoryMap[step - 1] || !enabled,
4121
4163
  onClick: () => prevPage(step, disabledCategoryMap),
4164
+ testId: "prev-button",
4122
4165
  children: "Previous"
4123
4166
  }) : jsx("div", {})
4124
4167
  }), jsxs(RightAlignmentDiv, {
@@ -4126,6 +4169,7 @@ const FormStepper = _a => {
4126
4169
  type: "primary",
4127
4170
  disabled: disabledCategoryMap[step - 1] || !enabled,
4128
4171
  onClick: () => nextPage(step, disabledCategoryMap),
4172
+ testId: "next-button",
4129
4173
  children: "Next"
4130
4174
  }), !showNextBtn && jsx("div", {
4131
4175
  children: jsx(GoAButton, {
@@ -4179,6 +4223,38 @@ const categoriesAreValid = uischema => {
4179
4223
  };
4180
4224
  const CategorizationRendererTester = rankWith(2, and(uiTypeIs('Categorization'), categoriesAreValid, optionIs('variant', 'stepper')));
4181
4225
 
4226
+ /******************************************************************************
4227
+ Copyright (c) Microsoft Corporation.
4228
+
4229
+ Permission to use, copy, modify, and/or distribute this software for any
4230
+ purpose with or without fee is hereby granted.
4231
+
4232
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
4233
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
4234
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
4235
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
4236
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
4237
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4238
+ PERFORMANCE OF THIS SOFTWARE.
4239
+ ***************************************************************************** */
4240
+
4241
+ function __rest(s, e) {
4242
+ var t = {};
4243
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4244
+ t[p] = s[p];
4245
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
4246
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
4247
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
4248
+ t[p[i]] = s[p[i]];
4249
+ }
4250
+ return t;
4251
+ }
4252
+
4253
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
4254
+ var e = new Error(message);
4255
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
4256
+ };
4257
+
4182
4258
  let _$3 = t => t,
4183
4259
  _t$3;
4184
4260
  const GoAContextMenuIcon = props => {
@@ -4603,7 +4679,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
4603
4679
  const NonEmptyCell = ownProps => {
4604
4680
  const ctx = useJsonForms();
4605
4681
  const emptyCellProps = ctxToNonEmptyCellProps(ctx, ownProps);
4606
- const isValid = isEmpty(emptyCellProps.errors);
4682
+ const isValid = isEmpty$1(emptyCellProps.errors);
4607
4683
  return jsx(NonEmptyCellComponent, Object.assign({}, emptyCellProps, {
4608
4684
  isValid: isValid
4609
4685
  }));
@@ -4868,7 +4944,7 @@ const LayoutRenderer = ({
4868
4944
  cells,
4869
4945
  visible
4870
4946
  }) => {
4871
- if (isEmpty(elements)) {
4947
+ if (isEmpty$1(elements)) {
4872
4948
  return null;
4873
4949
  } else {
4874
4950
  if (direction === 'row') {
@@ -5193,7 +5269,7 @@ const getUISchemaErrors = (uiSchema, schema) => {
5193
5269
  const invalidCategorizations = [];
5194
5270
  const invalidCategories = [];
5195
5271
  uiSchema.elements.forEach(e => {
5196
- if (e.type !== 'Category') {
5272
+ if (e.type !== 'Category' && e.type !== 'Categorization') {
5197
5273
  invalidCategorizations.push(e.type);
5198
5274
  }
5199
5275
  if (!hasElements(e) || isEmptyElements(e)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.10.1",
3
+ "version": "1.11.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",
@@ -3,9 +3,9 @@ import { StatePropsOfLayout } from '@jsonforms/core';
3
3
  import { TranslateProps } from '@jsonforms/react';
4
4
  import { AjvProps } from '@jsonforms/material-renderers';
5
5
  export interface CategorizationStepperLayoutRendererProps extends StatePropsOfLayout, AjvProps, TranslateProps {
6
- data: any;
6
+ data: unknown;
7
7
  }
8
- export declare const FormStepper: ({ uischema, data, schema, ajv, path, cells, renderers, config, visible, enabled, t, ...props }: CategorizationStepperLayoutRendererProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const FormStepper: (props: CategorizationStepperLayoutRendererProps) => JSX.Element;
9
9
  export declare const flattenObject: (obj: Record<string, string>) => Record<string, string>;
10
10
  export declare const FormStepperControl: (props: CategorizationStepperLayoutRendererProps & import("@jsonforms/core").OwnPropsOfLayout) => React.JSX.Element;
11
11
  export default FormStepper;
@@ -0,0 +1,15 @@
1
+ import { Categorization, Category, JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry, JsonSchema } from '@jsonforms/core';
2
+ export type CategorizationElement = Category | Categorization;
3
+ export interface StepProps {
4
+ category: CategorizationElement;
5
+ categoryIndex: number;
6
+ step: number;
7
+ schema: JsonSchema;
8
+ enabled: boolean;
9
+ visible: boolean;
10
+ path: string;
11
+ disabledCategoryMap: boolean[];
12
+ renderers: JsonFormsRendererRegistryEntry[] | undefined;
13
+ cells: JsonFormsCellRendererRegistryEntry[] | undefined;
14
+ }
15
+ export declare const RenderStepElements: (props: StepProps) => JSX.Element;
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { GoAFormStepStatusType } from '@abgov/react-components-new';
3
+ export type StepInputStatus = {
4
+ id: string;
5
+ value: unknown;
6
+ required: boolean;
7
+ type: string | string[] | undefined;
8
+ step: number;
9
+ };
10
+ export interface StatusTable {
11
+ [key: string]: StepInputStatus;
12
+ }
13
+ export declare const StepperContext: import("react").Context<{
14
+ updateStatus: (status: StepInputStatus) => void;
15
+ isInitialized: (_: string) => boolean;
16
+ stepId: number;
17
+ }>;
18
+ export declare const getCompletionStatus: (table: StatusTable, step: number) => GoAFormStepStatusType | undefined;
19
+ export declare const logRequiredFields: (table: StatusTable, step: number) => void;