@abgov/jsonforms-components 2.47.9 → 2.48.1

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,11 +1,11 @@
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, useCallback, useRef, useState, useLayoutEffect } from 'react';
4
- import { GoabFormItem, GoabInput, GoabTextArea, GoabCallout, GoabRadioGroup, GoabRadioItem, GoabCheckbox, GoabIcon, GoabButton, GoabGrid, GoabIconButton, GoabModal, GoabButtonGroup, GoabTable, GoabContainer, GoabDropdown, GoabDropdownItem, GoabDetails, GoabFormStepper, GoabFormStep, GoabPages, GoabBadge, GoabText, GoabFileUploadInput, GoabCircularProgress, GoabSpinner } from '@abgov/react-components';
4
+ import { GoabFormItem, GoabInput, GoabTextArea, GoabCallout, GoabRadioGroup, GoabRadioItem, GoabCheckbox, GoabIcon, GoabButton, GoabGrid, GoabIconButton, GoabTable, GoabModal, GoabButtonGroup, GoabContainer, GoabDropdown, GoabDropdownItem, GoabDetails, GoabFormStepper, GoabFormStep, GoabPages, GoabBadge, GoabText, GoabFileUploadInput, GoabCircularProgress, GoabSpinner } 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';
8
- import { isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, isBooleanControl, createDefaultValue, Paths, toDataPath, Resolve, schemaMatches, getAjv, or, isObjectArrayControl, isPrimitiveArrayControl, composePaths, schemaTypeIs, formatIs, hasType, isCategorization, isLayout } from '@jsonforms/core';
8
+ import { isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, isBooleanControl, createDefaultValue, Paths, Resolve, toDataPath, schemaMatches, getAjv, or, isObjectArrayControl, isPrimitiveArrayControl, composePaths, schemaTypeIs, formatIs, hasType, isCategorization, isLayout } from '@jsonforms/core';
9
9
  import * as _$c from 'lodash';
10
10
  import ___default, { isEqual, isObject as isObject$i, isEmpty as isEmpty$1 } from 'lodash';
11
11
  import { useJsonForms, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsArrayLayoutProps, withJsonFormsLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
@@ -194,9 +194,9 @@ var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAg
194
194
  var global$r = global$t;
195
195
  var userAgent$4 = engineUserAgent;
196
196
 
197
- var process$3 = global$r.process;
197
+ var process$4 = global$r.process;
198
198
  var Deno$1 = global$r.Deno;
199
- var versions = process$3 && process$3.versions || Deno$1 && Deno$1.version;
199
+ var versions = process$4 && process$4.versions || Deno$1 && Deno$1.version;
200
200
  var v8 = versions && versions.v8;
201
201
  var match, version;
202
202
 
@@ -3964,7 +3964,7 @@ var IS_NODE$4 = engineIsNode;
3964
3964
 
3965
3965
  var set = global$c.setImmediate;
3966
3966
  var clear = global$c.clearImmediate;
3967
- var process$2 = global$c.process;
3967
+ var process$3 = global$c.process;
3968
3968
  var Dispatch = global$c.Dispatch;
3969
3969
  var Function$1 = global$c.Function;
3970
3970
  var MessageChannel = global$c.MessageChannel;
@@ -4020,7 +4020,7 @@ if (!set || !clear) {
4020
4020
  // Node.js 0.8-
4021
4021
  if (IS_NODE$4) {
4022
4022
  defer = function (id) {
4023
- process$2.nextTick(runner(id));
4023
+ process$3.nextTick(runner(id));
4024
4024
  };
4025
4025
  // Sphere (JS game engine) Dispatch API
4026
4026
  } else if (Dispatch && Dispatch.now) {
@@ -4122,7 +4122,7 @@ var IS_NODE$3 = engineIsNode;
4122
4122
 
4123
4123
  var MutationObserver = global$a.MutationObserver || global$a.WebKitMutationObserver;
4124
4124
  var document$2 = global$a.document;
4125
- var process$1 = global$a.process;
4125
+ var process$2 = global$a.process;
4126
4126
  var Promise$1 = global$a.Promise;
4127
4127
  var microtask$1 = safeGetBuiltIn$1('queueMicrotask');
4128
4128
  var notify$1, toggle, node, promise, then;
@@ -4133,7 +4133,7 @@ if (!microtask$1) {
4133
4133
 
4134
4134
  var flush = function () {
4135
4135
  var parent, fn;
4136
- if (IS_NODE$3 && (parent = process$1.domain)) parent.exit();
4136
+ if (IS_NODE$3 && (parent = process$2.domain)) parent.exit();
4137
4137
  while (fn = queue.get()) try {
4138
4138
  fn();
4139
4139
  } catch (error) {
@@ -4165,7 +4165,7 @@ if (!microtask$1) {
4165
4165
  // Node.js without promises
4166
4166
  } else if (IS_NODE$3) {
4167
4167
  notify$1 = function () {
4168
- process$1.nextTick(flush);
4168
+ process$2.nextTick(flush);
4169
4169
  };
4170
4170
  // for other environments - macrotask based on:
4171
4171
  // - setImmediate
@@ -4320,7 +4320,7 @@ var PromiseConstructor = NativePromiseConstructor$2;
4320
4320
  var PromisePrototype = NativePromisePrototype$1;
4321
4321
  var TypeError$3 = global$7.TypeError;
4322
4322
  var document$1 = global$7.document;
4323
- var process = global$7.process;
4323
+ var process$1 = global$7.process;
4324
4324
  var newPromiseCapability$1 = newPromiseCapabilityModule$3.f;
4325
4325
  var newGenericPromiseCapability = newPromiseCapability$1;
4326
4326
 
@@ -4412,7 +4412,7 @@ var onUnhandled = function (state) {
4412
4412
  if (IS_UNHANDLED) {
4413
4413
  result = perform$2(function () {
4414
4414
  if (IS_NODE$1) {
4415
- process.emit('unhandledRejection', value, promise);
4415
+ process$1.emit('unhandledRejection', value, promise);
4416
4416
  } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
4417
4417
  });
4418
4418
  // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
@@ -4430,7 +4430,7 @@ var onHandleUnhandled = function (state) {
4430
4430
  call$c(task, global$7, function () {
4431
4431
  var promise = state.facade;
4432
4432
  if (IS_NODE$1) {
4433
- process.emit('rejectionHandled', promise);
4433
+ process$1.emit('rejectionHandled', promise);
4434
4434
  } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
4435
4435
  });
4436
4436
  };
@@ -4518,7 +4518,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
4518
4518
  state.parent = true;
4519
4519
  reaction.ok = isCallable$4(onFulfilled) ? onFulfilled : true;
4520
4520
  reaction.fail = isCallable$4(onRejected) && onRejected;
4521
- reaction.domain = IS_NODE$1 ? process.domain : undefined;
4521
+ reaction.domain = IS_NODE$1 ? process$1.domain : undefined;
4522
4522
  if (state.state === PENDING) state.reactions.add(reaction);
4523
4523
  else microtask(function () {
4524
4524
  callReaction(reaction, state);
@@ -7320,6 +7320,31 @@ const Dropdown = props => {
7320
7320
  }, id);
7321
7321
  };
7322
7322
 
7323
+ //type DebounceValueType = string | boolean | number | Record<string, unknown>;
7324
+ /**
7325
+ * A helper util to return a value at a certain delay. The delay is reset if the value arg changes
7326
+ * @param value value to be returned after a period of delay
7327
+ * @param delay time in ms to apply the delay
7328
+ * @returns value after the delay timer
7329
+ */
7330
+ function useDebounce(value, delay) {
7331
+ const [debouncedValue, setDebouncedValue] = useState(value);
7332
+ const isTestEnv = process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID !== undefined;
7333
+ useEffect(() => {
7334
+ if (isTestEnv) {
7335
+ setDebouncedValue(value);
7336
+ return;
7337
+ }
7338
+ const handler = setTimeout(() => {
7339
+ setDebouncedValue(value);
7340
+ }, delay);
7341
+ return () => {
7342
+ clearTimeout(handler);
7343
+ };
7344
+ }, [value, delay, isTestEnv]);
7345
+ return debouncedValue;
7346
+ }
7347
+
7323
7348
  function fetchRegisterConfigFromOptions$1(options) {
7324
7349
  if (!(options != null && options.url) && !(options != null && options.urn)) return undefined;
7325
7350
  const config = Object.assign({}, options);
@@ -7355,6 +7380,21 @@ const GoAInputText = props => {
7355
7380
  isVisited,
7356
7381
  setIsVisited
7357
7382
  } = props;
7383
+ const [localValue, setLocalValue] = useState(data != null ? data : '');
7384
+ const debouncedValue = useDebounce(localValue, 800);
7385
+ useEffect(() => {
7386
+ setLocalValue(data != null ? data : '');
7387
+ }, [data]);
7388
+ /* istanbul ignore next */
7389
+ useEffect(() => {
7390
+ // Only sync if debouncedValue differs from data and is not initial empty state
7391
+ if (debouncedValue !== data && (debouncedValue !== '' || data !== undefined)) {
7392
+ onChangeForInputControl({
7393
+ value: debouncedValue,
7394
+ controlProps: props
7395
+ });
7396
+ }
7397
+ }, [debouncedValue]);
7358
7398
  const width = (_uischema$options$com = uischema == null || (_uischema$options = uischema.options) == null || (_uischema$options = _uischema$options.componentProps) == null ? void 0 : _uischema$options.width) != null ? _uischema$options$com : '100%';
7359
7399
  const registerCtx = useContext(JsonFormsRegisterContext);
7360
7400
  const registerConfig = fetchRegisterConfigFromOptions$1((_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.register);
@@ -7414,29 +7454,25 @@ const GoAInputText = props => {
7414
7454
  error: isVisited && errors.length > 0,
7415
7455
  type: appliedUiSchemaOptions.format === 'password' ? 'password' : 'text',
7416
7456
  disabled: !enabled,
7417
- value: data,
7457
+ value: localValue,
7418
7458
  width: width,
7419
7459
  readonly: readOnly,
7420
7460
  maxLength: isSinField ? 11 : '',
7421
7461
  placeholder: placeholder,
7422
- ariaLabel: (appliedUiSchemaOptions == null ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`
7462
+ name: (appliedUiSchemaOptions == null ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
7463
+ ariaLabel: (appliedUiSchemaOptions == null ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
7464
+ testId: (appliedUiSchemaOptions == null ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`
7423
7465
  }, (_uischema$options5 = uischema.options) == null ? void 0 : _uischema$options5.componentProps, {
7424
7466
  // maxLength={appliedUiSchemaOptions?.maxLength}
7425
- name: (appliedUiSchemaOptions == null ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
7426
- testId: (appliedUiSchemaOptions == null ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
7427
7467
  onChange: detail => {
7428
7468
  let formattedValue = detail.value;
7429
7469
  if (schema && schema.title === sinTitle && detail.value !== '') {
7430
7470
  formattedValue = formatSin(detail.value);
7431
7471
  }
7472
+ setLocalValue(formattedValue);
7432
7473
  if (isVisited === false && setIsVisited) {
7433
7474
  setIsVisited();
7434
7475
  }
7435
- onChangeForInputControl({
7436
- name: detail.name,
7437
- value: formattedValue,
7438
- controlProps: props
7439
- });
7440
7476
  },
7441
7477
  onBlur: detail => {
7442
7478
  if (isVisited === false && setIsVisited) {
@@ -7711,9 +7747,25 @@ const GoANumberInput = props => {
7711
7747
  errors,
7712
7748
  setIsVisited
7713
7749
  } = props;
7750
+ const InputValue = data && data !== undefined ? data : '';
7751
+ const [localValue, setLocalValue] = useState(InputValue);
7752
+ const debouncedValue = useDebounce(localValue, 800);
7753
+ useEffect(() => {
7754
+ const newValue = data !== undefined ? data : '';
7755
+ setLocalValue(newValue);
7756
+ }, [data]);
7757
+ /* istanbul ignore next */
7758
+ useEffect(() => {
7759
+ // Only sync if debouncedValue differs from data and is not initial empty state
7760
+ if (debouncedValue !== data && (debouncedValue !== '' || data !== undefined)) {
7761
+ onChangeForNumericControl({
7762
+ value: String(debouncedValue),
7763
+ controlProps: props
7764
+ });
7765
+ }
7766
+ }, [debouncedValue]);
7714
7767
  const appliedUiSchemaOptions = Object.assign({}, config, uischema == null ? void 0 : uischema.options);
7715
7768
  const placeholder = (appliedUiSchemaOptions == null ? void 0 : appliedUiSchemaOptions.placeholder) || (schema == null ? void 0 : schema.description) || '';
7716
- const InputValue = data && data !== undefined ? data : '';
7717
7769
  const clonedSchema = JSON.parse(JSON.stringify(schema));
7718
7770
  const StepValue = clonedSchema.multipleOf ? clonedSchema.multipleOf : 0.01;
7719
7771
  const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
@@ -7725,7 +7777,7 @@ const GoANumberInput = props => {
7725
7777
  error: isVisited && errors.length > 0,
7726
7778
  disabled: !enabled,
7727
7779
  readonly: readOnly,
7728
- value: InputValue,
7780
+ value: localValue,
7729
7781
  placeholder: placeholder,
7730
7782
  step: StepValue,
7731
7783
  min: MinValue,
@@ -7744,14 +7796,10 @@ const GoANumberInput = props => {
7744
7796
  });
7745
7797
  },
7746
7798
  onChange: detail => {
7799
+ setLocalValue(detail.value);
7747
7800
  if (isVisited === false && setIsVisited) {
7748
7801
  setIsVisited();
7749
7802
  }
7750
- onChangeForNumericControl({
7751
- name: detail.name,
7752
- value: detail.value,
7753
- controlProps: props
7754
- });
7755
7803
  }
7756
7804
  }, uischema == null || (_uischema$options3 = uischema.options) == null ? void 0 : _uischema$options3.componentProps));
7757
7805
  };
@@ -7776,9 +7824,25 @@ const GoabInputInteger = props => {
7776
7824
  errors,
7777
7825
  setIsVisited
7778
7826
  } = props;
7827
+ const InputValue = data && data !== undefined ? data : '';
7828
+ const [localValue, setLocalValue] = useState(InputValue);
7829
+ const debouncedValue = useDebounce(localValue, 800);
7830
+ useEffect(() => {
7831
+ const newValue = data !== undefined ? data : '';
7832
+ setLocalValue(newValue);
7833
+ }, [data]);
7834
+ /* istanbul ignore next */
7835
+ useEffect(() => {
7836
+ // Only sync if debouncedValue differs from data and is not initial empty state
7837
+ if (debouncedValue !== data && (debouncedValue !== '' || data !== undefined)) {
7838
+ onChangeForNumericControl({
7839
+ value: String(debouncedValue),
7840
+ controlProps: props
7841
+ });
7842
+ }
7843
+ }, [debouncedValue]);
7779
7844
  const appliedUiSchemaOptions = Object.assign({}, config, uischema == null ? void 0 : uischema.options);
7780
7845
  const placeholder = (appliedUiSchemaOptions == null ? void 0 : appliedUiSchemaOptions.placeholder) || (schema == null ? void 0 : schema.description) || '';
7781
- const InputValue = data && data !== undefined ? data : '';
7782
7846
  const clonedSchema = JSON.parse(JSON.stringify(schema));
7783
7847
  const StepValue = clonedSchema.multipleOf ? clonedSchema.multipleOf : 0;
7784
7848
  const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
@@ -7791,7 +7855,7 @@ const GoabInputInteger = props => {
7791
7855
  width: width,
7792
7856
  disabled: !enabled,
7793
7857
  readonly: readOnly,
7794
- value: InputValue,
7858
+ value: localValue,
7795
7859
  step: StepValue,
7796
7860
  min: MinValue,
7797
7861
  max: MaxValue,
@@ -7809,14 +7873,11 @@ const GoabInputInteger = props => {
7809
7873
  });
7810
7874
  },
7811
7875
  onChange: detail => {
7876
+ // Update local state immediately for responsive UI
7877
+ setLocalValue(detail.value);
7812
7878
  if (isVisited === false && setIsVisited) {
7813
7879
  setIsVisited();
7814
7880
  }
7815
- onChangeForNumericControl({
7816
- name: detail.name,
7817
- value: detail.value,
7818
- controlProps: props
7819
- });
7820
7881
  }
7821
7882
  }, uischema == null || (_uischema$options3 = uischema.options) == null ? void 0 : _uischema$options3.componentProps));
7822
7883
  };
@@ -8637,7 +8698,9 @@ let _$7 = t => t,
8637
8698
  _t23$1,
8638
8699
  _t24$1,
8639
8700
  _t25$1,
8640
- _t26$1;
8701
+ _t26$1,
8702
+ _t27$1,
8703
+ _t28$1;
8641
8704
  const DeleteDialogContent = styled.div(_t$8 || (_t$8 = _$7`
8642
8705
  margin-bottom: var(--goa-space-m);
8643
8706
  `));
@@ -8669,9 +8732,7 @@ const TextCenter = styled.div(_t7$1 || (_t7$1 = _$7`
8669
8732
  text-align: center;
8670
8733
  `));
8671
8734
  const SideMenuItem = styled.div(_t8$1 || (_t8$1 = _$7`
8672
- &:hover {
8673
- background: #f1f1f1;
8674
- }
8735
+ margin-top: 1rem;
8675
8736
  `));
8676
8737
  const RowFlex = styled.div(_t9$1 || (_t9$1 = _$7`
8677
8738
  display: flex;
@@ -8680,9 +8741,20 @@ const RowFlex = styled.div(_t9$1 || (_t9$1 = _$7`
8680
8741
  `));
8681
8742
  const RowFlexMenu = styled.div(_t0$1 || (_t0$1 = _$7`
8682
8743
  display: flex;
8683
- flex-direction: row;
8684
- border: 1px solid #dcdcdc;
8685
- margin-top: 1rem;
8744
+ flex-direction: column;
8745
+ align-items: stretch;
8746
+ border: 1px solid var(--goa-color-greyscale-300);
8747
+ border-radius: var(--goa-border-radius-m);
8748
+ margin-top: var(--goa-space-xs);
8749
+ background-color: var(--goa-color-greyscale-white);
8750
+ padding: 0;
8751
+ gap: 0;
8752
+ position: relative;
8753
+ overflow: visible;
8754
+
8755
+ &:hover {
8756
+ border-color: var(--goa-color-greyscale-400);
8757
+ }
8686
8758
  `));
8687
8759
  const FlexTabs = styled.div(_t1$1 || (_t1$1 = _$7`
8688
8760
  flex-direction: column;
@@ -8721,44 +8793,41 @@ const ListContainer = styled.div(_t14$1 || (_t14$1 = _$7`
8721
8793
  styled.div(_t15$1 || (_t15$1 = _$7`
8722
8794
  padding: 0 0 var(--goa-space-l) 0;
8723
8795
  `));
8724
- const IconPadding = styled.div(_t16$1 || (_t16$1 = _$7`
8725
- padding: 0.9rem 0.5rem 0 0;
8726
- `));
8727
- const UpdateListContainer = styled.div(_t17$1 || (_t17$1 = _$7`
8796
+ const UpdateListContainer = styled.div(_t16$1 || (_t16$1 = _$7`
8728
8797
  width: 100%;
8729
8798
  border: 1px solid #dcdcdc;
8730
8799
  padding: var(--goa-space-xl);
8731
8800
  `));
8732
- styled.div(_t18$1 || (_t18$1 = _$7`
8801
+ styled.div(_t17$1 || (_t17$1 = _$7`
8733
8802
  padding: 0 1.5rem 0 0;
8734
8803
  border: 1px solid #dcdcdc;
8735
8804
  `));
8736
- const TableTHHeader = styled.th(_t19$1 || (_t19$1 = _$7`
8805
+ const TableTHHeader = styled.th(_t18$1 || (_t18$1 = _$7`
8737
8806
  background-color: var(--goa-color-greyscale-100) !important;
8738
8807
  vertical-align: top;
8739
8808
  `));
8740
- const ObjectArrayWarningIconDiv = styled.div(_t20$1 || (_t20$1 = _$7`
8809
+ const ObjectArrayWarningIconDiv = styled.div(_t19$1 || (_t19$1 = _$7`
8741
8810
  display: inline-flex;
8742
8811
  align-items: flex-start;
8743
8812
  gap: 0.25rem;
8744
8813
  font-size: var(--goa-font-size-2);
8745
8814
  color: var(--goa-color-interactive-error);
8746
8815
  `));
8747
- const ListWithDetailWarningIconDiv = styled.div(_t21$1 || (_t21$1 = _$7`
8816
+ const ListWithDetailWarningIconDiv = styled.div(_t20$1 || (_t20$1 = _$7`
8748
8817
  display: inline-flex;
8749
8818
  align-items: flex-start;
8750
8819
  gap: 0.25rem;
8751
8820
  font-size: var(--goa-font-size-3);
8752
8821
  color: var(--goa-color-interactive-error);
8753
8822
  `));
8754
- styled.label(_t22$1 || (_t22$1 = _$7`
8823
+ styled.label(_t21$1 || (_t21$1 = _$7`
8755
8824
  color: var(--goa-color-interactive-error);
8756
8825
  font-weight: var(--goa-font-weight-regular);
8757
8826
  font-size: var(--goa-font-size-3);
8758
8827
  line-height: var(--goa-line-height-1);
8759
8828
  font-style: normal;
8760
8829
  `));
8761
- styled.div(_t23$1 || (_t23$1 = _$7`
8830
+ styled.div(_t22$1 || (_t22$1 = _$7`
8762
8831
  margin-top: var(--goa-space-m);
8763
8832
  color: var(--goa-color-interactive-error);
8764
8833
  font-weight: var(--goa-font-weight-regular);
@@ -8766,10 +8835,10 @@ styled.div(_t23$1 || (_t23$1 = _$7`
8766
8835
  line-height: var(--goa-line-height-1);
8767
8836
  font-style: normal;
8768
8837
  `));
8769
- const HilightCellWarning = styled.div(_t24$1 || (_t24$1 = _$7`
8838
+ const HilightCellWarning = styled.div(_t23$1 || (_t23$1 = _$7`
8770
8839
  background-color: var(--goa-color-warning-default);
8771
8840
  `));
8772
- const FixTableHeaderAlignment = styled.div(_t25$1 || (_t25$1 = _$7`
8841
+ const FixTableHeaderAlignment = styled.div(_t24$1 || (_t24$1 = _$7`
8773
8842
  table thead th:nth-child(3) {
8774
8843
  text-align: center;
8775
8844
  }
@@ -8778,11 +8847,31 @@ const FixTableHeaderAlignment = styled.div(_t25$1 || (_t25$1 = _$7`
8778
8847
  text-align: center;
8779
8848
  }
8780
8849
  `));
8781
- const ListWithDetailsReviewCellDiv = styled.div(_t26$1 || (_t26$1 = _$7`
8850
+ const ListWithDetailsReviewCellDiv = styled.div(_t25$1 || (_t25$1 = _$7`
8782
8851
  display: 'flex';
8783
8852
  flex-direction: 'column';
8784
8853
  text-align: 'start';
8785
8854
  `));
8855
+ const IconsContainer = styled.div(_t26$1 || (_t26$1 = _$7`
8856
+ display: flex;
8857
+ align-items: center;
8858
+ justify-content: flex-end;
8859
+ gap: var(--goa-space-xs);
8860
+ padding-bottom: var(--goa-space-xs);
8861
+ `));
8862
+ const TableContentContainer = styled.div(_t27$1 || (_t27$1 = _$7`
8863
+ padding: var(--goa-space-l);
8864
+ `));
8865
+ const NoDataMessage = styled.div(_t28$1 || (_t28$1 = _$7`
8866
+ padding: var(--goa-space-xl) var(--goa-space-l);
8867
+ color: var(--goa-color-greyscale-700);
8868
+ font: var(--goa-typography-body-m);
8869
+ text-align: center;
8870
+ display: flex;
8871
+ align-items: center;
8872
+ justify-content: center;
8873
+ min-height: 100px;
8874
+ `));
8786
8875
 
8787
8876
  const ObjectArrayToolBar = /*#__PURE__*/React.memo(function TableToolbar({
8788
8877
  data,
@@ -9064,6 +9153,134 @@ const NonEmptyRowComponent$1 = ({
9064
9153
  }) : null
9065
9154
  }, childPath);
9066
9155
  };
9156
+ function isControlElement(element) {
9157
+ return element.type === 'Control';
9158
+ }
9159
+ function isLayoutElement(element) {
9160
+ return 'elements' in element;
9161
+ }
9162
+ function extractPaths(uiSchema) {
9163
+ if (!uiSchema) {
9164
+ return [];
9165
+ }
9166
+ if (isControlElement(uiSchema)) {
9167
+ return uiSchema.scope ? [toDataPath(uiSchema.scope)] : [];
9168
+ }
9169
+ if (isLayoutElement(uiSchema)) {
9170
+ return uiSchema.elements.flatMap(extractPaths);
9171
+ }
9172
+ return [];
9173
+ }
9174
+ function getValue(obj, path) {
9175
+ return path.replace(/^\./, '').split('.').reduce((acc, part) => {
9176
+ if (acc && typeof acc === 'object' && part in acc) {
9177
+ return acc[part];
9178
+ }
9179
+ return undefined;
9180
+ }, obj);
9181
+ }
9182
+ function findLabelForPath(path, uiSchema, schema) {
9183
+ if (!uiSchema) {
9184
+ return path;
9185
+ }
9186
+ if (isControlElement(uiSchema)) {
9187
+ const controlPath = uiSchema.scope ? toDataPath(uiSchema.scope) : '';
9188
+ if (controlPath === path) {
9189
+ const label = uiSchema.label;
9190
+ if (typeof label === 'string') {
9191
+ return label;
9192
+ } else if (typeof label === 'object' && label !== null && 'text' in label) {
9193
+ return label.text || path;
9194
+ }
9195
+ return path;
9196
+ }
9197
+ }
9198
+ if (isLayoutElement(uiSchema)) {
9199
+ for (const element of uiSchema.elements) {
9200
+ const label = findLabelForPath(path, element, schema);
9201
+ if (label !== path) {
9202
+ return label;
9203
+ }
9204
+ }
9205
+ }
9206
+ if (schema != null && schema.properties) {
9207
+ const propertyKey = path.split('.').pop();
9208
+ if (propertyKey && schema.properties[propertyKey]) {
9209
+ const property = schema.properties[propertyKey];
9210
+ if (typeof property === 'object' && 'title' in property) {
9211
+ return String(property.title) || path;
9212
+ }
9213
+ }
9214
+ }
9215
+ return path;
9216
+ }
9217
+ function generateSummaryPairs(rowData, detailUiSchema, schema) {
9218
+ const paths = extractPaths(detailUiSchema);
9219
+ if (paths.length === 0) {
9220
+ return Object.entries(rowData).filter(([, value]) => value !== undefined && value !== null && value !== '').map(([key, value]) => ({
9221
+ label: findLabelForPath(key, detailUiSchema, schema),
9222
+ value
9223
+ }));
9224
+ }
9225
+ return paths.map(path => {
9226
+ const value = getValue(rowData, path);
9227
+ const label = findLabelForPath(path, detailUiSchema, schema);
9228
+ return {
9229
+ label,
9230
+ value
9231
+ };
9232
+ }).filter(({
9233
+ value
9234
+ }) => value !== undefined && value !== null && value !== '');
9235
+ }
9236
+ const SummaryDisplay = ({
9237
+ rowData,
9238
+ uischema,
9239
+ schema
9240
+ }) => {
9241
+ var _uischema$options10;
9242
+ if (!rowData || Object.keys(rowData).length === 0) {
9243
+ return jsx(NoDataMessage, {
9244
+ children: "No data"
9245
+ });
9246
+ }
9247
+ const pairs = generateSummaryPairs(rowData, uischema == null || (_uischema$options10 = uischema.options) == null ? void 0 : _uischema$options10.detail, schema);
9248
+ if (pairs.length === 0) {
9249
+ return jsx(NoDataMessage, {
9250
+ children: "No data"
9251
+ });
9252
+ }
9253
+ return jsx(GoabTable, {
9254
+ width: "100%",
9255
+ mb: "none",
9256
+ variant: "relaxed",
9257
+ children: jsx("tbody", {
9258
+ children: pairs.map((pair, index) => jsxs("tr", {
9259
+ style: {
9260
+ borderBottom: 'none'
9261
+ },
9262
+ children: [jsx("td", {
9263
+ style: {
9264
+ width: '50%',
9265
+ fontWeight: '600',
9266
+ border: 'none',
9267
+ paddingTop: 'var(--goa-space-xs)',
9268
+ paddingBottom: 'var(--goa-space-xs)'
9269
+ },
9270
+ children: pair.label
9271
+ }), jsx("td", {
9272
+ style: {
9273
+ width: '50%',
9274
+ border: 'none',
9275
+ paddingTop: 'var(--goa-space-xs)',
9276
+ paddingBottom: 'var(--goa-space-xs)'
9277
+ },
9278
+ children: String(pair.value)
9279
+ })]
9280
+ }, `${pair.label}-${index}`))
9281
+ })
9282
+ });
9283
+ };
9067
9284
  const MainItemComponent = ({
9068
9285
  childPath,
9069
9286
  rowIndex,
@@ -9073,10 +9290,12 @@ const MainItemComponent = ({
9073
9290
  currentTab,
9074
9291
  current,
9075
9292
  setCurrentListPage,
9076
- rowData
9293
+ rowData,
9294
+ uischema,
9295
+ schema
9077
9296
  }) => {
9078
9297
  const displayName = Object.keys(rowData != null ? rowData : {}).length === 0 ? 'No data' : Object.values(rowData || {}).join(', ');
9079
- return jsx(SideMenuItem, {
9298
+ return jsxs(SideMenuItem, {
9080
9299
  onClick: () => selectCurrentTab(rowIndex),
9081
9300
  onKeyDown: e => {
9082
9301
  if (e.key === 'ArrowRight') {
@@ -9091,62 +9310,32 @@ const MainItemComponent = ({
9091
9310
  }
9092
9311
  }
9093
9312
  },
9094
- children: jsxs(RowFlexMenu, {
9313
+ children: [jsxs(IconsContainer, {
9314
+ children: [jsx(GoabIconButton, {
9315
+ disabled: !enabled,
9316
+ icon: "create",
9317
+ title: 'Edit',
9318
+ testId: "edit button",
9319
+ onClick: () => setCurrentListPage(currentTab + 1)
9320
+ }), enabled ? jsx(GoabIconButton, {
9321
+ disabled: !enabled,
9322
+ icon: "trash",
9323
+ title: 'Delete',
9324
+ testId: "delete button",
9325
+ onClick: () => openDeleteDialog(childPath, rowIndex, displayName)
9326
+ }) : null]
9327
+ }), jsx(RowFlexMenu, {
9095
9328
  tabIndex: 0,
9096
- children: [jsx(TabName, {
9097
- children: displayName
9098
- }), enabled ? jsx(Trash, {
9099
- children: jsx(GoabIconButton, {
9100
- disabled: !enabled,
9101
- icon: "trash",
9102
- title: 'remove',
9103
- testId: "remove the details",
9104
- onClick: () => openDeleteDialog(childPath, rowIndex, displayName)
9105
- })
9106
- }) : null, jsx(IconPadding, {
9107
- children: jsx(GoabIconButton, {
9108
- disabled: !enabled,
9109
- icon: "create",
9110
- title: 'edit',
9111
- testId: "edit button",
9112
- onClick: () => setCurrentListPage(currentTab + 1)
9329
+ children: jsx(TableContentContainer, {
9330
+ children: jsx(SummaryDisplay, {
9331
+ rowData: rowData,
9332
+ uischema: uischema,
9333
+ schema: schema
9113
9334
  })
9114
- })]
9115
- })
9335
+ })
9336
+ })]
9116
9337
  });
9117
9338
  };
9118
- function isControlElement(element) {
9119
- return element.type === 'Control';
9120
- }
9121
- function isLayoutElement(element) {
9122
- return 'elements' in element;
9123
- }
9124
- function extractPaths(uiSchema) {
9125
- if (!uiSchema) {
9126
- return [];
9127
- }
9128
- if (isControlElement(uiSchema)) {
9129
- return uiSchema.scope ? [toDataPath(uiSchema.scope)] : [];
9130
- }
9131
- if (isLayoutElement(uiSchema)) {
9132
- return uiSchema.elements.flatMap(extractPaths);
9133
- }
9134
- return [];
9135
- }
9136
- function getValue(obj, path) {
9137
- return path.split('.').reduce((acc, key) => acc && typeof acc === 'object' ? acc[key] : undefined, obj);
9138
- }
9139
- function orderRowData(rowData, detailUiSchema) {
9140
- const orderedPaths = extractPaths(detailUiSchema);
9141
- const ordered = {};
9142
- for (const path of orderedPaths) {
9143
- const value = getValue(rowData, path);
9144
- if (value !== undefined) {
9145
- ordered[path] = value;
9146
- }
9147
- }
9148
- return ordered;
9149
- }
9150
9339
  function getEffectiveInstancePath(error) {
9151
9340
  var _error$params;
9152
9341
  if (error.keyword === 'required' && (_error$params = error.params) != null && _error$params.missingProperty) {
@@ -9289,16 +9478,16 @@ const MainTab = ({
9289
9478
  currentTab,
9290
9479
  current,
9291
9480
  setCurrentListPage,
9292
- uischema
9481
+ uischema,
9482
+ schema
9293
9483
  }) => {
9294
- var _uischema$options10, _core$errors;
9484
+ var _core$errors;
9295
9485
  /* eslint-disable @typescript-eslint/no-explicit-any */
9296
9486
  const getDataAtPath = (data, path) => path.replace(/\[(\d+)\]/g, '.$1').split('.').reduce((acc, key) => acc ? acc[key] : undefined, data);
9297
9487
  const {
9298
9488
  core
9299
9489
  } = useJsonForms();
9300
9490
  const rowData = getDataAtPath(core == null ? void 0 : core.data, childPath);
9301
- const orderedRowData = orderRowData(rowData, uischema == null || (_uischema$options10 = uischema.options) == null ? void 0 : _uischema$options10.detail);
9302
9491
  function resolveField(e) {
9303
9492
  var _e$params;
9304
9493
  if (e.keyword === 'required') {
@@ -9375,7 +9564,7 @@ const MainTab = ({
9375
9564
  children: errorText ? jsx(GoabFormItem, {
9376
9565
  error: errorText,
9377
9566
  children: jsx(MainItemComponent, {
9378
- rowData: orderedRowData,
9567
+ rowData: rowData,
9379
9568
  childPath: childPath,
9380
9569
  rowIndex: rowIndex,
9381
9570
  openDeleteDialog: openDeleteDialog,
@@ -9383,10 +9572,12 @@ const MainTab = ({
9383
9572
  enabled: enabled,
9384
9573
  currentTab: currentTab,
9385
9574
  current: current,
9386
- setCurrentListPage: setCurrentListPage
9575
+ setCurrentListPage: setCurrentListPage,
9576
+ uischema: uischema,
9577
+ schema: schema
9387
9578
  })
9388
9579
  }) : jsx(MainItemComponent, {
9389
- rowData: orderedRowData,
9580
+ rowData: rowData,
9390
9581
  childPath: childPath,
9391
9582
  rowIndex: rowIndex,
9392
9583
  openDeleteDialog: openDeleteDialog,
@@ -9394,7 +9585,9 @@ const MainTab = ({
9394
9585
  enabled: enabled,
9395
9586
  currentTab: currentTab,
9396
9587
  current: current,
9397
- setCurrentListPage: setCurrentListPage
9588
+ setCurrentListPage: setCurrentListPage,
9589
+ uischema: uischema,
9590
+ schema: schema
9398
9591
  })
9399
9592
  }, childPath);
9400
9593
  };
@@ -13424,6 +13617,7 @@ const TaskList = ({
13424
13617
  subtitle,
13425
13618
  isValid,
13426
13619
  hideSummary,
13620
+ hideProgress,
13427
13621
  additionalInstructions
13428
13622
  }) => {
13429
13623
  const testid = 'table-of-contents';
@@ -13458,7 +13652,7 @@ const TaskList = ({
13458
13652
  mt: "none",
13459
13653
  mb: "xl",
13460
13654
  children: subtitle
13461
- }), jsx(ApplicationStatus, {
13655
+ }), !hideProgress && jsx(ApplicationStatus, {
13462
13656
  completedGroups: completedPages,
13463
13657
  totalGroups: totalPages
13464
13658
  }), jsx(GoabTable, {
@@ -13818,7 +14012,7 @@ const FormPagesView = props => {
13818
14012
  goToPage(index);
13819
14013
  };
13820
14014
  if (categories.length + 1 === activeId) {
13821
- var _props$uischema, _props$uischema2, _props$uischema3, _props$uischema4;
14015
+ var _props$uischema, _props$uischema2, _props$uischema3, _props$uischema4, _props$uischema5;
13822
14016
  const patchedCategories = categories.map(c => {
13823
14017
  const scopes = getCategoryScopes(c);
13824
14018
  const hasData = hasDataInScopes(data, scopes);
@@ -13837,7 +14031,8 @@ const FormPagesView = props => {
13837
14031
  subtitle: (_props$uischema2 = props.uischema) == null || (_props$uischema2 = _props$uischema2.options) == null ? void 0 : _props$uischema2.subtitle,
13838
14032
  isValid: completedCount === visibleCats.length,
13839
14033
  hideSummary: (_props$uischema3 = props.uischema) == null || (_props$uischema3 = _props$uischema3.options) == null ? void 0 : _props$uischema3.hideSummary,
13840
- additionalInstructions: (_props$uischema4 = props.uischema) == null || (_props$uischema4 = _props$uischema4.options) == null ? void 0 : _props$uischema4.additionalInstructions
14034
+ hideProgress: (_props$uischema4 = props.uischema) == null || (_props$uischema4 = _props$uischema4.options) == null ? void 0 : _props$uischema4.hideProgress,
14035
+ additionalInstructions: (_props$uischema5 = props.uischema) == null || (_props$uischema5 = _props$uischema5.options) == null ? void 0 : _props$uischema5.additionalInstructions
13841
14036
  };
13842
14037
  return jsx(TaskList, Object.assign({}, tocProps));
13843
14038
  }
@@ -16344,26 +16539,6 @@ function handleAddressKeyDown(key, value, activeIndex, suggestions, onInputChang
16344
16539
  return activeIndex;
16345
16540
  }
16346
16541
 
16347
- //type DebounceValueType = string | boolean | number | Record<string, unknown>;
16348
- /**
16349
- * A helper util to return a value at a certain delay. The delay is reset if the value arg changes
16350
- * @param value value to be returned after a period of delay
16351
- * @param delay time in ms to apply the delay
16352
- * @returns value after the delay timer
16353
- */
16354
- function useDebounce(value, delay) {
16355
- const [debouncedValue, setDebouncedValue] = useState(value);
16356
- useEffect(() => {
16357
- const handler = setTimeout(() => {
16358
- setDebouncedValue(value);
16359
- }, delay);
16360
- return () => {
16361
- clearTimeout(handler);
16362
- };
16363
- }, [value, delay]);
16364
- return debouncedValue;
16365
- }
16366
-
16367
16542
  const ADDRESS_PATH = 'api/gateway/v1/address/v1/find';
16368
16543
  const AddressLookUpControl = props => {
16369
16544
  var _schema$properties, _uischema$options, _uischema$options$com, _uischema$options2, _errors$addressLine;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.47.9",
3
+ "version": "2.48.1",
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",
@@ -16,6 +16,7 @@ export interface TocProps {
16
16
  subtitle?: string;
17
17
  isValid: boolean;
18
18
  hideSummary: boolean;
19
+ hideProgress: boolean;
19
20
  additionalInstructions?: string | AdditionalInstructionsConfig;
20
21
  }
21
22
  export declare const TaskList: React.FC<TocProps>;
@@ -1,7 +1,8 @@
1
+ import React from 'react';
1
2
  import { CellProps, WithClassname, ControlProps, RankedTester } from '@jsonforms/core';
2
3
  import { WithInputProps } from './type';
3
4
  export type GoAInputNumberProps = CellProps & WithClassname & WithInputProps;
4
5
  export declare const GoANumberInput: (props: GoAInputNumberProps) => JSX.Element;
5
6
  export declare const GoANumberControl: (props: ControlProps) => import("react/jsx-runtime").JSX.Element;
6
7
  export declare const GoANumberControlTester: RankedTester;
7
- export declare const GoAInputNumberControl: import("react").ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
8
+ export declare const GoAInputNumberControl: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
@@ -15,7 +15,6 @@ export declare const TabName: import("styled-components/dist/types").IStyledComp
15
15
  export declare const Trash: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
16
16
  export declare const ListContainer: 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 DetailMargin: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
18
- export declare const IconPadding: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
19
18
  export declare const UpdateListContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
20
19
  export declare const CompleteContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
21
20
  export declare const TableTHHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, never>> & string;
@@ -26,3 +25,6 @@ export declare const HasErrorLabel: import("styled-components/dist/types").IStyl
26
25
  export declare const HilightCellWarning: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
27
26
  export declare const FixTableHeaderAlignment: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
28
27
  export declare const ListWithDetailsReviewCellDiv: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
28
+ export declare const IconsContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
29
+ export declare const TableContentContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
30
+ export declare const NoDataMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;