@abgov/jsonforms-components 2.4.0 → 2.4.2

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
@@ -7,7 +7,7 @@ import axios from 'axios';
7
7
  import get$1 from 'lodash/get';
8
8
  import { rankWith, isStringControl, and, optionIs, uiTypeIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, getAjv, isVisible, getControlPath, toDataPath, deriveLabelForUISchemaElement, isEnabled, schemaTypeIs, formatIs, createDefaultValue, or, isObjectArrayControl, isPrimitiveArrayControl, Paths, schemaMatches, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
9
9
  import { withJsonFormsControlProps, withJsonFormsRendererProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, useJsonForms, withJsonFormsLayoutProps, withJsonFormsArrayLayoutProps, withJsonFormsAllOfProps, withJsonFormsCellProps } from '@jsonforms/react';
10
- import * as _$c from 'lodash';
10
+ import * as _$b from 'lodash';
11
11
  import { isEqual, isEmpty as isEmpty$1, isObject as isObject$f } from 'lodash';
12
12
  import merge from 'lodash/merge';
13
13
  import isEmpty from 'lodash/isEmpty';
@@ -2719,59 +2719,201 @@ $$o({ global: true, constructor: true, forced: FORCED$3 }, {
2719
2719
  Iterator: IteratorConstructor
2720
2720
  });
2721
2721
 
2722
- // `GetIteratorDirect(obj)` abstract operation
2723
- // https://tc39.es/proposal-iterator-helpers/#sec-getiteratordirect
2724
- var getIteratorDirect$7 = function (obj) {
2725
- return {
2726
- iterator: obj,
2727
- next: obj.next,
2728
- done: false
2722
+ var uncurryThis$a = functionUncurryThisClause;
2723
+ var aCallable$d = aCallable$g;
2724
+ var NATIVE_BIND = functionBindNative;
2725
+
2726
+ var bind$5 = uncurryThis$a(uncurryThis$a.bind);
2727
+
2728
+ // optional / simple context binding
2729
+ var functionBindContext = function (fn, that) {
2730
+ aCallable$d(fn);
2731
+ return that === undefined ? fn : NATIVE_BIND ? bind$5(fn, that) : function (/* ...args */) {
2732
+ return fn.apply(that, arguments);
2729
2733
  };
2730
2734
  };
2731
2735
 
2732
- var defineBuiltIn$3 = defineBuiltIn$9;
2736
+ var wellKnownSymbol$8 = wellKnownSymbol$m;
2737
+ var Iterators$1 = iterators;
2733
2738
 
2734
- var defineBuiltIns$1 = function (target, src, options) {
2735
- for (var key in src) defineBuiltIn$3(target, key, src[key], options);
2736
- return target;
2739
+ var ITERATOR$3 = wellKnownSymbol$8('iterator');
2740
+ var ArrayPrototype = Array.prototype;
2741
+
2742
+ // check on default Array iterator
2743
+ var isArrayIteratorMethod$1 = function (it) {
2744
+ return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$3] === it);
2745
+ };
2746
+
2747
+ var classof$5 = classof$9;
2748
+ var getMethod$3 = getMethod$6;
2749
+ var isNullOrUndefined$2 = isNullOrUndefined$6;
2750
+ var Iterators = iterators;
2751
+ var wellKnownSymbol$7 = wellKnownSymbol$m;
2752
+
2753
+ var ITERATOR$2 = wellKnownSymbol$7('iterator');
2754
+
2755
+ var getIteratorMethod$2 = function (it) {
2756
+ if (!isNullOrUndefined$2(it)) return getMethod$3(it, ITERATOR$2)
2757
+ || getMethod$3(it, '@@iterator')
2758
+ || Iterators[classof$5(it)];
2737
2759
  };
2738
2760
 
2739
2761
  var call$a = functionCall;
2762
+ var aCallable$c = aCallable$g;
2740
2763
  var anObject$d = anObject$o;
2741
- var getMethod$3 = getMethod$6;
2764
+ var tryToString$2 = tryToString$4;
2765
+ var getIteratorMethod$1 = getIteratorMethod$2;
2766
+
2767
+ var $TypeError$9 = TypeError;
2768
+
2769
+ var getIterator$1 = function (argument, usingIterator) {
2770
+ var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
2771
+ if (aCallable$c(iteratorMethod)) return anObject$d(call$a(iteratorMethod, argument));
2772
+ throw new $TypeError$9(tryToString$2(argument) + ' is not iterable');
2773
+ };
2774
+
2775
+ var call$9 = functionCall;
2776
+ var anObject$c = anObject$o;
2777
+ var getMethod$2 = getMethod$6;
2742
2778
 
2743
2779
  var iteratorClose$3 = function (iterator, kind, value) {
2744
2780
  var innerResult, innerError;
2745
- anObject$d(iterator);
2781
+ anObject$c(iterator);
2746
2782
  try {
2747
- innerResult = getMethod$3(iterator, 'return');
2783
+ innerResult = getMethod$2(iterator, 'return');
2748
2784
  if (!innerResult) {
2749
2785
  if (kind === 'throw') throw value;
2750
2786
  return value;
2751
2787
  }
2752
- innerResult = call$a(innerResult, iterator);
2788
+ innerResult = call$9(innerResult, iterator);
2753
2789
  } catch (error) {
2754
2790
  innerError = true;
2755
2791
  innerResult = error;
2756
2792
  }
2757
2793
  if (kind === 'throw') throw value;
2758
2794
  if (innerError) throw innerResult;
2759
- anObject$d(innerResult);
2795
+ anObject$c(innerResult);
2760
2796
  return value;
2761
2797
  };
2762
2798
 
2763
- var call$9 = functionCall;
2799
+ var bind$4 = functionBindContext;
2800
+ var call$8 = functionCall;
2801
+ var anObject$b = anObject$o;
2802
+ var tryToString$1 = tryToString$4;
2803
+ var isArrayIteratorMethod = isArrayIteratorMethod$1;
2804
+ var lengthOfArrayLike$4 = lengthOfArrayLike$7;
2805
+ var isPrototypeOf$2 = objectIsPrototypeOf;
2806
+ var getIterator = getIterator$1;
2807
+ var getIteratorMethod = getIteratorMethod$2;
2808
+ var iteratorClose$2 = iteratorClose$3;
2809
+
2810
+ var $TypeError$8 = TypeError;
2811
+
2812
+ var Result = function (stopped, result) {
2813
+ this.stopped = stopped;
2814
+ this.result = result;
2815
+ };
2816
+
2817
+ var ResultPrototype = Result.prototype;
2818
+
2819
+ var iterate$8 = function (iterable, unboundFunction, options) {
2820
+ var that = options && options.that;
2821
+ var AS_ENTRIES = !!(options && options.AS_ENTRIES);
2822
+ var IS_RECORD = !!(options && options.IS_RECORD);
2823
+ var IS_ITERATOR = !!(options && options.IS_ITERATOR);
2824
+ var INTERRUPTED = !!(options && options.INTERRUPTED);
2825
+ var fn = bind$4(unboundFunction, that);
2826
+ var iterator, iterFn, index, length, result, next, step;
2827
+
2828
+ var stop = function (condition) {
2829
+ if (iterator) iteratorClose$2(iterator, 'normal', condition);
2830
+ return new Result(true, condition);
2831
+ };
2832
+
2833
+ var callFn = function (value) {
2834
+ if (AS_ENTRIES) {
2835
+ anObject$b(value);
2836
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
2837
+ } return INTERRUPTED ? fn(value, stop) : fn(value);
2838
+ };
2839
+
2840
+ if (IS_RECORD) {
2841
+ iterator = iterable.iterator;
2842
+ } else if (IS_ITERATOR) {
2843
+ iterator = iterable;
2844
+ } else {
2845
+ iterFn = getIteratorMethod(iterable);
2846
+ if (!iterFn) throw new $TypeError$8(tryToString$1(iterable) + ' is not iterable');
2847
+ // optimisation for array iterators
2848
+ if (isArrayIteratorMethod(iterFn)) {
2849
+ for (index = 0, length = lengthOfArrayLike$4(iterable); length > index; index++) {
2850
+ result = callFn(iterable[index]);
2851
+ if (result && isPrototypeOf$2(ResultPrototype, result)) return result;
2852
+ } return new Result(false);
2853
+ }
2854
+ iterator = getIterator(iterable, iterFn);
2855
+ }
2856
+
2857
+ next = IS_RECORD ? iterable.next : iterator.next;
2858
+ while (!(step = call$8(next, iterator)).done) {
2859
+ try {
2860
+ result = callFn(step.value);
2861
+ } catch (error) {
2862
+ iteratorClose$2(iterator, 'throw', error);
2863
+ }
2864
+ if (typeof result == 'object' && result && isPrototypeOf$2(ResultPrototype, result)) return result;
2865
+ } return new Result(false);
2866
+ };
2867
+
2868
+ // `GetIteratorDirect(obj)` abstract operation
2869
+ // https://tc39.es/proposal-iterator-helpers/#sec-getiteratordirect
2870
+ var getIteratorDirect$7 = function (obj) {
2871
+ return {
2872
+ iterator: obj,
2873
+ next: obj.next,
2874
+ done: false
2875
+ };
2876
+ };
2877
+
2878
+ var $$n = _export;
2879
+ var iterate$7 = iterate$8;
2880
+ var aCallable$b = aCallable$g;
2881
+ var anObject$a = anObject$o;
2882
+ var getIteratorDirect$6 = getIteratorDirect$7;
2883
+
2884
+ // `Iterator.prototype.find` method
2885
+ // https://github.com/tc39/proposal-iterator-helpers
2886
+ $$n({ target: 'Iterator', proto: true, real: true }, {
2887
+ find: function find(predicate) {
2888
+ anObject$a(this);
2889
+ aCallable$b(predicate);
2890
+ var record = getIteratorDirect$6(this);
2891
+ var counter = 0;
2892
+ return iterate$7(record, function (value, stop) {
2893
+ if (predicate(value, counter++)) return stop(value);
2894
+ }, { IS_RECORD: true, INTERRUPTED: true }).result;
2895
+ }
2896
+ });
2897
+
2898
+ var defineBuiltIn$3 = defineBuiltIn$9;
2899
+
2900
+ var defineBuiltIns$1 = function (target, src, options) {
2901
+ for (var key in src) defineBuiltIn$3(target, key, src[key], options);
2902
+ return target;
2903
+ };
2904
+
2905
+ var call$7 = functionCall;
2764
2906
  var create$1 = objectCreate;
2765
2907
  var createNonEnumerableProperty$1 = createNonEnumerableProperty$a;
2766
2908
  var defineBuiltIns = defineBuiltIns$1;
2767
- var wellKnownSymbol$8 = wellKnownSymbol$m;
2909
+ var wellKnownSymbol$6 = wellKnownSymbol$m;
2768
2910
  var InternalStateModule$1 = internalState;
2769
- var getMethod$2 = getMethod$6;
2911
+ var getMethod$1 = getMethod$6;
2770
2912
  var IteratorPrototype = iteratorsCore.IteratorPrototype;
2771
2913
  var createIterResultObject = createIterResultObject$2;
2772
- var iteratorClose$2 = iteratorClose$3;
2914
+ var iteratorClose$1 = iteratorClose$3;
2773
2915
 
2774
- var TO_STRING_TAG = wellKnownSymbol$8('toStringTag');
2916
+ var TO_STRING_TAG = wellKnownSymbol$6('toStringTag');
2775
2917
  var ITERATOR_HELPER = 'IteratorHelper';
2776
2918
  var WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator';
2777
2919
  var setInternalState$1 = InternalStateModule$1.set;
@@ -2799,15 +2941,15 @@ var createIteratorProxyPrototype = function (IS_ITERATOR) {
2799
2941
  var iterator = state.iterator;
2800
2942
  state.done = true;
2801
2943
  if (IS_ITERATOR) {
2802
- var returnMethod = getMethod$2(iterator, 'return');
2803
- return returnMethod ? call$9(returnMethod, iterator) : createIterResultObject(undefined, true);
2944
+ var returnMethod = getMethod$1(iterator, 'return');
2945
+ return returnMethod ? call$7(returnMethod, iterator) : createIterResultObject(undefined, true);
2804
2946
  }
2805
2947
  if (state.inner) try {
2806
- iteratorClose$2(state.inner.iterator, 'normal');
2948
+ iteratorClose$1(state.inner.iterator, 'normal');
2807
2949
  } catch (error) {
2808
- return iteratorClose$2(iterator, 'throw', error);
2950
+ return iteratorClose$1(iterator, 'throw', error);
2809
2951
  }
2810
- iteratorClose$2(iterator, 'normal');
2952
+ iteratorClose$1(iterator, 'normal');
2811
2953
  return createIterResultObject(undefined, true);
2812
2954
  }
2813
2955
  });
@@ -2836,28 +2978,28 @@ var iteratorCreateProxy = function (nextHandler, IS_ITERATOR) {
2836
2978
  return IteratorProxy;
2837
2979
  };
2838
2980
 
2839
- var anObject$c = anObject$o;
2840
- var iteratorClose$1 = iteratorClose$3;
2981
+ var anObject$9 = anObject$o;
2982
+ var iteratorClose = iteratorClose$3;
2841
2983
 
2842
2984
  // call something on iterator step with safe closing on error
2843
2985
  var callWithSafeIterationClosing$2 = function (iterator, fn, value, ENTRIES) {
2844
2986
  try {
2845
- return ENTRIES ? fn(anObject$c(value)[0], value[1]) : fn(value);
2987
+ return ENTRIES ? fn(anObject$9(value)[0], value[1]) : fn(value);
2846
2988
  } catch (error) {
2847
- iteratorClose$1(iterator, 'throw', error);
2989
+ iteratorClose(iterator, 'throw', error);
2848
2990
  }
2849
2991
  };
2850
2992
 
2851
- var call$8 = functionCall;
2852
- var aCallable$d = aCallable$g;
2853
- var anObject$b = anObject$o;
2854
- var getIteratorDirect$6 = getIteratorDirect$7;
2993
+ var call$6 = functionCall;
2994
+ var aCallable$a = aCallable$g;
2995
+ var anObject$8 = anObject$o;
2996
+ var getIteratorDirect$5 = getIteratorDirect$7;
2855
2997
  var createIteratorProxy$1 = iteratorCreateProxy;
2856
2998
  var callWithSafeIterationClosing$1 = callWithSafeIterationClosing$2;
2857
2999
 
2858
3000
  var IteratorProxy$1 = createIteratorProxy$1(function () {
2859
3001
  var iterator = this.iterator;
2860
- var result = anObject$b(call$8(this.next, iterator));
3002
+ var result = anObject$8(call$6(this.next, iterator));
2861
3003
  var done = this.done = !!result.done;
2862
3004
  if (!done) return callWithSafeIterationClosing$1(iterator, this.mapper, [result.value, this.counter++], true);
2863
3005
  });
@@ -2865,20 +3007,20 @@ var IteratorProxy$1 = createIteratorProxy$1(function () {
2865
3007
  // `Iterator.prototype.map` method
2866
3008
  // https://github.com/tc39/proposal-iterator-helpers
2867
3009
  var iteratorMap = function map(mapper) {
2868
- anObject$b(this);
2869
- aCallable$d(mapper);
2870
- return new IteratorProxy$1(getIteratorDirect$6(this), {
3010
+ anObject$8(this);
3011
+ aCallable$a(mapper);
3012
+ return new IteratorProxy$1(getIteratorDirect$5(this), {
2871
3013
  mapper: mapper
2872
3014
  });
2873
3015
  };
2874
3016
 
2875
- var $$n = _export;
3017
+ var $$m = _export;
2876
3018
  var map = iteratorMap;
2877
3019
  var IS_PURE$1 = isPure;
2878
3020
 
2879
3021
  // `Iterator.prototype.map` method
2880
3022
  // https://github.com/tc39/proposal-iterator-helpers
2881
- $$n({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$1 }, {
3023
+ $$m({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$1 }, {
2882
3024
  map: map
2883
3025
  });
2884
3026
 
@@ -2950,6 +3092,28 @@ const validateSinWithLuhn = input => {
2950
3092
  }
2951
3093
  return sum % 10 === 0;
2952
3094
  };
3095
+ /**
3096
+ * Gets the required field in the If/Then json schema condition.
3097
+ * @param props - ControlProps
3098
+ * @returns - The required field name.
3099
+ */
3100
+ const getRequiredIfThen = props => {
3101
+ var _a, _b, _c, _d;
3102
+ const {
3103
+ path
3104
+ } = props;
3105
+ const rootSchema = props.rootSchema;
3106
+ let rootRequired = '';
3107
+ if ((rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.if) && rootSchema.then) {
3108
+ if (((_a = rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.then) === null || _a === void 0 ? void 0 : _a.required) && Array.isArray((_b = rootSchema.then) === null || _b === void 0 ? void 0 : _b.required)) {
3109
+ const foundRequired = (_d = (_c = rootSchema.then) === null || _c === void 0 ? void 0 : _c.required) === null || _d === void 0 ? void 0 : _d.find(req => req === path);
3110
+ if (foundRequired !== undefined) {
3111
+ rootRequired = foundRequired;
3112
+ }
3113
+ }
3114
+ }
3115
+ return rootRequired;
3116
+ };
2953
3117
  /**
2954
3118
  * Check if a required, defined input value is valid. Returns an appropriate
2955
3119
  * error message if not.
@@ -2965,7 +3129,7 @@ const checkFieldValidity = props => {
2965
3129
  uischema,
2966
3130
  schema
2967
3131
  } = props;
2968
- const labelToUpdate = (uischema === null || uischema === void 0 ? void 0 : uischema.scope) ? getLabelText(uischema === null || uischema === void 0 ? void 0 : uischema.scope, label) : label;
3132
+ const labelToUpdate = (uischema === null || uischema === void 0 ? void 0 : uischema.scope) ? convertToSentenceCase(getLabelText(uischema === null || uischema === void 0 ? void 0 : uischema.scope, label)) : label;
2969
3133
  const extraSchema = schema;
2970
3134
  if (extraSchema && data && (extraSchema === null || extraSchema === void 0 ? void 0 : extraSchema.title) === sinTitle) {
2971
3135
  if (data.length === 11 && !validateSinWithLuhn(data)) {
@@ -2974,7 +3138,8 @@ const checkFieldValidity = props => {
2974
3138
  return extraSchema.errorMessage;
2975
3139
  }
2976
3140
  }
2977
- if (required) {
3141
+ const rootRequired = getRequiredIfThen(props);
3142
+ if (required || rootRequired.length > 0) {
2978
3143
  if (schema) {
2979
3144
  if (isEmptyBoolean(schema, data)) {
2980
3145
  return `${labelToUpdate} is required`;
@@ -3043,11 +3208,11 @@ const convertToSentenceCase = input => {
3043
3208
  return firstWord.concat(newWords).join(' ');
3044
3209
  };
3045
3210
 
3046
- var $$m = _export;
3047
- var call$7 = functionCall;
3048
- var aCallable$c = aCallable$g;
3049
- var anObject$a = anObject$o;
3050
- var getIteratorDirect$5 = getIteratorDirect$7;
3211
+ var $$l = _export;
3212
+ var call$5 = functionCall;
3213
+ var aCallable$9 = aCallable$g;
3214
+ var anObject$7 = anObject$o;
3215
+ var getIteratorDirect$4 = getIteratorDirect$7;
3051
3216
  var createIteratorProxy = iteratorCreateProxy;
3052
3217
  var callWithSafeIterationClosing = callWithSafeIterationClosing$2;
3053
3218
  var IS_PURE = isPure;
@@ -3058,7 +3223,7 @@ var IteratorProxy = createIteratorProxy(function () {
3058
3223
  var next = this.next;
3059
3224
  var result, done, value;
3060
3225
  while (true) {
3061
- result = anObject$a(call$7(next, iterator));
3226
+ result = anObject$7(call$5(next, iterator));
3062
3227
  done = this.done = !!result.done;
3063
3228
  if (done) return;
3064
3229
  value = result.value;
@@ -3068,11 +3233,11 @@ var IteratorProxy = createIteratorProxy(function () {
3068
3233
 
3069
3234
  // `Iterator.prototype.filter` method
3070
3235
  // https://github.com/tc39/proposal-iterator-helpers
3071
- $$m({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
3236
+ $$l({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
3072
3237
  filter: function filter(predicate) {
3073
- anObject$a(this);
3074
- aCallable$c(predicate);
3075
- return new IteratorProxy(getIteratorDirect$5(this), {
3238
+ anObject$7(this);
3239
+ aCallable$9(predicate);
3240
+ return new IteratorProxy(getIteratorDirect$4(this), {
3076
3241
  predicate: predicate
3077
3242
  });
3078
3243
  }
@@ -3334,16 +3499,16 @@ const onChangeForNumericControl = props => {
3334
3499
  }
3335
3500
  };
3336
3501
 
3337
- let _$b = t => t,
3502
+ let _$a = t => t,
3338
3503
  _t$b,
3339
3504
  _t2$7;
3340
- styled.div(_t$b || (_t$b = _$b`
3505
+ styled.div(_t$b || (_t$b = _$a`
3341
3506
  height: 70vh;
3342
3507
  overflow-y: auto;
3343
3508
  padding-left: var(--goa-space-2xs);
3344
3509
  padding-right: var(--goa-space-2xs);
3345
3510
  `));
3346
- const Visible = styled.div(_t2$7 || (_t2$7 = _$b`
3511
+ const Visible = styled.div(_t2$7 || (_t2$7 = _$a`
3347
3512
  display: ${0};
3348
3513
  `), p => p.visible ? 'initial' : 'none');
3349
3514
 
@@ -3352,19 +3517,19 @@ const ADD_NO_ANONYMOUS_ACTION = 'jsonforms/register/no_anonymous';
3352
3517
  const ADD_DATALIST_ACTION = 'jsonforms/register/add_datalist_action';
3353
3518
  const ADD_REGISTER_DATA_ERROR = 'jsonforms/register/add_register_data_error';
3354
3519
 
3355
- var classof$5 = classofRaw$2;
3520
+ var classof$4 = classofRaw$2;
3356
3521
 
3357
3522
  // `IsArray` abstract operation
3358
3523
  // https://tc39.es/ecma262/#sec-isarray
3359
3524
  // eslint-disable-next-line es/no-array-isarray -- safe
3360
3525
  var isArray$4 = Array.isArray || function isArray(argument) {
3361
- return classof$5(argument) === 'Array';
3526
+ return classof$4(argument) === 'Array';
3362
3527
  };
3363
3528
 
3364
3529
  var DESCRIPTORS$5 = descriptors;
3365
3530
  var isArray$3 = isArray$4;
3366
3531
 
3367
- var $TypeError$9 = TypeError;
3532
+ var $TypeError$7 = TypeError;
3368
3533
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
3369
3534
  var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
3370
3535
 
@@ -3382,23 +3547,23 @@ var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS$5 && !function () {
3382
3547
 
3383
3548
  var arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
3384
3549
  if (isArray$3(O) && !getOwnPropertyDescriptor$2(O, 'length').writable) {
3385
- throw new $TypeError$9('Cannot set read only .length');
3550
+ throw new $TypeError$7('Cannot set read only .length');
3386
3551
  } return O.length = length;
3387
3552
  } : function (O, length) {
3388
3553
  return O.length = length;
3389
3554
  };
3390
3555
 
3391
- var $TypeError$8 = TypeError;
3556
+ var $TypeError$6 = TypeError;
3392
3557
  var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
3393
3558
 
3394
3559
  var doesNotExceedSafeInteger$2 = function (it) {
3395
- if (it > MAX_SAFE_INTEGER) throw $TypeError$8('Maximum allowed index exceeded');
3560
+ if (it > MAX_SAFE_INTEGER) throw $TypeError$6('Maximum allowed index exceeded');
3396
3561
  return it;
3397
3562
  };
3398
3563
 
3399
- var $$l = _export;
3564
+ var $$k = _export;
3400
3565
  var toObject$2 = toObject$8;
3401
- var lengthOfArrayLike$4 = lengthOfArrayLike$7;
3566
+ var lengthOfArrayLike$3 = lengthOfArrayLike$7;
3402
3567
  var setArrayLength = arraySetLength;
3403
3568
  var doesNotExceedSafeInteger$1 = doesNotExceedSafeInteger$2;
3404
3569
  var fails$8 = fails$t;
@@ -3422,11 +3587,11 @@ var FORCED$2 = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
3422
3587
 
3423
3588
  // `Array.prototype.push` method
3424
3589
  // https://tc39.es/ecma262/#sec-array.prototype.push
3425
- $$l({ target: 'Array', proto: true, arity: 1, forced: FORCED$2 }, {
3590
+ $$k({ target: 'Array', proto: true, arity: 1, forced: FORCED$2 }, {
3426
3591
  // eslint-disable-next-line no-unused-vars -- required for `.length`
3427
3592
  push: function push(item) {
3428
3593
  var O = toObject$2(this);
3429
- var len = lengthOfArrayLike$4(O);
3594
+ var len = lengthOfArrayLike$3(O);
3430
3595
  var argCount = arguments.length;
3431
3596
  doesNotExceedSafeInteger$1(len + argCount);
3432
3597
  for (var i = 0; i < argCount; i++) {
@@ -3473,7 +3638,7 @@ function registerReducer(state, action) {
3473
3638
  return state;
3474
3639
  }
3475
3640
 
3476
- var $$k = _export;
3641
+ var $$j = _export;
3477
3642
  var $includes = arrayIncludes.includes;
3478
3643
  var fails$7 = fails$t;
3479
3644
  var addToUnscopables$1 = addToUnscopables$4;
@@ -3486,7 +3651,7 @@ var BROKEN_ON_SPARSE = fails$7(function () {
3486
3651
 
3487
3652
  // `Array.prototype.includes` method
3488
3653
  // https://tc39.es/ecma262/#sec-array.prototype.includes
3489
- $$k({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
3654
+ $$j({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
3490
3655
  includes: function includes(el /* , fromIndex = 0 */) {
3491
3656
  return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
3492
3657
  }
@@ -3495,17 +3660,17 @@ $$k({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
3495
3660
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
3496
3661
  addToUnscopables$1('includes');
3497
3662
 
3498
- var uncurryThis$a = functionUncurryThis;
3663
+ var uncurryThis$9 = functionUncurryThis;
3499
3664
 
3500
- var arraySlice$2 = uncurryThis$a([].slice);
3665
+ var arraySlice$2 = uncurryThis$9([].slice);
3501
3666
 
3502
- var uncurryThis$9 = functionUncurryThis;
3667
+ var uncurryThis$8 = functionUncurryThis;
3503
3668
  var isArray$2 = isArray$4;
3504
3669
  var isCallable$7 = isCallable$r;
3505
- var classof$4 = classofRaw$2;
3670
+ var classof$3 = classofRaw$2;
3506
3671
  var toString$7 = toString$f;
3507
3672
 
3508
- var push = uncurryThis$9([].push);
3673
+ var push = uncurryThis$8([].push);
3509
3674
 
3510
3675
  var getJsonReplacerFunction = function (replacer) {
3511
3676
  if (isCallable$7(replacer)) return replacer;
@@ -3515,7 +3680,7 @@ var getJsonReplacerFunction = function (replacer) {
3515
3680
  for (var i = 0; i < rawLength; i++) {
3516
3681
  var element = replacer[i];
3517
3682
  if (typeof element == 'string') push(keys, element);
3518
- else if (typeof element == 'number' || classof$4(element) === 'Number' || classof$4(element) === 'String') push(keys, toString$7(element));
3683
+ else if (typeof element == 'number' || classof$3(element) === 'Number' || classof$3(element) === 'String') push(keys, toString$7(element));
3519
3684
  }
3520
3685
  var keysLength = keys.length;
3521
3686
  var root = true;
@@ -3529,11 +3694,11 @@ var getJsonReplacerFunction = function (replacer) {
3529
3694
  };
3530
3695
  };
3531
3696
 
3532
- var $$j = _export;
3697
+ var $$i = _export;
3533
3698
  var getBuiltIn$4 = getBuiltIn$9;
3534
3699
  var apply$1 = functionApply;
3535
- var call$6 = functionCall;
3536
- var uncurryThis$8 = functionUncurryThis;
3700
+ var call$4 = functionCall;
3701
+ var uncurryThis$7 = functionUncurryThis;
3537
3702
  var fails$6 = fails$t;
3538
3703
  var isCallable$6 = isCallable$r;
3539
3704
  var isSymbol = isSymbol$3;
@@ -3543,11 +3708,11 @@ var NATIVE_SYMBOL$1 = symbolConstructorDetection;
3543
3708
 
3544
3709
  var $String = String;
3545
3710
  var $stringify = getBuiltIn$4('JSON', 'stringify');
3546
- var exec$3 = uncurryThis$8(/./.exec);
3547
- var charAt$1 = uncurryThis$8(''.charAt);
3548
- var charCodeAt = uncurryThis$8(''.charCodeAt);
3549
- var replace$3 = uncurryThis$8(''.replace);
3550
- var numberToString = uncurryThis$8(1.0.toString);
3711
+ var exec$3 = uncurryThis$7(/./.exec);
3712
+ var charAt$1 = uncurryThis$7(''.charAt);
3713
+ var charCodeAt = uncurryThis$7(''.charCodeAt);
3714
+ var replace$3 = uncurryThis$7(''.replace);
3715
+ var numberToString = uncurryThis$7(1.0.toString);
3551
3716
 
3552
3717
  var tester = /[\uD800-\uDFFF]/g;
3553
3718
  var low = /^[\uD800-\uDBFF]$/;
@@ -3575,7 +3740,7 @@ var stringifyWithSymbolsFix = function (it, replacer) {
3575
3740
  if (!isCallable$6($replacer) && (it === undefined || isSymbol(it))) return; // IE8 returns string on undefined
3576
3741
  args[1] = function (key, value) {
3577
3742
  // some old implementations (like WebKit) could pass numbers as keys
3578
- if (isCallable$6($replacer)) value = call$6($replacer, this, $String(key), value);
3743
+ if (isCallable$6($replacer)) value = call$4($replacer, this, $String(key), value);
3579
3744
  if (!isSymbol(value)) return value;
3580
3745
  };
3581
3746
  return apply$1($stringify, null, args);
@@ -3592,7 +3757,7 @@ var fixIllFormed = function (match, offset, string) {
3592
3757
  if ($stringify) {
3593
3758
  // `JSON.stringify` method
3594
3759
  // https://tc39.es/ecma262/#sec-json.stringify
3595
- $$j({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
3760
+ $$i({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
3596
3761
  // eslint-disable-next-line no-unused-vars -- required for `.length`
3597
3762
  stringify: function stringify(it, replacer, space) {
3598
3763
  var args = arraySlice$1(arguments);
@@ -3602,18 +3767,18 @@ if ($stringify) {
3602
3767
  });
3603
3768
  }
3604
3769
 
3605
- var $$i = _export;
3606
- var uncurryThis$7 = functionUncurryThis;
3770
+ var $$h = _export;
3771
+ var uncurryThis$6 = functionUncurryThis;
3607
3772
  var notARegExp$1 = notARegexp;
3608
3773
  var requireObjectCoercible$3 = requireObjectCoercible$b;
3609
3774
  var toString$6 = toString$f;
3610
3775
  var correctIsRegExpLogic$1 = correctIsRegexpLogic;
3611
3776
 
3612
- var stringIndexOf$1 = uncurryThis$7(''.indexOf);
3777
+ var stringIndexOf$1 = uncurryThis$6(''.indexOf);
3613
3778
 
3614
3779
  // `String.prototype.includes` method
3615
3780
  // https://tc39.es/ecma262/#sec-string.prototype.includes
3616
- $$i({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes') }, {
3781
+ $$h({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes') }, {
3617
3782
  includes: function includes(searchString /* , position = 0 */) {
3618
3783
  return !!~stringIndexOf$1(
3619
3784
  toString$6(requireObjectCoercible$3(this)),
@@ -3623,148 +3788,6 @@ $$i({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes')
3623
3788
  }
3624
3789
  });
3625
3790
 
3626
- var uncurryThis$6 = functionUncurryThisClause;
3627
- var aCallable$b = aCallable$g;
3628
- var NATIVE_BIND = functionBindNative;
3629
-
3630
- var bind$5 = uncurryThis$6(uncurryThis$6.bind);
3631
-
3632
- // optional / simple context binding
3633
- var functionBindContext = function (fn, that) {
3634
- aCallable$b(fn);
3635
- return that === undefined ? fn : NATIVE_BIND ? bind$5(fn, that) : function (/* ...args */) {
3636
- return fn.apply(that, arguments);
3637
- };
3638
- };
3639
-
3640
- var wellKnownSymbol$7 = wellKnownSymbol$m;
3641
- var Iterators$1 = iterators;
3642
-
3643
- var ITERATOR$3 = wellKnownSymbol$7('iterator');
3644
- var ArrayPrototype = Array.prototype;
3645
-
3646
- // check on default Array iterator
3647
- var isArrayIteratorMethod$1 = function (it) {
3648
- return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$3] === it);
3649
- };
3650
-
3651
- var classof$3 = classof$9;
3652
- var getMethod$1 = getMethod$6;
3653
- var isNullOrUndefined$2 = isNullOrUndefined$6;
3654
- var Iterators = iterators;
3655
- var wellKnownSymbol$6 = wellKnownSymbol$m;
3656
-
3657
- var ITERATOR$2 = wellKnownSymbol$6('iterator');
3658
-
3659
- var getIteratorMethod$2 = function (it) {
3660
- if (!isNullOrUndefined$2(it)) return getMethod$1(it, ITERATOR$2)
3661
- || getMethod$1(it, '@@iterator')
3662
- || Iterators[classof$3(it)];
3663
- };
3664
-
3665
- var call$5 = functionCall;
3666
- var aCallable$a = aCallable$g;
3667
- var anObject$9 = anObject$o;
3668
- var tryToString$2 = tryToString$4;
3669
- var getIteratorMethod$1 = getIteratorMethod$2;
3670
-
3671
- var $TypeError$7 = TypeError;
3672
-
3673
- var getIterator$1 = function (argument, usingIterator) {
3674
- var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
3675
- if (aCallable$a(iteratorMethod)) return anObject$9(call$5(iteratorMethod, argument));
3676
- throw new $TypeError$7(tryToString$2(argument) + ' is not iterable');
3677
- };
3678
-
3679
- var bind$4 = functionBindContext;
3680
- var call$4 = functionCall;
3681
- var anObject$8 = anObject$o;
3682
- var tryToString$1 = tryToString$4;
3683
- var isArrayIteratorMethod = isArrayIteratorMethod$1;
3684
- var lengthOfArrayLike$3 = lengthOfArrayLike$7;
3685
- var isPrototypeOf$2 = objectIsPrototypeOf;
3686
- var getIterator = getIterator$1;
3687
- var getIteratorMethod = getIteratorMethod$2;
3688
- var iteratorClose = iteratorClose$3;
3689
-
3690
- var $TypeError$6 = TypeError;
3691
-
3692
- var Result = function (stopped, result) {
3693
- this.stopped = stopped;
3694
- this.result = result;
3695
- };
3696
-
3697
- var ResultPrototype = Result.prototype;
3698
-
3699
- var iterate$8 = function (iterable, unboundFunction, options) {
3700
- var that = options && options.that;
3701
- var AS_ENTRIES = !!(options && options.AS_ENTRIES);
3702
- var IS_RECORD = !!(options && options.IS_RECORD);
3703
- var IS_ITERATOR = !!(options && options.IS_ITERATOR);
3704
- var INTERRUPTED = !!(options && options.INTERRUPTED);
3705
- var fn = bind$4(unboundFunction, that);
3706
- var iterator, iterFn, index, length, result, next, step;
3707
-
3708
- var stop = function (condition) {
3709
- if (iterator) iteratorClose(iterator, 'normal', condition);
3710
- return new Result(true, condition);
3711
- };
3712
-
3713
- var callFn = function (value) {
3714
- if (AS_ENTRIES) {
3715
- anObject$8(value);
3716
- return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
3717
- } return INTERRUPTED ? fn(value, stop) : fn(value);
3718
- };
3719
-
3720
- if (IS_RECORD) {
3721
- iterator = iterable.iterator;
3722
- } else if (IS_ITERATOR) {
3723
- iterator = iterable;
3724
- } else {
3725
- iterFn = getIteratorMethod(iterable);
3726
- if (!iterFn) throw new $TypeError$6(tryToString$1(iterable) + ' is not iterable');
3727
- // optimisation for array iterators
3728
- if (isArrayIteratorMethod(iterFn)) {
3729
- for (index = 0, length = lengthOfArrayLike$3(iterable); length > index; index++) {
3730
- result = callFn(iterable[index]);
3731
- if (result && isPrototypeOf$2(ResultPrototype, result)) return result;
3732
- } return new Result(false);
3733
- }
3734
- iterator = getIterator(iterable, iterFn);
3735
- }
3736
-
3737
- next = IS_RECORD ? iterable.next : iterator.next;
3738
- while (!(step = call$4(next, iterator)).done) {
3739
- try {
3740
- result = callFn(step.value);
3741
- } catch (error) {
3742
- iteratorClose(iterator, 'throw', error);
3743
- }
3744
- if (typeof result == 'object' && result && isPrototypeOf$2(ResultPrototype, result)) return result;
3745
- } return new Result(false);
3746
- };
3747
-
3748
- var $$h = _export;
3749
- var iterate$7 = iterate$8;
3750
- var aCallable$9 = aCallable$g;
3751
- var anObject$7 = anObject$o;
3752
- var getIteratorDirect$4 = getIteratorDirect$7;
3753
-
3754
- // `Iterator.prototype.find` method
3755
- // https://github.com/tc39/proposal-iterator-helpers
3756
- $$h({ target: 'Iterator', proto: true, real: true }, {
3757
- find: function find(predicate) {
3758
- anObject$7(this);
3759
- aCallable$9(predicate);
3760
- var record = getIteratorDirect$4(this);
3761
- var counter = 0;
3762
- return iterate$7(record, function (value, stop) {
3763
- if (predicate(value, counter++)) return stop(value);
3764
- }, { IS_RECORD: true, INTERRUPTED: true }).result;
3765
- }
3766
- });
3767
-
3768
3791
  var $$g = _export;
3769
3792
  var iterate$6 = iterate$8;
3770
3793
  var aCallable$8 = aCallable$g;
@@ -4276,7 +4299,7 @@ const JsonFormRegisterProvider = ({
4276
4299
  });
4277
4300
  };
4278
4301
 
4279
- let _$a = t => t,
4302
+ let _$9 = t => t,
4280
4303
  _t$a,
4281
4304
  _t2$6,
4282
4305
  _t3$5,
@@ -4285,42 +4308,42 @@ let _$a = t => t,
4285
4308
  _t6$3,
4286
4309
  _t7$2,
4287
4310
  _t8$2;
4288
- const FormFieldWrapper = styled.div(_t$a || (_t$a = _$a`
4311
+ const FormFieldWrapper = styled.div(_t$a || (_t$a = _$9`
4289
4312
  margin-bottom: var(--goa-space-l);
4290
4313
  `));
4291
- const WarningIconDiv = styled.div(_t2$6 || (_t2$6 = _$a`
4314
+ const WarningIconDiv = styled.div(_t2$6 || (_t2$6 = _$9`
4292
4315
  display: inline-flex;
4293
4316
  align-items: flex-start;
4294
4317
  gap: 0.25rem;
4295
4318
  font-size: var(--goa-font-size-2);
4296
4319
  color: var(--goa-color-interactive-error);
4297
4320
  `));
4298
- const RequiredTextLabel = styled.label(_t3$5 || (_t3$5 = _$a`
4321
+ const RequiredTextLabel = styled.label(_t3$5 || (_t3$5 = _$9`
4299
4322
  color: var(--goa-color-greyscale-700);
4300
4323
  font-weight: var(--goa-font-weight-regular);
4301
4324
  font-size: var(--goa-font-size-2);
4302
4325
  line-height: var(--goa-line-height-1);
4303
4326
  font-style: normal;
4304
4327
  `));
4305
- const PageReviewNameCol = styled.td(_t4$5 || (_t4$5 = _$a`
4328
+ const PageReviewNameCol = styled.td(_t4$5 || (_t4$5 = _$9`
4306
4329
  width: 5%;
4307
4330
  padding-top: var(--goa-space-s);
4308
4331
  padding-bottom: var(--goa-space-s);
4309
4332
  padding-right: var(--goa-space-m);
4310
4333
  `));
4311
- const PageReviewValueCol = styled.td(_t5$3 || (_t5$3 = _$a`
4334
+ const PageReviewValueCol = styled.td(_t5$3 || (_t5$3 = _$9`
4312
4335
  width: 20%;
4313
4336
  text-align: left;
4314
4337
  `));
4315
4338
  //Check and unchecked are different heights otherwise
4316
- const CheckboxWrapper = styled.div(_t6$3 || (_t6$3 = _$a`
4339
+ const CheckboxWrapper = styled.div(_t6$3 || (_t6$3 = _$9`
4317
4340
  height: 28px;
4318
4341
  `));
4319
- styled.h4(_t7$2 || (_t7$2 = _$a`
4342
+ styled.h4(_t7$2 || (_t7$2 = _$9`
4320
4343
  margin: 0 0 0.25rem 0;
4321
4344
  fontsize: larger;
4322
4345
  `));
4323
- styled.h4(_t8$2 || (_t8$2 = _$a`
4346
+ styled.h4(_t8$2 || (_t8$2 = _$9`
4324
4347
  border-bottom: 1px solid #ddd;
4325
4348
  `));
4326
4349
 
@@ -4332,6 +4355,7 @@ const GoAInputBaseControl = props => {
4332
4355
  label,
4333
4356
  input,
4334
4357
  required,
4358
+ errors,
4335
4359
  path,
4336
4360
  isStepperReview,
4337
4361
  skipInitialValidation
@@ -4349,7 +4373,7 @@ const GoAInputBaseControl = props => {
4349
4373
  visible: visible,
4350
4374
  children: jsx(FormFieldWrapper, {
4351
4375
  children: jsx(GoAFormItem, {
4352
- requirement: required ? 'required' : undefined,
4376
+ requirement: required || getRequiredIfThen(props).length > 0 ? 'required' : undefined,
4353
4377
  error: isVisited === true ? modifiedErrors : undefined,
4354
4378
  testId: `${isStepperReview === true && 'review-base-'}${path}`,
4355
4379
  label: (props === null || props === void 0 ? void 0 : props.noLabel) === true ? '' : labelToUpdate,
@@ -4544,12 +4568,12 @@ const SPACE_KEY = ' ';
4544
4568
  const ALT_KEY = 'Alt';
4545
4569
  const SHIFT_KEY = 'Shift';
4546
4570
 
4547
- let _$9 = t => t,
4571
+ let _$8 = t => t,
4548
4572
  _t$9,
4549
4573
  _t2$5,
4550
4574
  _t3$4,
4551
4575
  _t4$4;
4552
- const GoADropdownTextbox = styled.div(_t$9 || (_t$9 = _$9`
4576
+ const GoADropdownTextbox = styled.div(_t$9 || (_t$9 = _$8`
4553
4577
  border-radius: var(--goa-space-2xs);
4554
4578
  box-shadow: ${0};
4555
4579
  &:hover {
@@ -4560,11 +4584,11 @@ const GoADropdownTextbox = styled.div(_t$9 || (_t$9 = _$9`
4560
4584
  box-shadow: ${0};
4561
4585
  }
4562
4586
  `), p => p.isOpen ? `0 0 0 3px var(--goa-color-interactive-focus)` : '', p => p.isOpen ? `0 0 0 3px var(--goa-color-interactive-focus) !important` : '');
4563
- const GoADropdownListContainerWrapper = styled.div(_t2$5 || (_t2$5 = _$9`
4587
+ const GoADropdownListContainerWrapper = styled.div(_t2$5 || (_t2$5 = _$8`
4564
4588
  position: relative;
4565
4589
  display: ${0};
4566
4590
  `), p => !(p === null || p === void 0 ? void 0 : p.isOpen) && 'none');
4567
- const GoADropdownListContainer = styled.div(_t3$4 || (_t3$4 = _$9`
4591
+ const GoADropdownListContainer = styled.div(_t3$4 || (_t3$4 = _$8`
4568
4592
  border: solid 1px var(--goa-color-greyscale-200);
4569
4593
  border-radius: var(--goa-space-2xs);
4570
4594
  background: var(--goa-color-greyscale-white);
@@ -4588,7 +4612,7 @@ const GoADropdownListContainer = styled.div(_t3$4 || (_t3$4 = _$9`
4588
4612
  scrollbar-color: #a8a8a8 var(--goa-color-greyscale-100) !important;
4589
4613
  }
4590
4614
  `), p => p.optionListMaxHeight || '272px');
4591
- const GoADropdownListOption = styled.div(_t4$4 || (_t4$4 = _$9`
4615
+ const GoADropdownListOption = styled.div(_t4$4 || (_t4$4 = _$8`
4592
4616
  padding: var(--goa-space-2xs) var(--goa-space-s);
4593
4617
  text-overflow: ellipsis;
4594
4618
  color: ${0} !important;
@@ -5655,7 +5679,7 @@ const BooleanRadioControl = props => jsx(GoAInputBaseControl, Object.assign({},
5655
5679
  const GoABooleanRadioControlTester = rankWith(3, and(isBooleanControl, optionIs('radio', true)));
5656
5680
  const GoABooleanRadioControl = withJsonFormsControlProps(BooleanRadioControl);
5657
5681
 
5658
- let _$8 = t => t,
5682
+ let _$7 = t => t,
5659
5683
  _t$8;
5660
5684
  const Checkboxes = ({
5661
5685
  children,
@@ -5668,7 +5692,7 @@ const Checkboxes = ({
5668
5692
  children: children
5669
5693
  });
5670
5694
  };
5671
- const CheckBoxGroupDiv = styled.div(_t$8 || (_t$8 = _$8`
5695
+ const CheckBoxGroupDiv = styled.div(_t$8 || (_t$8 = _$7`
5672
5696
  .horizontal {
5673
5697
  display: flex;
5674
5698
  flex-direction: row;
@@ -5868,7 +5892,7 @@ const GoAInputBaseTableReview = props => {
5868
5892
  };
5869
5893
  const GoAInputBaseTableReviewControl = withJsonFormsControlProps(GoAInputBaseTableReview);
5870
5894
 
5871
- let _$7 = t => t,
5895
+ let _$6 = t => t,
5872
5896
  _t$7;
5873
5897
  const renderLayoutElements = (elements, schema, path, enabled, renderers, cells) => {
5874
5898
  return elements.map((child, index) => jsx(JsonFormsDispatch, {
@@ -5948,13 +5972,13 @@ const ReviewLayoutRenderer = ({
5948
5972
  }
5949
5973
  }
5950
5974
  };
5951
- const ReviewGrid = styled.div(_t$7 || (_t$7 = _$7`
5975
+ const ReviewGrid = styled.div(_t$7 || (_t$7 = _$6`
5952
5976
  display: grid;
5953
5977
  grid-template-columns: repeat(auto-fit, minmax(250px, calc(50% - 8px)));
5954
5978
  gap: 16px;
5955
5979
  `));
5956
5980
 
5957
- let _$6 = t => t,
5981
+ let _$5 = t => t,
5958
5982
  _t$6,
5959
5983
  _t2$4,
5960
5984
  _t3$3,
@@ -5977,7 +6001,7 @@ let _$6 = t => t,
5977
6001
  _t20$1,
5978
6002
  _t21,
5979
6003
  _t22;
5980
- const ReviewItem = styled.div(_t$6 || (_t$6 = _$6`
6004
+ const ReviewItem = styled.div(_t$6 || (_t$6 = _$5`
5981
6005
  display: flex;
5982
6006
  flex-direction: column;
5983
6007
  border: var(--goa-border-width-s) solid grey;
@@ -5988,7 +6012,7 @@ const ReviewItem = styled.div(_t$6 || (_t$6 = _$6`
5988
6012
  display: none;
5989
6013
  }
5990
6014
  `));
5991
- const ReviewItemSection = styled.div(_t2$4 || (_t2$4 = _$6`
6015
+ const ReviewItemSection = styled.div(_t2$4 || (_t2$4 = _$5`
5992
6016
  background-color: #f1f1f1;
5993
6017
  margin-bottom: var(--goa-space-m);
5994
6018
  padding: var(--goa-space-m);
@@ -5999,18 +6023,18 @@ const ReviewItemSection = styled.div(_t2$4 || (_t2$4 = _$6`
5999
6023
  max-width: 1600px;
6000
6024
  }
6001
6025
  `));
6002
- const ReviewItemHeader = styled.div(_t3$3 || (_t3$3 = _$6`
6026
+ const ReviewItemHeader = styled.div(_t3$3 || (_t3$3 = _$5`
6003
6027
  display: flex;
6004
6028
  align-items: center;
6005
6029
  justify-content: space-between;
6006
6030
  margin-bottom: var(--goa-space-xl);
6007
6031
  `));
6008
- const ReviewItemTitle = styled.div(_t4$3 || (_t4$3 = _$6`
6032
+ const ReviewItemTitle = styled.div(_t4$3 || (_t4$3 = _$5`
6009
6033
  font-size: var(--goa-space-l);
6010
6034
  line-height: var(--goa-space-xl);
6011
6035
  font-weight: 300;
6012
6036
  `));
6013
- const Anchor = styled.div(_t5$2 || (_t5$2 = _$6`
6037
+ const Anchor = styled.div(_t5$2 || (_t5$2 = _$5`
6014
6038
  color: #0070c4;
6015
6039
  text-decoration: underline;
6016
6040
  outline: none;
@@ -6021,20 +6045,20 @@ const Anchor = styled.div(_t5$2 || (_t5$2 = _$6`
6021
6045
  background-color: #e6f7ff;
6022
6046
  }
6023
6047
  `));
6024
- styled.div(_t6$2 || (_t6$2 = _$6`
6048
+ styled.div(_t6$2 || (_t6$2 = _$5`
6025
6049
  margin-left: var(--goa-space-m);
6026
6050
  `));
6027
- styled.div(_t7$1 || (_t7$1 = _$6`
6051
+ styled.div(_t7$1 || (_t7$1 = _$5`
6028
6052
  margin-bottom: var(--goa-space-m);
6029
6053
  `));
6030
- styled.div(_t8$1 || (_t8$1 = _$6`
6054
+ styled.div(_t8$1 || (_t8$1 = _$5`
6031
6055
  margin: var(--goa-space-s);
6032
6056
  width: 100%;
6033
6057
  `));
6034
- styled.h3(_t9$1 || (_t9$1 = _$6`
6058
+ styled.h3(_t9$1 || (_t9$1 = _$5`
6035
6059
  text-transform: capitalize;
6036
6060
  `));
6037
- const RightAlignmentDiv = styled.div(_t10$1 || (_t10$1 = _$6`
6061
+ const RightAlignmentDiv = styled.div(_t10$1 || (_t10$1 = _$5`
6038
6062
  @media screen and (max-width: 767px) {
6039
6063
  margin-bottom: var(--goa-space-l);
6040
6064
  }
@@ -6044,57 +6068,57 @@ const RightAlignmentDiv = styled.div(_t10$1 || (_t10$1 = _$6`
6044
6068
  margin-bottom: var(--goa-space-l);
6045
6069
  }
6046
6070
  `));
6047
- const FormStepperSummaryH3 = styled.h3(_t11$1 || (_t11$1 = _$6`
6071
+ const FormStepperSummaryH3 = styled.h3(_t11$1 || (_t11$1 = _$5`
6048
6072
  flex: 1;
6049
6073
  margin-bottom: var(--goa-space-m);
6050
6074
  font-size: var(--goa-font-size-7);
6051
6075
  line-height: var(--goa-line-height-4);
6052
6076
  font-weight: var(--goa-font-weight-regular);
6053
6077
  `));
6054
- const PageRenderPadding = styled.div(_t12$1 || (_t12$1 = _$6`
6078
+ const PageRenderPadding = styled.div(_t12$1 || (_t12$1 = _$5`
6055
6079
  margin-top: var(--goa-space-2xl);
6056
6080
  `));
6057
- const PageBorder = styled.h3(_t13$1 || (_t13$1 = _$6`
6081
+ const PageBorder = styled.h3(_t13$1 || (_t13$1 = _$5`
6058
6082
  padding: var(--goa-space-3xl);
6059
6083
  `));
6060
- const TableReviewItemSection = styled.div(_t14$1 || (_t14$1 = _$6`
6084
+ const TableReviewItemSection = styled.div(_t14$1 || (_t14$1 = _$5`
6061
6085
  .element-style {
6062
6086
  max-width: 1600px;
6063
6087
  }
6064
6088
  `));
6065
- const TableReviewItem = styled.div(_t15$1 || (_t15$1 = _$6`
6089
+ const TableReviewItem = styled.div(_t15$1 || (_t15$1 = _$5`
6066
6090
  border: 1px solid #dcdcdc;
6067
6091
  border-radius: 5px;
6068
6092
  padding: var(--goa-space-2xl);
6069
6093
  `));
6070
- const TableReviewPageTitleRow = styled.div(_t16$1 || (_t16$1 = _$6`
6094
+ const TableReviewPageTitleRow = styled.div(_t16$1 || (_t16$1 = _$5`
6071
6095
  margin-top: var(--goa-space-xl);
6072
6096
  display: flex;
6073
6097
  justify-content: space-between;
6074
6098
  `));
6075
- const TableReviewCategoryLabel = styled.h3(_t17$1 || (_t17$1 = _$6`
6099
+ const TableReviewCategoryLabel = styled.h3(_t17$1 || (_t17$1 = _$5`
6076
6100
  color: var(--goa-color-text-secondary) !important;
6077
6101
  margin-bottom: var(--goa-space-l);
6078
6102
  `));
6079
- const CategoryStatus = styled.td(_t18$1 || (_t18$1 = _$6`
6103
+ const CategoryStatus = styled.td(_t18$1 || (_t18$1 = _$5`
6080
6104
  width: var(--goa-space-xl);
6081
6105
  padding-right: var(--goa-space-xl);
6082
6106
  `));
6083
- const TocPageRef = styled.td(_t19$1 || (_t19$1 = _$6`
6107
+ const TocPageRef = styled.td(_t19$1 || (_t19$1 = _$5`
6084
6108
  padding-left: var(--goa-space-xl);
6085
6109
  `));
6086
- const TocTitle = styled.h1(_t20$1 || (_t20$1 = _$6`
6110
+ const TocTitle = styled.h1(_t20$1 || (_t20$1 = _$5`
6087
6111
  padding: 0;
6088
6112
  margin: 0;
6089
6113
  padding-left: var(--goa-space-xl);
6090
6114
  padding-bottom: var(--goa-space-3xl);
6091
6115
  `));
6092
- const TocSubtitle = styled.h2(_t21 || (_t21 = _$6`
6116
+ const TocSubtitle = styled.h2(_t21 || (_t21 = _$5`
6093
6117
  padding: 0;
6094
6118
  margin: 0;
6095
6119
  padding-left: var(--goa-space-xl);
6096
6120
  `));
6097
- const CompletionStatus = styled.div(_t22 || (_t22 = _$6`
6121
+ const CompletionStatus = styled.div(_t22 || (_t22 = _$5`
6098
6122
  padding: 0;
6099
6123
  margin: 0;
6100
6124
  padding-left: var(--goa-space-xl);
@@ -6410,7 +6434,7 @@ const pickPropertyValues = (obj, property, endWithType) => {
6410
6434
  var _a;
6411
6435
  if (key === property) {
6412
6436
  values.push(obj[key]);
6413
- } else if (_$c.isObject(obj[key])) {
6437
+ } else if (_$b.isObject(obj[key])) {
6414
6438
  // if the object type is equal to end type, we are not going to continue the recursive approach
6415
6439
  if (endWithType && ((_a = obj[key]) === null || _a === void 0 ? void 0 : _a.type) === endWithType) {
6416
6440
  if (property in obj[key]) {
@@ -6419,7 +6443,7 @@ const pickPropertyValues = (obj, property, endWithType) => {
6419
6443
  } else {
6420
6444
  values = [...values, ...pickPropertyValues(obj[key], property, endWithType)];
6421
6445
  }
6422
- } else if (_$c.isArray(obj[key])) {
6446
+ } else if (_$b.isArray(obj[key])) {
6423
6447
  const nextValues = obj[key].map(function (arrayObj) {
6424
6448
  return pickPropertyValues(arrayObj, property, endWithType);
6425
6449
  });
@@ -7307,9 +7331,9 @@ const FormStepperPageReviewer = props => {
7307
7331
  };
7308
7332
  withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormStepperPageReviewer)));
7309
7333
 
7310
- let _$5 = t => t,
7334
+ let _$4 = t => t,
7311
7335
  _t$5;
7312
- const BackButtonWrapper = styled.span(_t$5 || (_t$5 = _$5`
7336
+ const BackButtonWrapper = styled.span(_t$5 || (_t$5 = _$4`
7313
7337
  .back-link::before {
7314
7338
  content: '';
7315
7339
  display: inline-block;
@@ -7561,7 +7585,7 @@ const CategorizationPagesRendererTester = rankWith(2, and(uiTypeIs('Categorizati
7561
7585
  return ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.variant) === 'pages';
7562
7586
  }));
7563
7587
 
7564
- let _$4 = t => t,
7588
+ let _$3 = t => t,
7565
7589
  _t$4;
7566
7590
  const GoAContextMenuIcon = props => {
7567
7591
  return jsx(GoAIconButton, {
@@ -7573,7 +7597,7 @@ const GoAContextMenuIcon = props => {
7573
7597
  disabled: props.disabled
7574
7598
  });
7575
7599
  };
7576
- const GoAContextMenu = styled.div(_t$4 || (_t$4 = _$4`
7600
+ const GoAContextMenu = styled.div(_t$4 || (_t$4 = _$3`
7577
7601
  display: flex;
7578
7602
  align-items: center;
7579
7603
  background-color: #fff;
@@ -7620,7 +7644,7 @@ const DeleteFileModal = ({
7620
7644
  });
7621
7645
  };
7622
7646
 
7623
- let _$3 = t => t,
7647
+ let _2 = t => t,
7624
7648
  _t$3,
7625
7649
  _t2$3,
7626
7650
  _t3$2,
@@ -7633,7 +7657,7 @@ const FileUploaderReview = props => {
7633
7657
  }));
7634
7658
  };
7635
7659
  const FileUploader = _a => {
7636
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
7660
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
7637
7661
  var {
7638
7662
  data,
7639
7663
  path,
@@ -7661,7 +7685,8 @@ const FileUploader = _a => {
7661
7685
  } = props;
7662
7686
  const propertyId = i18nKeyPrefix;
7663
7687
  const variant = ((_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.variant) || 'button';
7664
- const [showFileDeleteConfirmation, setShowFileDeleteConfirmation] = useState(false);
7688
+ const multiFileUploader = variant === 'dragdrop';
7689
+ const [deleteHide, setDeleteHide] = useState(false);
7665
7690
  function uploadFile(file) {
7666
7691
  if (uploadTrigger) {
7667
7692
  uploadTrigger(file, propertyId);
@@ -7669,6 +7694,7 @@ const FileUploader = _a => {
7669
7694
  const value = ['Loading', Array.isArray(data) ? data[1] : file === null || file === void 0 ? void 0 : file.name];
7670
7695
  handleChange(propertyId, value);
7671
7696
  };
7697
+ setDeleteHide(false);
7672
7698
  setTimeout(handleFunction, DELAY_UPLOAD_TIMEOUT_MS);
7673
7699
  }
7674
7700
  }
@@ -7682,11 +7708,12 @@ const FileUploader = _a => {
7682
7708
  deleteTrigger(file, propertyId);
7683
7709
  }
7684
7710
  }
7685
- function getFileName() {
7686
- return fileList && fileList[props.i18nKeyPrefix].filename;
7711
+ function getFileName(index) {
7712
+ var _a;
7713
+ return fileList && fileList[props.i18nKeyPrefix] && ((_a = fileList[props.i18nKeyPrefix][index]) === null || _a === void 0 ? void 0 : _a.filename);
7687
7714
  }
7688
- function getFile() {
7689
- return fileList && fileList[props.i18nKeyPrefix];
7715
+ function getFile(index) {
7716
+ return fileList && fileList[props.i18nKeyPrefix] && fileList[props.i18nKeyPrefix][index];
7690
7717
  }
7691
7718
  useEffect(() => {
7692
7719
  // UseEffect is required because not having it causes a react update error, but
@@ -7708,6 +7735,55 @@ const FileUploader = _a => {
7708
7735
  }
7709
7736
  const helpText = (_p = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _p === void 0 ? void 0 : _p.help;
7710
7737
  const sentenceCaseLabel = convertToSentenceCase(label);
7738
+ const DownloadFileWidget = ({
7739
+ index
7740
+ }) => {
7741
+ var _a;
7742
+ const [showFileDeleteConfirmation, setShowFileDeleteConfirmation] = useState(false);
7743
+ return jsx("div", {
7744
+ children: readOnly && index ? jsxs(AttachmentBorderDisabled, {
7745
+ children: [getFileName(index), jsx(GoAContextMenuIcon, {
7746
+ testId: "download-icon",
7747
+ title: "Download",
7748
+ type: "download",
7749
+ onClick: () => downloadFile(getFile(index))
7750
+ })]
7751
+ }) : jsxs(AttachmentBorder, {
7752
+ children: [jsx("div", {
7753
+ children: getFileName(index)
7754
+ }), jsxs(GoAContextMenu, {
7755
+ children: [jsx(GoAContextMenuIcon, {
7756
+ testId: "download-icon",
7757
+ title: "Download",
7758
+ type: "download",
7759
+ onClick: () => downloadFile(getFile(index))
7760
+ }), jsx(GoAContextMenuIcon, {
7761
+ "data-testid": "delete-icon",
7762
+ title: "Delete",
7763
+ type: "trash",
7764
+ onClick: () => {
7765
+ setShowFileDeleteConfirmation(true);
7766
+ }
7767
+ })]
7768
+ }), jsx(DeleteFileModal, {
7769
+ isOpen: showFileDeleteConfirmation,
7770
+ title: "Delete file",
7771
+ content: `Delete file ${(_a = getFile(index)) === null || _a === void 0 ? void 0 : _a.filename} ?`,
7772
+ onCancel: () => setShowFileDeleteConfirmation(false),
7773
+ onDelete: () => {
7774
+ setShowFileDeleteConfirmation(false);
7775
+ deleteFile(getFile(index));
7776
+ setDeleteHide(true);
7777
+ const handleFunction = () => {
7778
+ handleChange(propertyId, '');
7779
+ };
7780
+ setTimeout(handleFunction, DELAY_DELETE_TIMEOUT_MS);
7781
+ }
7782
+ })]
7783
+ })
7784
+ });
7785
+ };
7786
+ const fileListLength = fileList && ((_q = fileList[props.i18nKeyPrefix]) === null || _q === void 0 ? void 0 : _q.length) || 0;
7711
7787
  return jsxs(FileUploaderStyle, {
7712
7788
  className: "FileUploader",
7713
7789
  children: [required ? jsx(GoAFormItem, {
@@ -7738,57 +7814,23 @@ const FileUploader = _a => {
7738
7814
  })
7739
7815
  })
7740
7816
  }) : jsx("div", {
7741
- children: fileList && getFile() && jsx("div", {
7742
- children: readOnly ? jsxs(AttachmentBorderDisabled, {
7743
- children: [getFileName(), ' ', jsx(GoAContextMenuIcon, {
7744
- testId: "download-icon",
7745
- title: "Download",
7746
- type: "download",
7747
- onClick: () => downloadFile(getFile())
7748
- })]
7749
- }) : jsxs(AttachmentBorder, {
7750
- children: [jsx("div", {
7751
- children: getFileName()
7752
- }), jsxs(GoAContextMenu, {
7753
- children: [jsx(GoAContextMenuIcon, {
7754
- testId: "download-icon",
7755
- title: "Download",
7756
- type: "download",
7757
- onClick: () => downloadFile(getFile())
7758
- }), jsx(GoAContextMenuIcon, {
7759
- "data-testid": "delete-icon",
7760
- title: "Delete",
7761
- type: "trash",
7762
- onClick: () => {
7763
- setShowFileDeleteConfirmation(true);
7764
- }
7765
- })]
7766
- }), jsx(DeleteFileModal, {
7767
- isOpen: showFileDeleteConfirmation,
7768
- title: "Delete file",
7769
- content: `Delete file ${getFile().filename} ?`,
7770
- onCancel: () => setShowFileDeleteConfirmation(false),
7771
- onDelete: () => {
7772
- setShowFileDeleteConfirmation(false);
7773
- deleteFile(getFile());
7774
- const handleFunction = () => {
7775
- handleChange(propertyId, '');
7776
- };
7777
- setTimeout(handleFunction, DELAY_DELETE_TIMEOUT_MS);
7778
- }
7779
- })]
7780
- })
7817
+ children: multiFileUploader ? fileList && (fileList[props.i18nKeyPrefix] || []).map((_, index) => {
7818
+ return jsx(DownloadFileWidget, {
7819
+ index: index
7820
+ });
7821
+ }) : fileList && !deleteHide && getFile(fileListLength - 1) && fileListLength >= 0 && jsx(DownloadFileWidget, {
7822
+ index: fileListLength - 1
7781
7823
  })
7782
7824
  })
7783
7825
  })]
7784
7826
  });
7785
7827
  };
7786
- const HelpText = styled.div(_t$3 || (_t$3 = _$3`
7828
+ const HelpText = styled.div(_t$3 || (_t$3 = _2`
7787
7829
  margin-top: var(--goa-space-xs);
7788
7830
  font-size: var(--goa-font-size-3);
7789
7831
  color: var(--goa-color-text-secondary);
7790
7832
  `));
7791
- const AttachmentBorderDisabled = styled.div(_t2$3 || (_t2$3 = _$3`
7833
+ const AttachmentBorderDisabled = styled.div(_t2$3 || (_t2$3 = _2`
7792
7834
  display: flex;
7793
7835
  flex-direction: row;
7794
7836
  border: var(--goa-border-width-s) solid #dcdcdc;
@@ -7797,7 +7839,7 @@ const AttachmentBorderDisabled = styled.div(_t2$3 || (_t2$3 = _$3`
7797
7839
  width: fit-content;
7798
7840
  background-color: #f1f1f1;
7799
7841
  `));
7800
- const AttachmentBorder = styled.div(_t3$2 || (_t3$2 = _$3`
7842
+ const AttachmentBorder = styled.div(_t3$2 || (_t3$2 = _2`
7801
7843
  display: flex;
7802
7844
  flex-direction: row;
7803
7845
  border: var(--goa-border-width-s) solid #dcdcdc;
@@ -7806,7 +7848,7 @@ const AttachmentBorder = styled.div(_t3$2 || (_t3$2 = _$3`
7806
7848
  width: fit-content;
7807
7849
  margin-top: var(--goa-space-2xs);
7808
7850
  `));
7809
- const FileUploaderStyle = styled.div(_t4$2 || (_t4$2 = _$3`
7851
+ const FileUploaderStyle = styled.div(_t4$2 || (_t4$2 = _2`
7810
7852
  margin-bottom: var(--goa-space-l);
7811
7853
  .label {
7812
7854
  display: block;
@@ -10124,7 +10166,7 @@ const AddressViews = ({
10124
10166
  gap: "s",
10125
10167
  children: [jsx(GoAFormItem, {
10126
10168
  label: "Address line 1",
10127
- error: (data === null || data === void 0 ? void 0 : data.addressLine1) === undefined ? 'addressLine1 is required' : '',
10169
+ error: (data === null || data === void 0 ? void 0 : data.addressLine1) === undefined ? 'Address line 1 is required' : '',
10128
10170
  requirement: "required",
10129
10171
  children: jsx(TextWrap, {
10130
10172
  children: data === null || data === void 0 ? void 0 : data.addressLine1
@@ -10139,14 +10181,14 @@ const AddressViews = ({
10139
10181
  minChildWidth: "0ch",
10140
10182
  gap: "s",
10141
10183
  children: [jsx(GoAFormItem, {
10142
- error: (data === null || data === void 0 ? void 0 : data.municipality) === undefined ? 'city is required' : '',
10184
+ error: (data === null || data === void 0 ? void 0 : data.municipality) === undefined ? 'City is required' : '',
10143
10185
  label: "City",
10144
10186
  requirement: "required",
10145
10187
  children: jsx(TextWrap, {
10146
10188
  children: data === null || data === void 0 ? void 0 : data.municipality
10147
10189
  })
10148
10190
  }), jsx(GoAFormItem, {
10149
- error: (data === null || data === void 0 ? void 0 : data.postalCode) === undefined ? 'postalCode is required' : '',
10191
+ error: (data === null || data === void 0 ? void 0 : data.postalCode) === undefined ? 'Postal code is required' : '',
10150
10192
  label: "Postal Code",
10151
10193
  requirement: "required",
10152
10194
  children: jsx(TextWrap, {
@@ -10992,7 +11034,8 @@ const createDefaultAjv = (...schemas) => {
10992
11034
  const ajv = new Ajv({
10993
11035
  allErrors: true,
10994
11036
  verbose: true,
10995
- strict: 'log'
11037
+ strict: 'log',
11038
+ strictRequired: false
10996
11039
  });
10997
11040
  ajv.addSchema(schemas);
10998
11041
  addErrors(ajv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
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",
@@ -22,6 +22,12 @@ export declare const getLabelText: (scope: string, label: string) => string;
22
22
  export declare const isEmptyBoolean: (schema: JsonSchema, data: unknown) => boolean;
23
23
  export declare const isEmptyNumber: (schema: JsonSchema, data: unknown) => boolean;
24
24
  export declare const validateSinWithLuhn: (input: number) => boolean;
25
+ /**
26
+ * Gets the required field in the If/Then json schema condition.
27
+ * @param props - ControlProps
28
+ * @returns - The required field name.
29
+ */
30
+ export declare const getRequiredIfThen: (props: ControlProps) => string;
25
31
  /**
26
32
  * Check if a required, defined input value is valid. Returns an appropriate
27
33
  * error message if not.