@abgov/jsonforms-components 1.43.3 → 1.43.5

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.
Files changed (2) hide show
  1. package/index.esm.js +17 -11
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -2466,7 +2466,7 @@ const StepperContext = /*#__PURE__*/createContext({
2466
2466
  stepId: 0
2467
2467
  });
2468
2468
  const isEmpty = value => {
2469
- return value === undefined || value === null || typeof value === 'string' && value.length < 1;
2469
+ return value === undefined || value === null || typeof value === 'string' && value.length < 1 || typeof value === 'boolean' && value === false;
2470
2470
  };
2471
2471
  const getCompletionStatus = (table, step, isFormChanged = false) => {
2472
2472
  const nonEmptyCount = getNonEmptyCount(table, step);
@@ -5743,15 +5743,24 @@ const FormStepper = props => {
5743
5743
  }
5744
5744
  setPage(page);
5745
5745
  }
5746
+ const getAllStatuses = (nextPage, totalVisibleTabs) => {
5747
+ const previouslyActivePage = nextPage - 1;
5748
+ const statuses = [...stepStatuses];
5749
+ for (let currentPage = 1; currentPage <= previouslyActivePage; currentPage++) {
5750
+ const pageStatus = getCompletionStatus(inputStatuses, currentPage, true);
5751
+ statuses[currentPage - 1] = pageStatus ? pageStatus : 'incomplete';
5752
+ }
5753
+ return statuses;
5754
+ };
5746
5755
  /* istanbul ignore next */
5747
5756
  function setTab(page) {
5748
5757
  const categoryLabels = [...allCategories.elements.map(category => category.label), summaryLabel];
5749
5758
  const visibleLabels = [...visibleCategoryLabels, summaryLabel];
5750
5759
  const newPage = mapToVisibleStep(page, categoryLabels, visibleLabels);
5751
- const pageStatus = getCompletionStatus(inputStatuses, page, true);
5752
- const statuses = [...stepStatuses];
5753
- statuses[page - 1] = pageStatus ? pageStatus : 'incomplete';
5754
- setStepStatuses(statuses);
5760
+ if (Object.keys(inputStatuses).length) {
5761
+ const statuses = getAllStatuses(page, visibleLabels.length);
5762
+ setStepStatuses(statuses);
5763
+ }
5755
5764
  setPage(newPage);
5756
5765
  }
5757
5766
  function setPage(page) {
@@ -6144,6 +6153,7 @@ const AttachmentBorder = styled.div(_t2$2 || (_t2$2 = _$3`
6144
6153
  margin-top: var(--goa-space-2xs);
6145
6154
  `));
6146
6155
  const FileUploaderStyle = styled.div(_t3$2 || (_t3$2 = _$3`
6156
+ margin-bottom: var(--goa-space-l);
6147
6157
  .label {
6148
6158
  display: block;
6149
6159
  font-weight: var(--goa-font-weight-bold);
@@ -7532,6 +7542,7 @@ const LabelDiv = styled.div(_t3 || (_t3 = _$1`
7532
7542
  font-size: var(--fs-sl);
7533
7543
  padding-bottom: 1.5rem;
7534
7544
  `));
7545
+ /* istanbul ignore next */
7535
7546
  const ListItem = styled.li(_t4 || (_t4 = _$1`
7536
7547
  background-color: ${0};
7537
7548
  color: ${0};
@@ -8057,7 +8068,7 @@ const AddressLookUpControl = props => {
8057
8068
  }
8058
8069
  });
8059
8070
  fetchSuggestions();
8060
- }, [searchTerm, dropdownSelected]);
8071
+ }, [searchTerm, dropdownSelected]); // eslint-disable-line react-hooks/exhaustive-deps
8061
8072
  const handleDropdownChange = value => {
8062
8073
  setSearchTerm(value);
8063
8074
  handleInputChange('addressLine1', value);
@@ -8070,7 +8081,6 @@ const AddressLookUpControl = props => {
8070
8081
  setErrors({});
8071
8082
  setDropdownSelected(true);
8072
8083
  };
8073
- /* istanbul ignore next */
8074
8084
  const handleRequiredFieldBlur = name => {
8075
8085
  const err = Object.assign({}, errors);
8076
8086
  if (!(data === null || data === void 0 ? void 0 : data[name]) || data[name] === '' || (data === null || data === void 0 ? void 0 : data[name]) === undefined) {
@@ -8082,7 +8092,6 @@ const AddressLookUpControl = props => {
8082
8092
  setSuggestions([]);
8083
8093
  setOpen(false);
8084
8094
  };
8085
- /* istanbul ignore next */
8086
8095
  const handleKeyDown = (e, value, key) => {
8087
8096
  var _a;
8088
8097
  if (key === 'ArrowDown') {
@@ -8328,7 +8337,6 @@ const NameInputs = ({
8328
8337
  }) => {
8329
8338
  var _a, _b;
8330
8339
  const [errors, setErrors] = useState({});
8331
- /* istanbul ignore next */
8332
8340
  // eslint-disable-next-line
8333
8341
  const handleRequiredFieldBlur = (name, updatedData) => {
8334
8342
  const err = Object.assign({}, errors);
@@ -8358,7 +8366,6 @@ const NameInputs = ({
8358
8366
  value: firstName || '',
8359
8367
  onChange: (name, value) => handleInputChange(name, value),
8360
8368
  onBlur: name => {
8361
- /* istanbul ignore next */
8362
8369
  handleRequiredFieldBlur(name);
8363
8370
  },
8364
8371
  width: "100%"
@@ -8389,7 +8396,6 @@ const NameInputs = ({
8389
8396
  value: lastName || '',
8390
8397
  onChange: (name, value) => handleInputChange(name, value),
8391
8398
  onBlur: name => {
8392
- /* istanbul ignore next */
8393
8399
  handleRequiredFieldBlur(name);
8394
8400
  },
8395
8401
  width: "100%"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.43.3",
3
+ "version": "1.43.5",
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",