@abgov/jsonforms-components 2.47.9 → 2.48.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
@@ -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
  };
@@ -13424,6 +13485,7 @@ const TaskList = ({
13424
13485
  subtitle,
13425
13486
  isValid,
13426
13487
  hideSummary,
13488
+ hideProgress,
13427
13489
  additionalInstructions
13428
13490
  }) => {
13429
13491
  const testid = 'table-of-contents';
@@ -13458,7 +13520,7 @@ const TaskList = ({
13458
13520
  mt: "none",
13459
13521
  mb: "xl",
13460
13522
  children: subtitle
13461
- }), jsx(ApplicationStatus, {
13523
+ }), !hideProgress && jsx(ApplicationStatus, {
13462
13524
  completedGroups: completedPages,
13463
13525
  totalGroups: totalPages
13464
13526
  }), jsx(GoabTable, {
@@ -13818,7 +13880,7 @@ const FormPagesView = props => {
13818
13880
  goToPage(index);
13819
13881
  };
13820
13882
  if (categories.length + 1 === activeId) {
13821
- var _props$uischema, _props$uischema2, _props$uischema3, _props$uischema4;
13883
+ var _props$uischema, _props$uischema2, _props$uischema3, _props$uischema4, _props$uischema5;
13822
13884
  const patchedCategories = categories.map(c => {
13823
13885
  const scopes = getCategoryScopes(c);
13824
13886
  const hasData = hasDataInScopes(data, scopes);
@@ -13837,7 +13899,8 @@ const FormPagesView = props => {
13837
13899
  subtitle: (_props$uischema2 = props.uischema) == null || (_props$uischema2 = _props$uischema2.options) == null ? void 0 : _props$uischema2.subtitle,
13838
13900
  isValid: completedCount === visibleCats.length,
13839
13901
  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
13902
+ hideProgress: (_props$uischema4 = props.uischema) == null || (_props$uischema4 = _props$uischema4.options) == null ? void 0 : _props$uischema4.hideProgress,
13903
+ additionalInstructions: (_props$uischema5 = props.uischema) == null || (_props$uischema5 = _props$uischema5.options) == null ? void 0 : _props$uischema5.additionalInstructions
13841
13904
  };
13842
13905
  return jsx(TaskList, Object.assign({}, tocProps));
13843
13906
  }
@@ -16344,26 +16407,6 @@ function handleAddressKeyDown(key, value, activeIndex, suggestions, onInputChang
16344
16407
  return activeIndex;
16345
16408
  }
16346
16409
 
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
16410
  const ADDRESS_PATH = 'api/gateway/v1/address/v1/find';
16368
16411
  const AddressLookUpControl = props => {
16369
16412
  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.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",
@@ -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>;