@abgov/jsonforms-components 1.50.2 → 1.50.4

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,12 +1,12 @@
1
1
  import * as runtime from 'react/jsx-runtime';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
- import React, { createContext, useContext, useReducer, useMemo, useEffect, useState, useRef, useCallback } from 'react';
4
3
  import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoARadioGroup, GoARadioItem, GoACheckbox, GoAGrid, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAModal, GoAButtonGroup, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoATable, GoADropdown, GoADropdownItem, GoADetails, GoASpinner } from '@abgov/react-components';
5
- import { useJsonForms, withJsonFormsControlProps, withJsonFormsRendererProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsLayoutProps, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
6
4
  import styled from 'styled-components';
5
+ import React, { createContext, useContext, useReducer, useMemo, useEffect, useState, useRef, useCallback } from 'react';
7
6
  import axios from 'axios';
8
7
  import get$1 from 'lodash/get';
9
8
  import { rankWith, isStringControl, and, optionIs, uiTypeIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, getAjv, isVisible, toDataPath, deriveLabelForUISchemaElement, isEnabled, schemaTypeIs, formatIs, createDefaultValue, Paths, or, isObjectArrayControl, isPrimitiveArrayControl, schemaMatches, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
9
+ import { withJsonFormsControlProps, withJsonFormsRendererProps, withJsonFormsEnumProps, withTranslateProps, useJsonForms, JsonFormsDispatch, withJsonFormsLayoutProps, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
10
10
  import * as _$b from 'lodash';
11
11
  import { isEqual, isObject as isObject$f } from 'lodash';
12
12
  import merge from 'lodash/merge';
@@ -2807,7 +2807,7 @@ const isRequiredAndHasNoData = props => {
2807
2807
  data,
2808
2808
  required
2809
2809
  } = props;
2810
- return required && (data === undefined || data.length === 0);
2810
+ return required && (data === undefined || (data === null || data === void 0 ? void 0 : data.length) === 0);
2811
2811
  };
2812
2812
  /**
2813
2813
  * Checks the key press value to determine if the key press is a 'Shift' or 'Tab'.
@@ -3862,46 +3862,15 @@ const GoAInputBaseControl = props => {
3862
3862
  label,
3863
3863
  input,
3864
3864
  required,
3865
- errors,
3866
3865
  path,
3867
- isStepperReview,
3868
- id
3866
+ isStepperReview
3869
3867
  } = props;
3870
3868
  const InnerComponent = input;
3871
3869
  const labelToUpdate = getLabelText(uischema.scope, label || '');
3872
- const ctx = useJsonForms();
3873
3870
  let modifiedErrors = checkFieldValidity(props);
3874
3871
  if (modifiedErrors === 'must be equal to one of the allowed values') {
3875
3872
  modifiedErrors = '';
3876
3873
  }
3877
- useEffect(() => {
3878
- var _a, _b, _c, _d;
3879
- if ((_a = ctx.core) === null || _a === void 0 ? void 0 : _a.ajv) {
3880
- // eslint-disable-next-line
3881
- const newError = {
3882
- instancePath: path,
3883
- message: modifiedErrors,
3884
- schemaPath: id,
3885
- keyword: '',
3886
- params: {}
3887
- };
3888
- const existingErrorIndex = (ctx.core.ajv.errors || []).findIndex(error => {
3889
- return (error === null || error === void 0 ? void 0 : error.schemaPath) === id;
3890
- });
3891
- if (modifiedErrors) {
3892
- if (existingErrorIndex > -1) {
3893
- (ctx.core.ajv.errors || [])[existingErrorIndex] = newError;
3894
- } else {
3895
- ctx.core.ajv.errors = [...(ctx.core.ajv.errors || []), newError];
3896
- }
3897
- } else {
3898
- if (existingErrorIndex > -1) {
3899
- delete (ctx.core.ajv.errors || [])[existingErrorIndex];
3900
- }
3901
- }
3902
- ctx.core.ajv.errors = ((_d = (_c = (_b = ctx.core) === null || _b === void 0 ? void 0 : _b.ajv) === null || _c === void 0 ? void 0 : _c.errors) === null || _d === void 0 ? void 0 : _d.filter(e => e !== null)) || [];
3903
- }
3904
- }, [modifiedErrors, ctx, path, id]);
3905
3874
  return jsx(JsonFormRegisterProvider, {
3906
3875
  defaultRegisters: undefined,
3907
3876
  children: jsx(Visible, {
@@ -4025,890 +3994,947 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
4025
3994
  ];
4026
3995
  });
4027
3996
 
4028
- const formatSin = value => {
4029
- const inputVal = value.replace(/ /g, '');
4030
- let inputNumbersOnly = inputVal.replace(/\D/g, '');
4031
- if (inputNumbersOnly.length > 16) {
4032
- inputNumbersOnly = inputNumbersOnly.substr(0, 9);
4033
- }
4034
- const splits = inputNumbersOnly.match(/.{1,3}/g);
4035
- let spacedNumber = '';
4036
- if (splits) {
4037
- spacedNumber = splits.join(' ');
4038
- }
4039
- const formatVal = spacedNumber.length > 11 ? spacedNumber.slice(0, 11) : spacedNumber;
4040
- return formatVal;
4041
- };
4042
- const GoAInputText = props => {
4043
- var _a, _b, _c, _d, _e, _f, _g, _h;
4044
- const {
4045
- data,
4046
- config,
4047
- id,
4048
- enabled,
4049
- uischema,
4050
- schema,
4051
- label
4052
- } = props;
4053
- const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
4054
- const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
4055
- const errorsFormInput = checkFieldValidity(props);
4056
- const isSinField = schema.title === sinTitle;
4057
- const autoCapitalize = ((_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.autoCapitalize) === true || ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.autoCapitalize) === true;
4058
- const readOnly = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.readOnly) !== null && _f !== void 0 ? _f : false;
4059
- return jsx(GoAInput, Object.assign({
4060
- error: errorsFormInput.length > 0,
4061
- type: appliedUiSchemaOptions.format === 'password' ? 'password' : 'text',
4062
- disabled: !enabled,
4063
- value: data,
4064
- width: '100%',
4065
- readonly: readOnly,
4066
- maxLength: isSinField ? 11 : '',
4067
- placeholder: placeholder
4068
- }, (_g = uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps, {
4069
- // maxLength={appliedUiSchemaOptions?.maxLength}
4070
- name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
4071
- testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4072
- // Don't use handleChange in the onChange event, use the keyPress or onBlur.
4073
- // If you use it onChange along with keyPress event it will cause a
4074
- // side effect that causes the validation to render when it shouldn't.
4075
- onChange: (name, value) => {
4076
- let formattedValue = value;
4077
- if (schema && schema.title === sinTitle && value !== '') {
4078
- formattedValue = formatSin(value);
4079
- }
4080
- onChangeForInputControl({
4081
- name,
4082
- value: formattedValue,
4083
- controlProps: props
4084
- });
4085
- },
4086
- onKeyPress: (name, value, key) => {
4087
- onKeyPressForTextControl({
4088
- name,
4089
- value: autoCapitalize ? value.toUpperCase() : value,
4090
- key,
4091
- controlProps: props
4092
- });
4093
- },
4094
- onBlur: (name, value) => {
4095
- onBlurForTextControl({
4096
- name,
4097
- controlProps: props,
4098
- value: autoCapitalize ? value.toUpperCase() : value
4099
- });
4100
- }
4101
- }, (_h = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _h === void 0 ? void 0 : _h.componentProps));
4102
- };
4103
- const GoATextControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4104
- input: GoAInputText
4105
- }));
4106
- const GoATextControlTester = rankWith(1, isStringControl);
4107
- const GoAInputTextControl = withJsonFormsControlProps(GoATextControl);
3997
+ // a string of all valid unicode whitespaces
3998
+ var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
3999
+ '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
4108
4000
 
4109
- const MultiLineText = props => {
4110
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4111
- const {
4112
- data,
4113
- config,
4114
- id,
4115
- enabled,
4116
- uischema,
4117
- path,
4118
- handleChange,
4119
- schema,
4120
- label
4121
- } = props;
4122
- const {
4123
- required
4124
- } = props;
4125
- const [textAreaValue, _] = React.useState(data);
4126
- const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
4127
- const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
4128
- const errorsFormInput = checkFieldValidity(props);
4129
- const width = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : '100%';
4130
- const autoCapitalize = ((_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.autoCapitalize) === true || ((_f = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _f === void 0 ? void 0 : _f.autoCapitalize) === true;
4131
- const readOnly = (_j = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps) === null || _h === void 0 ? void 0 : _h.readOnly) !== null && _j !== void 0 ? _j : false;
4132
- const textAreaName = `${label || path}-text-area` || '';
4133
- (_k = document.getElementsByName(textAreaName)[0]) !== null && _k !== void 0 ? _k : null;
4134
- const txtAreaComponent = jsx(GoATextArea, Object.assign({
4135
- error: errorsFormInput.length > 0,
4136
- value: textAreaValue,
4137
- disabled: !enabled,
4138
- readOnly: readOnly,
4139
- placeholder: placeholder,
4140
- testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4141
- name: textAreaName,
4142
- width: width,
4143
- // Note: Paul Jan-09-2023. The latest ui-component come with the maxCount. We need to uncomment the following line when the component is updated
4144
- // maxCount={schema.maxLength || 256}
4145
- onKeyPress: (name, value, key) => {
4146
- const newValue = autoCapitalize ? value.toUpperCase() : value;
4147
- if (value.length === 0 || required && errorsFormInput.length === 0 && value.length > 0) {
4148
- onKeyPressForTextControl({
4149
- name,
4150
- value: newValue,
4151
- key,
4152
- controlProps: props
4153
- });
4154
- }
4155
- },
4156
- onChange: (name, value) => {
4157
- if (data !== value) {
4158
- const newValue = autoCapitalize ? value.toUpperCase() : value;
4159
- handleChange(path, newValue);
4160
- }
4161
- }
4162
- }, (_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.componentProps));
4163
- return txtAreaComponent;
4164
- };
4165
- const MultiLineTextControlInput = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4166
- input: MultiLineText
4167
- }));
4168
- const MultiLineTextControlTester = rankWith(3, and(isStringControl, optionIs('multi', true)));
4169
- const MultiLineTextControl = withJsonFormsControlProps(MultiLineTextControlInput);
4001
+ var uncurryThis$3 = functionUncurryThis;
4002
+ var requireObjectCoercible$1 = requireObjectCoercible$b;
4003
+ var toString$1 = toString$e;
4004
+ var whitespaces$1 = whitespaces$2;
4170
4005
 
4171
- // Used locally for callout presentation
4172
- const callout = props => {
4173
- var _a;
4174
- const componentProps = Object.assign({
4175
- size: 'medium',
4176
- type: 'emergency',
4177
- message: 'unknown'
4178
- }, props);
4179
- const testid = (_a = componentProps.message) === null || _a === void 0 ? void 0 : _a.replace(/\s/g, '');
4180
- return jsx(GoACallout, Object.assign({}, componentProps, {
4181
- "data-testid": testid,
4182
- children: componentProps.message
4183
- }));
4184
- };
4185
- const CalloutControl = props => {
4186
- var _a, _b;
4187
- return callout(((_b = (_a = props === null || props === void 0 ? void 0 : props.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.componentProps) || {});
4188
- };
4189
- const GoACalloutControlTester = rankWith(1, uiTypeIs('Callout'));
4190
- var GoACalloutControl = withJsonFormsRendererProps(CalloutControl);
4006
+ var replace = uncurryThis$3(''.replace);
4007
+ var ltrim = RegExp('^[' + whitespaces$1 + ']+');
4008
+ var rtrim = RegExp('(^|[^' + whitespaces$1 + '])[' + whitespaces$1 + ']+$');
4191
4009
 
4192
- const errMalformedDate = (scope, type) => {
4193
- return `${type}-date for variable '${scope}' has an incorrect format.`;
4010
+ // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
4011
+ var createMethod$1 = function (TYPE) {
4012
+ return function ($this) {
4013
+ var string = toString$1(requireObjectCoercible$1($this));
4014
+ if (TYPE & 1) string = replace(string, ltrim, '');
4015
+ if (TYPE & 2) string = replace(string, rtrim, '$1');
4016
+ return string;
4017
+ };
4194
4018
  };
4195
- const isValidDateFormat = date => {
4196
- const standardized = standardizeDate(date);
4197
- return standardized !== undefined;
4019
+
4020
+ var stringTrim = {
4021
+ // `String.prototype.{ trimLeft, trimStart }` methods
4022
+ // https://tc39.es/ecma262/#sec-string.prototype.trimstart
4023
+ start: createMethod$1(1),
4024
+ // `String.prototype.{ trimRight, trimEnd }` methods
4025
+ // https://tc39.es/ecma262/#sec-string.prototype.trimend
4026
+ end: createMethod$1(2),
4027
+ // `String.prototype.trim` method
4028
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
4029
+ trim: createMethod$1(3)
4198
4030
  };
4199
- const invalidDateFormat = (scope, type) => {
4200
- return callout({
4201
- message: errMalformedDate(scope, type)
4031
+
4032
+ var PROPER_FUNCTION_NAME = functionName.PROPER;
4033
+ var fails$3 = fails$r;
4034
+ var whitespaces = whitespaces$2;
4035
+
4036
+ var non = '\u200B\u0085\u180E';
4037
+
4038
+ // check that a method works with the correct list
4039
+ // of whitespaces and has a correct name
4040
+ var stringTrimForced = function (METHOD_NAME) {
4041
+ return fails$3(function () {
4042
+ return !!whitespaces[METHOD_NAME]()
4043
+ || non[METHOD_NAME]() !== non
4044
+ || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);
4202
4045
  });
4203
4046
  };
4204
- // eslint-disable-next-line
4205
- const reformatDateProps = props => {
4206
- const newProps = Object.assign({}, props);
4207
- if (newProps) {
4208
- if ((newProps === null || newProps === void 0 ? void 0 : newProps.min) && typeof newProps.min === 'string') {
4209
- newProps.min = standardizeDate(newProps.min);
4210
- }
4211
- if ((newProps === null || newProps === void 0 ? void 0 : newProps.max) && typeof newProps.max === 'string') {
4212
- newProps.max = standardizeDate(newProps.max);
4213
- }
4214
- }
4215
- return newProps;
4216
- };
4217
- const GoADateInput = props => {
4218
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4219
- const {
4220
- data,
4221
- config,
4222
- id,
4223
- enabled,
4224
- uischema,
4225
- path,
4226
- handleChange,
4227
- label
4228
- } = props;
4229
- const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
4230
- const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
4231
- const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : '100%';
4232
- const minDate = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps) === null || _h === void 0 ? void 0 : _h.min;
4233
- if (minDate && !isValidDateFormat(minDate)) {
4234
- return invalidDateFormat(uischema.scope, 'Min');
4235
- }
4236
- const maxDate = (_k = (_j = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _j === void 0 ? void 0 : _j.componentProps) === null || _k === void 0 ? void 0 : _k.max;
4237
- if (maxDate && !isValidDateFormat(maxDate)) {
4238
- return invalidDateFormat(uischema.scope, 'Max');
4047
+
4048
+ var $$a = _export;
4049
+ var $trim = stringTrim.trim;
4050
+ var forcedStringTrimMethod = stringTrimForced;
4051
+
4052
+ // `String.prototype.trim` method
4053
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
4054
+ $$a({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
4055
+ trim: function trim() {
4056
+ return $trim(this);
4239
4057
  }
4240
- return jsx(GoAInputDate, Object.assign({
4241
- error: checkFieldValidity(props).length > 0,
4242
- width: width,
4243
- name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
4244
- value: standardizeDate(data) || '',
4245
- testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4246
- disabled: !enabled,
4247
- readonly: readOnly,
4248
- onChange: (name, value) => {
4249
- onChangeForDateControl({
4250
- name,
4251
- value,
4252
- controlProps: props
4253
- });
4254
- },
4255
- onKeyPress: (name, value, key) => {
4256
- onKeyPressForDateControl({
4257
- name,
4258
- value,
4259
- key,
4260
- controlProps: props
4261
- });
4262
- },
4263
- onBlur: (name, value) => {
4264
- onBlurForDateControl({
4265
- name,
4266
- value,
4267
- controlProps: props
4268
- });
4269
- }
4270
- }, reformatDateProps((_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.componentProps)));
4271
- };
4272
- const GoADateControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4273
- input: GoADateInput
4274
- }));
4275
- const GoADateControlTester = rankWith(4, isDateControl);
4276
- const GoAInputDateControl = withJsonFormsControlProps(GoADateControl);
4058
+ });
4277
4059
 
4278
- const GoANumberInput = props => {
4279
- var _a, _b, _c, _d, _e, _f, _g;
4280
- // eslint-disable-next-line
4060
+ const ENTER_KEY = 'Enter';
4061
+ const ESCAPE_KEY = 'Escape';
4062
+ const ARROW_DOWN_KEY = 'ArrowDown';
4063
+ const ARROW_UP_KEY = 'ArrowUp';
4064
+ const TAB_KEY = 'Tab';
4065
+ const SPACE_KEY = ' ';
4066
+ const ALT_KEY = 'Alt';
4067
+ const SHIFT_KEY = 'Shift';
4068
+
4069
+ let _$8 = t => t,
4070
+ _t$8,
4071
+ _t2$5,
4072
+ _t3$4,
4073
+ _t4$3;
4074
+ const GoADropdownTextbox = styled.div(_t$8 || (_t$8 = _$8`
4075
+ border-radius: var(--goa-space-2xs);
4076
+ box-shadow: ${0};
4077
+ &:hover {
4078
+ cursor: pointer;
4079
+ }
4080
+
4081
+ .inputStyle {
4082
+ box-shadow: ${0};
4083
+ }
4084
+ `), 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` : '');
4085
+ const GoADropdownListContainerWrapper = styled.div(_t2$5 || (_t2$5 = _$8`
4086
+ position: relative;
4087
+ display: ${0};
4088
+ `), p => !(p === null || p === void 0 ? void 0 : p.isOpen) && 'none');
4089
+ const GoADropdownListContainer = styled.div(_t3$4 || (_t3$4 = _$8`
4090
+ border: solid 1px var(--goa-color-greyscale-200);
4091
+ border-radius: var(--goa-space-2xs);
4092
+ background: var(--goa-color-greyscale-white);
4093
+ padding: 0;
4094
+ margin-top: 3px;
4095
+ width: 100%;
4096
+ overflow-y: auto;
4097
+ z-index: 1000;
4098
+ caret-color: transparent;
4099
+ position: absolute;
4100
+ line-height: var(--goa-space-xl);
4101
+ max-height: ${0};
4102
+
4103
+ &:focus-visible {
4104
+ outline-color: var(--goa-color-interactive-default);
4105
+ }
4106
+ &:hover {
4107
+ background-color: var(--goa-color-interactive-hover) !important;
4108
+ color: #fff !important;
4109
+ /* Fix to override scrollbar color in Firefox */
4110
+ scrollbar-color: #a8a8a8 var(--goa-color-greyscale-100) !important;
4111
+ }
4112
+ `), p => p.optionListMaxHeight || '272px');
4113
+ const GoADropdownListOption = styled.div(_t4$3 || (_t4$3 = _$8`
4114
+ padding: var(--goa-space-2xs) var(--goa-space-s);
4115
+ text-overflow: ellipsis;
4116
+ color: ${0} !important;
4117
+ border: 0px solid var(--goa-color-greyscale-100);
4118
+ z-index: 1001;
4119
+ cursor: pointer;
4120
+ background: ${0};
4121
+ :has(div:focus) {
4122
+ background-color: ${0};
4123
+ color: ${0};
4124
+ }
4125
+ &:hover {
4126
+ background-color: ${0};
4127
+ color: ${0};
4128
+ }
4129
+
4130
+ &:focus-visible {
4131
+ caret-color: transparent;
4132
+ color: black !important;
4133
+ background-color: ${0};
4134
+ }
4135
+ &:focus-within {
4136
+ caret-color: transparent;
4137
+ color: #fff !important;
4138
+ background-color: ${0};
4139
+ }
4140
+ .dropDownListItem:focus-visible {
4141
+ caret-color: transparent;
4142
+ outline: none !important;
4143
+ color: ${0};
4144
+ }
4145
+ `), p => p.isSelected ? '#fff' : 'var(--goa-color-greyscale-black)', p => p.isSelected ? 'var(--goa-color-interactive-default)' : '#fff', p => p.isSelected ? 'var(--goa-color-interactive-hover)' : 'var(--goa-color-greyscale-100) !important', p => p.isSelected ? 'var(--goa-color-interactive-default)' : 'var(--goa-color-interactive-hover) !important', p => p.isSelected ? 'var(--goa-color-interactive-hover)' : 'var(--goa-color-greyscale-100) !important', p => p.isSelected ? 'var(--goa-color-interactive-default)' : 'var(--goa-color-interactive-hover) !important', p => p.isSelected ? 'var(--goa-color-interactive-hover)' : 'var(--goa-color-greyscale-100) !important', p => p.isSelected ? 'var(--goa-color-interactive-hover)' : 'var(--goa-color-greyscale-100) !important', p => p.isSelected ? '#fff' : 'var(--goa-color-interactive-hover) !important');
4146
+
4147
+ const isValidKey = keyCode => {
4148
+ if (keyCode === SHIFT_KEY || keyCode === ALT_KEY) return false;
4149
+ const regex = new RegExp(/^[a-zA-Z0-9!%$@.#?\-_]+$/);
4150
+ return regex.test(keyCode);
4151
+ };
4152
+ const Dropdown = props => {
4153
+ var _a;
4281
4154
  const {
4282
- data,
4283
- config,
4284
- id,
4155
+ label,
4156
+ selected,
4157
+ onChange,
4158
+ optionListMaxHeight,
4159
+ isAutoCompletion,
4285
4160
  enabled,
4286
- uischema,
4287
- isValid,
4288
- path,
4289
- handleChange,
4290
- schema,
4291
- label
4161
+ id
4292
4162
  } = props;
4293
- const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
4294
- const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
4295
- const InputValue = data && data !== undefined ? data : '';
4296
- const clonedSchema = JSON.parse(JSON.stringify(schema));
4297
- const StepValue = clonedSchema.multipleOf ? clonedSchema.multipleOf : 0.01;
4298
- const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
4299
- const MaxValue = clonedSchema.exclusiveMaximum ? clonedSchema.exclusiveMaximum : '';
4300
- const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
4301
- const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : '100%';
4302
- const errorsFormInput = checkFieldValidity(props);
4303
- return jsx(GoAInput, Object.assign({
4304
- type: "number",
4305
- error: errorsFormInput.length > 0,
4306
- disabled: !enabled,
4307
- readonly: readOnly,
4308
- value: InputValue,
4309
- placeholder: placeholder,
4310
- step: StepValue,
4311
- min: MinValue,
4312
- max: MaxValue,
4313
- width: width,
4314
- name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
4315
- testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4316
- onKeyPress: (name, value, key) => {
4317
- onKeyPressNumericControl({
4318
- name,
4319
- value,
4320
- key,
4321
- controlProps: props
4322
- });
4323
- },
4324
- onBlur: (name, value) => {
4325
- onBlurForNumericControl({
4326
- name,
4327
- value,
4328
- controlProps: props
4329
- });
4330
- },
4331
- onChange: (name, value) => {
4332
- onChangeForNumericControl({
4333
- name,
4334
- value,
4335
- controlProps: props
4163
+ const [isOpen, setIsOpen] = useState(false);
4164
+ const [selectedOption, setSelectedOption] = useState(selected);
4165
+ const [items, setItems] = useState(props.items);
4166
+ const [inputText, setInputText] = useState(selected);
4167
+ const prevCountRef = useRef(props.items);
4168
+ const trailingIcon = isOpen ? 'chevron-up' : 'chevron-down';
4169
+ const textInputName = `dropdown-${label}`;
4170
+ const textInput = (_a = document.getElementsByName(textInputName)[0]) !== null && _a !== void 0 ? _a : null;
4171
+ const PREFIX = 'jsonforms-dropdown';
4172
+ useEffect(() => {
4173
+ setItems(props.items);
4174
+ prevCountRef.current = props.items;
4175
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4176
+ }, [isEqual(props.items, prevCountRef.current)]);
4177
+ useEffect(() => {
4178
+ if (textInput) {
4179
+ textInput.addEventListener('keydown', handleKeyDown);
4180
+ textInput.addEventListener('blur', handleTextInputOnBlur);
4181
+ }
4182
+ document.addEventListener('keydown', handleDocumentKeyDown);
4183
+ return () => {
4184
+ if (textInput) {
4185
+ textInput.removeEventListener('keydown', handleKeyDown);
4186
+ textInput.removeEventListener('blur', handleTextInputOnBlur);
4187
+ }
4188
+ document.removeEventListener('keydown', handleDocumentKeyDown);
4189
+ };
4190
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4191
+ }, [textInput, document]);
4192
+ /* istanbul ignore next */
4193
+ const handleTextInputOnBlur = e => {
4194
+ if (e.relatedTarget === null) {
4195
+ setIsOpen(false);
4196
+ } else if (e.relatedTarget && !isAutoCompletion) {
4197
+ const dropDownEl = e.relatedTarget;
4198
+ if (dropDownEl) {
4199
+ if (!dropDownEl.id.startsWith(`${PREFIX}-${label}`)) {
4200
+ setIsOpen(false);
4201
+ }
4202
+ }
4203
+ }
4204
+ };
4205
+ const updateDropDownData = item => {
4206
+ onChange(item.value);
4207
+ setSelectedOption(item.value);
4208
+ setInputText(item.label);
4209
+ if (isAutoCompletion) {
4210
+ const selectedItems = props.items.filter(filterItem => {
4211
+ return filterItem.label === item.label;
4336
4212
  });
4213
+ setItems(selectedItems);
4337
4214
  }
4338
- }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
4215
+ setIsOpen(false);
4216
+ };
4217
+ const setInputTextFocus = () => {
4218
+ const inputEl = document.getElementById(`${id}-input`);
4219
+ if (inputEl) {
4220
+ //The 'focused' property is part of the GoAInput component that is used to
4221
+ //set focus on the input field. We need to set it back to false once we set focus on the input field. Doing with just .focus() doesnt work.
4222
+ inputEl.focused = true;
4223
+ inputEl.focus();
4224
+ inputEl.focused = false;
4225
+ }
4226
+ };
4227
+ const setElementFocus = (e, element, preventDefault) => {
4228
+ if (element) {
4229
+ element.focus();
4230
+ if (preventDefault) {
4231
+ e.preventDefault();
4232
+ }
4233
+ }
4234
+ };
4235
+ /* istanbul ignore next */
4236
+ const handleDocumentKeyDown = e => {
4237
+ if (e.key === ESCAPE_KEY || e.key === TAB_KEY) {
4238
+ setIsOpen(false);
4239
+ }
4240
+ };
4241
+ /* istanbul ignore next */
4242
+ const handleKeyDown = e => {
4243
+ var _a, _b, _c;
4244
+ if (e.key === ENTER_KEY || e.key === SPACE_KEY) {
4245
+ setIsOpen(previousIsOpen => !previousIsOpen);
4246
+ const el = document.getElementById(`${PREFIX}-${label}-${(_a = items.at(0)) === null || _a === void 0 ? void 0 : _a.value}`);
4247
+ setInputTextFocus();
4248
+ setElementFocus(e, el, false);
4249
+ } else if (e.key === ARROW_UP_KEY) {
4250
+ setIsOpen(true);
4251
+ const val = `${PREFIX}-${label}-${(_b = items.at(1)) === null || _b === void 0 ? void 0 : _b.value}`;
4252
+ const el = document.getElementById(val);
4253
+ setElementFocus(e, el, false);
4254
+ } else if (e.key === ARROW_DOWN_KEY) {
4255
+ setIsOpen(true);
4256
+ const firstItem = props.items.at(0);
4257
+ let index = 0;
4258
+ if ((firstItem === null || firstItem === void 0 ? void 0 : firstItem.label.trim()) === '') {
4259
+ index = 1;
4260
+ }
4261
+ let el = document.getElementById(`${PREFIX}-${label}-${(_c = props.items.at(index)) === null || _c === void 0 ? void 0 : _c.value}`);
4262
+ if (el === null && !isAutoCompletion) {
4263
+ const elements = document.querySelectorAll(`[id='${PREFIX}-dropDownList-${label}']`);
4264
+ const element = elements.item(0).children.item(1);
4265
+ el = document.getElementById(`${PREFIX}-${label}-${element.innerText}`);
4266
+ } else if (el === null && isAutoCompletion) {
4267
+ const elements = document.querySelectorAll(`[id=${PREFIX}-dropDownList-${label}]`);
4268
+ const element = elements[0].children[0];
4269
+ el = document.getElementById(`${PREFIX}-${label}-${element.innerText}`);
4270
+ }
4271
+ setElementFocus(e, el, true);
4272
+ } else if (e.key === ESCAPE_KEY || e.key === TAB_KEY) {
4273
+ setIsOpen(false);
4274
+ } else {
4275
+ if (isValidKey(e.key)) {
4276
+ setIsOpen(true);
4277
+ }
4278
+ }
4279
+ };
4280
+ const handDropDownItemOnKeyDown = (e, item) => {
4281
+ var _a, _b, _c, _d;
4282
+ if (e.key === ENTER_KEY || e.key === SPACE_KEY) {
4283
+ updateDropDownData(item);
4284
+ setInputTextFocus();
4285
+ }
4286
+ if (e.key === ESCAPE_KEY) {
4287
+ setIsOpen(false);
4288
+ setInputTextFocus();
4289
+ }
4290
+ let index = items.findIndex(val => {
4291
+ return val.label === e.currentTarget.innerText;
4292
+ });
4293
+ //Prevent jumping to the next control/DOM element if
4294
+ //we are on the last item in the drop down list
4295
+ if (e.key === ARROW_DOWN_KEY) {
4296
+ if (item.label === ((_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.label)) {
4297
+ e.preventDefault();
4298
+ }
4299
+ if (index === -1 && item.label.trim() === '') {
4300
+ index = 0;
4301
+ }
4302
+ const el = document.getElementById(`${PREFIX}-${label}-${(_b = items.at(index + 1)) === null || _b === void 0 ? void 0 : _b.value}`);
4303
+ if (el) {
4304
+ setElementFocus(e, el, true);
4305
+ return;
4306
+ }
4307
+ }
4308
+ if (e.key === ARROW_UP_KEY) {
4309
+ if (index <= 0) {
4310
+ e.preventDefault();
4311
+ return;
4312
+ }
4313
+ const el = document.getElementById(`${PREFIX}-${label}-${(_c = items.at(index - 1)) === null || _c === void 0 ? void 0 : _c.value}`);
4314
+ if (el) {
4315
+ el.focus();
4316
+ }
4317
+ }
4318
+ if (e.key === TAB_KEY) {
4319
+ const val = `${PREFIX}-${label}-${(_d = items.at(index - 1)) === null || _d === void 0 ? void 0 : _d.value}`;
4320
+ const el = document.getElementById(val);
4321
+ if (el) {
4322
+ setIsOpen(false);
4323
+ }
4324
+ }
4325
+ };
4326
+ return jsxs("div", {
4327
+ "data-testid": id,
4328
+ children: [jsx(GoADropdownTextbox, {
4329
+ isOpen: isOpen,
4330
+ onClick: e => {
4331
+ setIsOpen(previousIsOpen => !previousIsOpen);
4332
+ },
4333
+ children: jsx(GoAInput, {
4334
+ disabled: !enabled,
4335
+ name: `dropdown-${label}`,
4336
+ width: "100%",
4337
+ value: inputText,
4338
+ testId: `${id}-input`,
4339
+ id: `${id}-input`,
4340
+ readonly: !isAutoCompletion,
4341
+ onChange: (name, value) => {
4342
+ if (isAutoCompletion) {
4343
+ setInputText(value);
4344
+ const selectedItems = props.items.filter(item => {
4345
+ return item.label.includes(value);
4346
+ });
4347
+ setItems(selectedItems);
4348
+ }
4349
+ },
4350
+ onTrailingIconClick: () => {},
4351
+ trailingIcon: trailingIcon
4352
+ })
4353
+ }), jsx(GoADropdownListContainerWrapper, {
4354
+ isOpen: isOpen,
4355
+ id: `${PREFIX}-dropDownListContainerWrapper-${label}`,
4356
+ children: jsx(GoADropdownListContainer, {
4357
+ id: `${PREFIX}-dropDownList-${label}`,
4358
+ optionListMaxHeight: optionListMaxHeight,
4359
+ children: items.map(item => {
4360
+ return jsx(GoADropdownListOption, {
4361
+ id: `${PREFIX}-option-${label}-${item.value}`,
4362
+ isSelected: item.value === selected || item.value === selectedOption,
4363
+ children: jsx("div", {
4364
+ tabIndex: 0,
4365
+ className: "dropDownListItem",
4366
+ "data-testid": `${id}-${item.label}-option`,
4367
+ id: `${PREFIX}-${label}-${item.value}`,
4368
+ onKeyDown: e => {
4369
+ handDropDownItemOnKeyDown(e, item);
4370
+ },
4371
+ onClick: e => {
4372
+ updateDropDownData(item);
4373
+ },
4374
+ children: item.label
4375
+ }, `${PREFIX}-${label}-${item.value}`)
4376
+ }, `${PREFIX}-option-${label}-${item.value}`);
4377
+ })
4378
+ }, `${PREFIX}-dropDownList-${label}`)
4379
+ }, `${PREFIX}-dropDownListContainerWrapper-${label}`)]
4380
+ }, id);
4339
4381
  };
4340
- const GoANumberControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4341
- input: GoANumberInput
4342
- }));
4343
- const GoANumberControlTester = rankWith(2, isNumberControl);
4344
- const GoAInputNumberControl = withJsonFormsControlProps(GoANumberControl);
4345
4382
 
4346
- const GoAInputInteger = props => {
4347
- var _a, _b, _c, _d, _e, _f, _g;
4348
- // eslint-disable-next-line
4383
+ function fetchRegisterConfigFromOptions$1(options) {
4384
+ if (!(options === null || options === void 0 ? void 0 : options.url) && !(options === null || options === void 0 ? void 0 : options.urn)) return undefined;
4385
+ const config = Object.assign({}, options);
4386
+ return config;
4387
+ }
4388
+ const formatSin = value => {
4389
+ const inputVal = value.replace(/ /g, '');
4390
+ let inputNumbersOnly = inputVal.replace(/\D/g, '');
4391
+ if (inputNumbersOnly.length > 16) {
4392
+ inputNumbersOnly = inputNumbersOnly.substr(0, 9);
4393
+ }
4394
+ const splits = inputNumbersOnly.match(/.{1,3}/g);
4395
+ let spacedNumber = '';
4396
+ if (splits) {
4397
+ spacedNumber = splits.join(' ');
4398
+ }
4399
+ const formatVal = spacedNumber.length > 11 ? spacedNumber.slice(0, 11) : spacedNumber;
4400
+ return formatVal;
4401
+ };
4402
+ const GoAInputText = props => {
4403
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
4349
4404
  const {
4350
4405
  data,
4351
4406
  config,
4352
4407
  id,
4353
4408
  enabled,
4354
4409
  uischema,
4355
- isValid,
4356
- path,
4357
- handleChange,
4358
4410
  schema,
4359
- label
4411
+ label,
4412
+ path,
4413
+ handleChange
4360
4414
  } = props;
4415
+ const registerCtx = useContext(JsonFormsRegisterContext);
4416
+ const registerConfig = fetchRegisterConfigFromOptions$1((_b = (_a = props.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.register);
4417
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4418
+ let registerData = [];
4419
+ if (registerConfig) {
4420
+ registerData = registerCtx === null || registerCtx === void 0 ? void 0 : registerCtx.selectRegisterData(registerConfig);
4421
+ }
4422
+ const autoCompletion = ((_d = (_c = props.uischema) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.autoComplete) === true;
4423
+ const mergedOptions = useMemo(() => {
4424
+ const newOptions = [...((registerData === null || registerData === void 0 ? void 0 : registerData.map(d => {
4425
+ if (typeof d === 'string') {
4426
+ return {
4427
+ value: d,
4428
+ label: d
4429
+ };
4430
+ } else {
4431
+ return Object.assign({}, d);
4432
+ }
4433
+ })) || [])];
4434
+ const hasNonEmptyOptions = newOptions.some(option => option.value !== '');
4435
+ if (!hasNonEmptyOptions && newOptions.length === 1 && newOptions[0].value === '') {
4436
+ return newOptions;
4437
+ }
4438
+ if (newOptions && newOptions.length === 0) {
4439
+ newOptions.push({
4440
+ label: '',
4441
+ value: ''
4442
+ });
4443
+ }
4444
+ return newOptions.filter(option => option.value !== '');
4445
+ }, [registerData]);
4446
+ useEffect(() => {
4447
+ if (registerConfig) {
4448
+ registerCtx === null || registerCtx === void 0 ? void 0 : registerCtx.fetchRegisterByUrl(registerConfig);
4449
+ }
4450
+ }, [registerCtx, registerConfig]);
4361
4451
  const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
4362
4452
  const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
4363
- const InputValue = data && data !== undefined ? data : '';
4364
- const clonedSchema = JSON.parse(JSON.stringify(schema));
4365
- const StepValue = clonedSchema.multipleOf ? clonedSchema.multipleOf : 0;
4366
- const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
4367
- const MaxValue = clonedSchema.exclusiveMaximum ? clonedSchema.exclusiveMaximum : '';
4368
- const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
4369
- const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : '100%';
4370
4453
  const errorsFormInput = checkFieldValidity(props);
4371
- return jsx(GoAInput, Object.assign({
4372
- type: "number",
4373
- error: errorsFormInput.length > 0,
4374
- width: width,
4375
- disabled: !enabled,
4376
- readonly: readOnly,
4377
- value: InputValue,
4378
- step: StepValue,
4379
- min: MinValue,
4380
- max: MaxValue,
4381
- placeholder: placeholder,
4382
- name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
4383
- testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4384
- onKeyPress: (name, value, key) => {
4385
- onKeyPressNumericControl({
4386
- name,
4387
- value,
4388
- key,
4389
- controlProps: props
4390
- });
4391
- },
4392
- onBlur: (name, value) => {
4393
- onBlurForNumericControl({
4394
- name,
4395
- value,
4396
- controlProps: props
4397
- });
4398
- },
4399
- onChange: (name, value) => {
4400
- onChangeForNumericControl({
4401
- name,
4402
- value,
4403
- controlProps: props
4404
- });
4405
- }
4406
- }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
4454
+ const isSinField = schema.title === sinTitle;
4455
+ const autoCapitalize = ((_f = (_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.componentProps) === null || _f === void 0 ? void 0 : _f.autoCapitalize) === true || ((_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.autoCapitalize) === true;
4456
+ const readOnly = (_k = (_j = (_h = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _h === void 0 ? void 0 : _h.componentProps) === null || _j === void 0 ? void 0 : _j.readOnly) !== null && _k !== void 0 ? _k : false;
4457
+ return jsx("div", {
4458
+ children: mergedOptions.length > 0 ? jsx(Dropdown, {
4459
+ items: mergedOptions,
4460
+ enabled: enabled,
4461
+ selected: data,
4462
+ id: `jsonforms-${label}-dropdown`,
4463
+ label: label || '',
4464
+ isAutoCompletion: autoCompletion,
4465
+ onChange: value => {
4466
+ handleChange(path, value);
4467
+ }
4468
+ }, `jsonforms-${label}-dropdown`) : jsx(GoAInput, Object.assign({
4469
+ error: errorsFormInput.length > 0,
4470
+ type: appliedUiSchemaOptions.format === 'password' ? 'password' : 'text',
4471
+ disabled: !enabled,
4472
+ value: data,
4473
+ width: '100%',
4474
+ readonly: readOnly,
4475
+ maxLength: isSinField ? 11 : '',
4476
+ placeholder: placeholder
4477
+ }, (_l = uischema.options) === null || _l === void 0 ? void 0 : _l.componentProps, {
4478
+ // maxLength={appliedUiSchemaOptions?.maxLength}
4479
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
4480
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4481
+ // Don't use handleChange in the onChange event, use the keyPress or onBlur.
4482
+ // If you use it onChange along with keyPress event it will cause a
4483
+ // side effect that causes the validation to render when it shouldn't.
4484
+ onChange: (name, value) => {
4485
+ let formattedValue = value;
4486
+ if (schema && schema.title === sinTitle && value !== '') {
4487
+ formattedValue = formatSin(value);
4488
+ }
4489
+ onChangeForInputControl({
4490
+ name,
4491
+ value: formattedValue,
4492
+ controlProps: props
4493
+ });
4494
+ },
4495
+ onKeyPress: (name, value, key) => {
4496
+ onKeyPressForTextControl({
4497
+ name,
4498
+ value: autoCapitalize ? value.toUpperCase() : value,
4499
+ key,
4500
+ controlProps: props
4501
+ });
4502
+ },
4503
+ onBlur: (name, value) => {
4504
+ onBlurForTextControl({
4505
+ name,
4506
+ controlProps: props,
4507
+ value: autoCapitalize ? value.toUpperCase() : value
4508
+ });
4509
+ }
4510
+ }, (_m = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _m === void 0 ? void 0 : _m.componentProps))
4511
+ });
4407
4512
  };
4408
- const GoAIntegerControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4409
- input: GoAInputInteger
4513
+ const GoATextControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4514
+ input: GoAInputText
4410
4515
  }));
4411
- const GoAIntegerControlTester = rankWith(2, isIntegerControl);
4412
- const GoAInputIntegerControl = withJsonFormsControlProps(GoAIntegerControl);
4516
+ const GoATextControlTester = rankWith(1, isStringControl);
4517
+ const GoAInputTextControl = withJsonFormsControlProps(GoATextControl);
4413
4518
 
4414
- const GoADateTimeInput = props => {
4415
- var _a, _b, _c, _d, _e, _f, _g;
4416
- // eslint-disable-next-line
4519
+ const MultiLineText = props => {
4520
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4417
4521
  const {
4418
4522
  data,
4419
4523
  config,
4420
4524
  id,
4421
4525
  enabled,
4422
4526
  uischema,
4423
- isValid,
4424
4527
  path,
4425
- errors,
4426
4528
  handleChange,
4427
4529
  schema,
4428
4530
  label
4429
4531
  } = props;
4430
- const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
4431
- const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
4432
- const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : '100%';
4433
- return jsx(GoAInputDateTime, Object.assign({
4434
- error: checkFieldValidity(props).length > 0,
4435
- width: width,
4436
- name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
4437
- value: data ? new Date(data).toISOString() : '',
4438
- testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4439
- disabled: !enabled,
4440
- readonly: readOnly,
4441
- onChange: (name, value) => {
4442
- onChangeForDateTimeControl({
4443
- name,
4444
- value,
4445
- controlProps: props
4446
- });
4447
- },
4448
- onKeyPress: (name, value, key) => {
4449
- onKeyPressForDateControl({
4450
- name,
4451
- value,
4452
- key,
4453
- controlProps: props
4454
- });
4455
- },
4456
- onBlur: (name, value) => {
4457
- onBlurForDateControl({
4458
- name,
4459
- value,
4460
- controlProps: props
4461
- });
4462
- }
4463
- }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
4464
- };
4465
- const GoADateTimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4466
- input: GoADateTimeInput
4467
- }));
4468
- const GoADateTimeControlTester = rankWith(2, isDateTimeControl);
4469
- const GoAInputDateTimeControl = withJsonFormsControlProps(GoADateTimeControl);
4470
-
4471
- const GoATimeInput = props => {
4472
- var _a, _b, _c, _d, _e, _f, _g;
4473
- // eslint-disable-next-line
4474
4532
  const {
4475
- data,
4476
- config,
4477
- id,
4478
- enabled,
4479
- uischema,
4480
- isValid,
4481
- path,
4482
- handleChange,
4483
- schema,
4484
- label
4533
+ required
4485
4534
  } = props;
4535
+ const [textAreaValue, _] = React.useState(data);
4486
4536
  const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
4487
- (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
4488
- const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
4537
+ const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
4489
4538
  const errorsFormInput = checkFieldValidity(props);
4490
- const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.readOnly) !== null && _f !== void 0 ? _f : '100%';
4491
- return jsx(GoAInputTime, Object.assign({
4539
+ const width = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : '100%';
4540
+ const autoCapitalize = ((_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.autoCapitalize) === true || ((_f = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _f === void 0 ? void 0 : _f.autoCapitalize) === true;
4541
+ const readOnly = (_j = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps) === null || _h === void 0 ? void 0 : _h.readOnly) !== null && _j !== void 0 ? _j : false;
4542
+ const textAreaName = `${label || path}-text-area` || '';
4543
+ (_k = document.getElementsByName(textAreaName)[0]) !== null && _k !== void 0 ? _k : null;
4544
+ const txtAreaComponent = jsx(GoATextArea, Object.assign({
4492
4545
  error: errorsFormInput.length > 0,
4493
- name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
4494
- value: data,
4495
- step: 1,
4496
- width: width,
4546
+ value: textAreaValue,
4497
4547
  disabled: !enabled,
4498
- readonly: readOnly,
4548
+ readOnly: readOnly,
4549
+ placeholder: placeholder,
4499
4550
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4500
- onBlur: (name, value) => {
4501
- onBlurForTimeControl({
4502
- name,
4503
- value,
4504
- controlProps: props
4505
- });
4506
- },
4507
- // Dont use handleChange in the onChange event, use the keyPress or onBlur.
4508
- // If you use it onChange along with keyPress event it will cause a
4509
- // side effect that causes the validation to render when it shouldnt.
4510
- onChange: (name, value) => {},
4551
+ name: textAreaName,
4552
+ width: width,
4553
+ // Note: Paul Jan-09-2023. The latest ui-component come with the maxCount. We need to uncomment the following line when the component is updated
4554
+ // maxCount={schema.maxLength || 256}
4511
4555
  onKeyPress: (name, value, key) => {
4512
- onKeyPressForTimeControl({
4556
+ const newValue = autoCapitalize ? value.toUpperCase() : value;
4557
+ if (value.length === 0 || required && errorsFormInput.length === 0 && value.length > 0) {
4558
+ onKeyPressForTextControl({
4559
+ name,
4560
+ value: newValue,
4561
+ key,
4562
+ controlProps: props
4563
+ });
4564
+ }
4565
+ onChangeForInputControl({
4513
4566
  name,
4514
- value,
4515
- key,
4567
+ value: newValue,
4516
4568
  controlProps: props
4517
4569
  });
4570
+ },
4571
+ onChange: (name, value) => {
4572
+ // this is not triggered unless you tab out
4518
4573
  }
4519
- }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
4574
+ }, (_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.componentProps));
4575
+ return txtAreaComponent;
4520
4576
  };
4521
- const GoATimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4522
- input: GoATimeInput
4577
+ const MultiLineTextControlInput = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4578
+ input: MultiLineText
4523
4579
  }));
4524
- const GoATimeControlTester = rankWith(4, isTimeControl);
4525
- const GoAInputTimeControl = withJsonFormsControlProps(GoATimeControl);
4526
-
4527
- // a string of all valid unicode whitespaces
4528
- var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
4529
- '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
4530
-
4531
- var uncurryThis$3 = functionUncurryThis;
4532
- var requireObjectCoercible$1 = requireObjectCoercible$b;
4533
- var toString$1 = toString$e;
4534
- var whitespaces$1 = whitespaces$2;
4535
-
4536
- var replace = uncurryThis$3(''.replace);
4537
- var ltrim = RegExp('^[' + whitespaces$1 + ']+');
4538
- var rtrim = RegExp('(^|[^' + whitespaces$1 + '])[' + whitespaces$1 + ']+$');
4580
+ const MultiLineTextControlTester = rankWith(3, and(isStringControl, optionIs('multi', true)));
4581
+ const MultiLineTextControl = withJsonFormsControlProps(MultiLineTextControlInput);
4539
4582
 
4540
- // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
4541
- var createMethod$1 = function (TYPE) {
4542
- return function ($this) {
4543
- var string = toString$1(requireObjectCoercible$1($this));
4544
- if (TYPE & 1) string = replace(string, ltrim, '');
4545
- if (TYPE & 2) string = replace(string, rtrim, '$1');
4546
- return string;
4547
- };
4583
+ // Used locally for callout presentation
4584
+ const callout = props => {
4585
+ var _a;
4586
+ const componentProps = Object.assign({
4587
+ size: 'medium',
4588
+ type: 'emergency',
4589
+ message: 'unknown'
4590
+ }, props);
4591
+ const testid = (_a = componentProps.message) === null || _a === void 0 ? void 0 : _a.replace(/\s/g, '');
4592
+ return jsx(GoACallout, Object.assign({}, componentProps, {
4593
+ "data-testid": testid,
4594
+ children: componentProps.message
4595
+ }));
4548
4596
  };
4549
-
4550
- var stringTrim = {
4551
- // `String.prototype.{ trimLeft, trimStart }` methods
4552
- // https://tc39.es/ecma262/#sec-string.prototype.trimstart
4553
- start: createMethod$1(1),
4554
- // `String.prototype.{ trimRight, trimEnd }` methods
4555
- // https://tc39.es/ecma262/#sec-string.prototype.trimend
4556
- end: createMethod$1(2),
4557
- // `String.prototype.trim` method
4558
- // https://tc39.es/ecma262/#sec-string.prototype.trim
4559
- trim: createMethod$1(3)
4597
+ const CalloutControl = props => {
4598
+ var _a, _b;
4599
+ return callout(((_b = (_a = props === null || props === void 0 ? void 0 : props.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.componentProps) || {});
4560
4600
  };
4601
+ const GoACalloutControlTester = rankWith(1, uiTypeIs('Callout'));
4602
+ var GoACalloutControl = withJsonFormsRendererProps(CalloutControl);
4561
4603
 
4562
- var PROPER_FUNCTION_NAME = functionName.PROPER;
4563
- var fails$3 = fails$r;
4564
- var whitespaces = whitespaces$2;
4565
-
4566
- var non = '\u200B\u0085\u180E';
4567
-
4568
- // check that a method works with the correct list
4569
- // of whitespaces and has a correct name
4570
- var stringTrimForced = function (METHOD_NAME) {
4571
- return fails$3(function () {
4572
- return !!whitespaces[METHOD_NAME]()
4573
- || non[METHOD_NAME]() !== non
4574
- || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);
4604
+ const errMalformedDate = (scope, type) => {
4605
+ return `${type}-date for variable '${scope}' has an incorrect format.`;
4606
+ };
4607
+ const isValidDateFormat = date => {
4608
+ const standardized = standardizeDate(date);
4609
+ return standardized !== undefined;
4610
+ };
4611
+ const invalidDateFormat = (scope, type) => {
4612
+ return callout({
4613
+ message: errMalformedDate(scope, type)
4575
4614
  });
4576
4615
  };
4577
-
4578
- var $$a = _export;
4579
- var $trim = stringTrim.trim;
4580
- var forcedStringTrimMethod = stringTrimForced;
4581
-
4582
- // `String.prototype.trim` method
4583
- // https://tc39.es/ecma262/#sec-string.prototype.trim
4584
- $$a({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
4585
- trim: function trim() {
4586
- return $trim(this);
4587
- }
4588
- });
4589
-
4590
- const ENTER_KEY = 'Enter';
4591
- const ESCAPE_KEY = 'Escape';
4592
- const ARROW_DOWN_KEY = 'ArrowDown';
4593
- const ARROW_UP_KEY = 'ArrowUp';
4594
- const TAB_KEY = 'Tab';
4595
- const SPACE_KEY = ' ';
4596
- const ALT_KEY = 'Alt';
4597
- const SHIFT_KEY = 'Shift';
4598
-
4599
- let _$8 = t => t,
4600
- _t$8,
4601
- _t2$5,
4602
- _t3$4,
4603
- _t4$3;
4604
- const GoADropdownTextbox = styled.div(_t$8 || (_t$8 = _$8`
4605
- border-radius: var(--goa-space-2xs);
4606
- box-shadow: ${0};
4607
- &:hover {
4608
- cursor: pointer;
4609
- }
4610
-
4611
- .inputStyle {
4612
- box-shadow: ${0};
4613
- }
4614
- `), 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` : '');
4615
- const GoADropdownListContainerWrapper = styled.div(_t2$5 || (_t2$5 = _$8`
4616
- position: relative;
4617
- display: ${0};
4618
- `), p => !(p === null || p === void 0 ? void 0 : p.isOpen) && 'none');
4619
- const GoADropdownListContainer = styled.div(_t3$4 || (_t3$4 = _$8`
4620
- border: solid 1px var(--goa-color-greyscale-200);
4621
- border-radius: var(--goa-space-2xs);
4622
- background: var(--goa-color-greyscale-white);
4623
- padding: 0;
4624
- margin-top: 3px;
4625
- width: 100%;
4626
- overflow-y: auto;
4627
- z-index: 1000;
4628
- caret-color: transparent;
4629
- position: absolute;
4630
- line-height: var(--goa-space-xl);
4631
- max-height: ${0};
4632
-
4633
- &:focus-visible {
4634
- outline-color: var(--goa-color-interactive-default);
4635
- }
4636
- &:hover {
4637
- background-color: var(--goa-color-interactive-hover) !important;
4638
- color: #fff !important;
4639
- /* Fix to override scrollbar color in Firefox */
4640
- scrollbar-color: #a8a8a8 var(--goa-color-greyscale-100) !important;
4641
- }
4642
- `), p => p.optionListMaxHeight || '272px');
4643
- const GoADropdownListOption = styled.div(_t4$3 || (_t4$3 = _$8`
4644
- padding: var(--goa-space-2xs) var(--goa-space-s);
4645
- text-overflow: ellipsis;
4646
- color: ${0} !important;
4647
- border: 0px solid var(--goa-color-greyscale-100);
4648
- z-index: 1001;
4649
- cursor: pointer;
4650
- background: ${0};
4651
- :has(div:focus) {
4652
- background-color: ${0};
4653
- color: ${0};
4654
- }
4655
- &:hover {
4656
- background-color: ${0};
4657
- color: ${0};
4658
- }
4659
-
4660
- &:focus-visible {
4661
- caret-color: transparent;
4662
- color: black !important;
4663
- background-color: ${0};
4616
+ // eslint-disable-next-line
4617
+ const reformatDateProps = props => {
4618
+ const newProps = Object.assign({}, props);
4619
+ if (newProps) {
4620
+ if ((newProps === null || newProps === void 0 ? void 0 : newProps.min) && typeof newProps.min === 'string') {
4621
+ newProps.min = standardizeDate(newProps.min);
4622
+ }
4623
+ if ((newProps === null || newProps === void 0 ? void 0 : newProps.max) && typeof newProps.max === 'string') {
4624
+ newProps.max = standardizeDate(newProps.max);
4625
+ }
4664
4626
  }
4665
- &:focus-within {
4666
- caret-color: transparent;
4667
- color: #fff !important;
4668
- background-color: ${0};
4627
+ return newProps;
4628
+ };
4629
+ const GoADateInput = props => {
4630
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4631
+ const {
4632
+ data,
4633
+ config,
4634
+ id,
4635
+ enabled,
4636
+ uischema,
4637
+ path,
4638
+ handleChange,
4639
+ label
4640
+ } = props;
4641
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
4642
+ const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
4643
+ const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : '100%';
4644
+ const minDate = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps) === null || _h === void 0 ? void 0 : _h.min;
4645
+ if (minDate && !isValidDateFormat(minDate)) {
4646
+ return invalidDateFormat(uischema.scope, 'Min');
4669
4647
  }
4670
- .dropDownListItem:focus-visible {
4671
- caret-color: transparent;
4672
- outline: none !important;
4673
- color: ${0};
4648
+ const maxDate = (_k = (_j = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _j === void 0 ? void 0 : _j.componentProps) === null || _k === void 0 ? void 0 : _k.max;
4649
+ if (maxDate && !isValidDateFormat(maxDate)) {
4650
+ return invalidDateFormat(uischema.scope, 'Max');
4674
4651
  }
4675
- `), p => p.isSelected ? '#fff' : 'var(--goa-color-greyscale-black)', p => p.isSelected ? 'var(--goa-color-interactive-default)' : '#fff', p => p.isSelected ? 'var(--goa-color-interactive-hover)' : 'var(--goa-color-greyscale-100) !important', p => p.isSelected ? 'var(--goa-color-interactive-default)' : 'var(--goa-color-interactive-hover) !important', p => p.isSelected ? 'var(--goa-color-interactive-hover)' : 'var(--goa-color-greyscale-100) !important', p => p.isSelected ? 'var(--goa-color-interactive-default)' : 'var(--goa-color-interactive-hover) !important', p => p.isSelected ? 'var(--goa-color-interactive-hover)' : 'var(--goa-color-greyscale-100) !important', p => p.isSelected ? 'var(--goa-color-interactive-hover)' : 'var(--goa-color-greyscale-100) !important', p => p.isSelected ? '#fff' : 'var(--goa-color-interactive-hover) !important');
4676
-
4677
- const isValidKey = keyCode => {
4678
- if (keyCode === SHIFT_KEY || keyCode === ALT_KEY) return false;
4679
- const regex = new RegExp(/^[a-zA-Z0-9!%$@.#?\-_]+$/);
4680
- return regex.test(keyCode);
4652
+ return jsx(GoAInputDate, Object.assign({
4653
+ error: checkFieldValidity(props).length > 0,
4654
+ width: width,
4655
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
4656
+ value: standardizeDate(data) || '',
4657
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4658
+ disabled: !enabled,
4659
+ readonly: readOnly,
4660
+ onChange: (name, value) => {
4661
+ onChangeForDateControl({
4662
+ name,
4663
+ value,
4664
+ controlProps: props
4665
+ });
4666
+ },
4667
+ onKeyPress: (name, value, key) => {
4668
+ onKeyPressForDateControl({
4669
+ name,
4670
+ value,
4671
+ key,
4672
+ controlProps: props
4673
+ });
4674
+ },
4675
+ onBlur: (name, value) => {
4676
+ onBlurForDateControl({
4677
+ name,
4678
+ value,
4679
+ controlProps: props
4680
+ });
4681
+ }
4682
+ }, reformatDateProps((_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.componentProps)));
4681
4683
  };
4682
- const Dropdown = props => {
4683
- var _a;
4684
+ const GoADateControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4685
+ input: GoADateInput
4686
+ }));
4687
+ const GoADateControlTester = rankWith(4, isDateControl);
4688
+ const GoAInputDateControl = withJsonFormsControlProps(GoADateControl);
4689
+
4690
+ const GoANumberInput = props => {
4691
+ var _a, _b, _c, _d, _e, _f, _g;
4692
+ // eslint-disable-next-line
4684
4693
  const {
4685
- label,
4686
- selected,
4687
- onChange,
4688
- optionListMaxHeight,
4689
- isAutoCompletion,
4694
+ data,
4695
+ config,
4696
+ id,
4690
4697
  enabled,
4691
- id
4698
+ uischema,
4699
+ isValid,
4700
+ path,
4701
+ handleChange,
4702
+ schema,
4703
+ label
4692
4704
  } = props;
4693
- const [isOpen, setIsOpen] = useState(false);
4694
- const [selectedOption, setSelectedOption] = useState(selected);
4695
- const [items, setItems] = useState(props.items);
4696
- const [inputText, setInputText] = useState(selected);
4697
- const prevCountRef = useRef(props.items);
4698
- const trailingIcon = isOpen ? 'chevron-up' : 'chevron-down';
4699
- const textInputName = `dropdown-${label}`;
4700
- const textInput = (_a = document.getElementsByName(textInputName)[0]) !== null && _a !== void 0 ? _a : null;
4701
- const PREFIX = 'jsonforms-dropdown';
4702
- useEffect(() => {
4703
- setItems(props.items);
4704
- prevCountRef.current = props.items;
4705
- // eslint-disable-next-line react-hooks/exhaustive-deps
4706
- }, [isEqual(props.items, prevCountRef.current)]);
4707
- useEffect(() => {
4708
- if (textInput) {
4709
- textInput.addEventListener('keydown', handleKeyDown);
4710
- textInput.addEventListener('blur', handleTextInputOnBlur);
4711
- }
4712
- document.addEventListener('keydown', handleDocumentKeyDown);
4713
- return () => {
4714
- if (textInput) {
4715
- textInput.removeEventListener('keydown', handleKeyDown);
4716
- textInput.removeEventListener('blur', handleTextInputOnBlur);
4717
- }
4718
- document.removeEventListener('keydown', handleDocumentKeyDown);
4719
- };
4720
- // eslint-disable-next-line react-hooks/exhaustive-deps
4721
- }, [textInput, document]);
4722
- /* istanbul ignore next */
4723
- const handleTextInputOnBlur = e => {
4724
- if (e.relatedTarget === null) {
4725
- setIsOpen(false);
4726
- } else if (e.relatedTarget && !isAutoCompletion) {
4727
- const dropDownEl = e.relatedTarget;
4728
- if (dropDownEl) {
4729
- if (!dropDownEl.id.startsWith(`${PREFIX}-${label}`)) {
4730
- setIsOpen(false);
4731
- }
4732
- }
4733
- }
4734
- };
4735
- const updateDropDownData = item => {
4736
- onChange(item.value);
4737
- setSelectedOption(item.value);
4738
- setInputText(item.label);
4739
- if (isAutoCompletion) {
4740
- const selectedItems = props.items.filter(filterItem => {
4741
- return filterItem.label === item.label;
4705
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
4706
+ const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
4707
+ const InputValue = data && data !== undefined ? data : '';
4708
+ const clonedSchema = JSON.parse(JSON.stringify(schema));
4709
+ const StepValue = clonedSchema.multipleOf ? clonedSchema.multipleOf : 0.01;
4710
+ const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
4711
+ const MaxValue = clonedSchema.exclusiveMaximum ? clonedSchema.exclusiveMaximum : '';
4712
+ const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
4713
+ const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : '100%';
4714
+ const errorsFormInput = checkFieldValidity(props);
4715
+ return jsx(GoAInput, Object.assign({
4716
+ type: "number",
4717
+ error: errorsFormInput.length > 0,
4718
+ disabled: !enabled,
4719
+ readonly: readOnly,
4720
+ value: InputValue,
4721
+ placeholder: placeholder,
4722
+ step: StepValue,
4723
+ min: MinValue,
4724
+ max: MaxValue,
4725
+ width: width,
4726
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
4727
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4728
+ onKeyPress: (name, value, key) => {
4729
+ onKeyPressNumericControl({
4730
+ name,
4731
+ value,
4732
+ key,
4733
+ controlProps: props
4734
+ });
4735
+ },
4736
+ onBlur: (name, value) => {
4737
+ onBlurForNumericControl({
4738
+ name,
4739
+ value,
4740
+ controlProps: props
4741
+ });
4742
+ },
4743
+ onChange: (name, value) => {
4744
+ onChangeForNumericControl({
4745
+ name,
4746
+ value,
4747
+ controlProps: props
4742
4748
  });
4743
- setItems(selectedItems);
4744
- }
4745
- setIsOpen(false);
4746
- };
4747
- const setInputTextFocus = () => {
4748
- const inputEl = document.getElementById(`${id}-input`);
4749
- if (inputEl) {
4750
- //The 'focused' property is part of the GoAInput component that is used to
4751
- //set focus on the input field. We need to set it back to false once we set focus on the input field. Doing with just .focus() doesnt work.
4752
- inputEl.focused = true;
4753
- inputEl.focus();
4754
- inputEl.focused = false;
4755
- }
4756
- };
4757
- const setElementFocus = (e, element, preventDefault) => {
4758
- if (element) {
4759
- element.focus();
4760
- if (preventDefault) {
4761
- e.preventDefault();
4762
- }
4763
- }
4764
- };
4765
- /* istanbul ignore next */
4766
- const handleDocumentKeyDown = e => {
4767
- if (e.key === ESCAPE_KEY || e.key === TAB_KEY) {
4768
- setIsOpen(false);
4769
- }
4770
- };
4771
- /* istanbul ignore next */
4772
- const handleKeyDown = e => {
4773
- var _a, _b, _c;
4774
- if (e.key === ENTER_KEY || e.key === SPACE_KEY) {
4775
- setIsOpen(previousIsOpen => !previousIsOpen);
4776
- const el = document.getElementById(`${PREFIX}-${label}-${(_a = items.at(0)) === null || _a === void 0 ? void 0 : _a.value}`);
4777
- setInputTextFocus();
4778
- setElementFocus(e, el, false);
4779
- } else if (e.key === ARROW_UP_KEY) {
4780
- setIsOpen(true);
4781
- const val = `${PREFIX}-${label}-${(_b = items.at(1)) === null || _b === void 0 ? void 0 : _b.value}`;
4782
- const el = document.getElementById(val);
4783
- setElementFocus(e, el, false);
4784
- } else if (e.key === ARROW_DOWN_KEY) {
4785
- setIsOpen(true);
4786
- const firstItem = props.items.at(0);
4787
- let index = 0;
4788
- if ((firstItem === null || firstItem === void 0 ? void 0 : firstItem.label.trim()) === '') {
4789
- index = 1;
4790
- }
4791
- let el = document.getElementById(`${PREFIX}-${label}-${(_c = props.items.at(index)) === null || _c === void 0 ? void 0 : _c.value}`);
4792
- if (el === null && !isAutoCompletion) {
4793
- const elements = document.querySelectorAll(`[id='${PREFIX}-dropDownList-${label}']`);
4794
- const element = elements.item(0).children.item(1);
4795
- el = document.getElementById(`${PREFIX}-${label}-${element.innerText}`);
4796
- } else if (el === null && isAutoCompletion) {
4797
- const elements = document.querySelectorAll(`[id=${PREFIX}-dropDownList-${label}]`);
4798
- const element = elements[0].children[0];
4799
- el = document.getElementById(`${PREFIX}-${label}-${element.innerText}`);
4800
- }
4801
- setElementFocus(e, el, true);
4802
- } else if (e.key === ESCAPE_KEY || e.key === TAB_KEY) {
4803
- setIsOpen(false);
4804
- } else {
4805
- if (isValidKey(e.key)) {
4806
- setIsOpen(true);
4807
- }
4808
- }
4809
- };
4810
- const handDropDownItemOnKeyDown = (e, item) => {
4811
- var _a, _b, _c, _d;
4812
- if (e.key === ENTER_KEY || e.key === SPACE_KEY) {
4813
- updateDropDownData(item);
4814
- setInputTextFocus();
4815
- }
4816
- if (e.key === ESCAPE_KEY) {
4817
- setIsOpen(false);
4818
- setInputTextFocus();
4819
4749
  }
4820
- let index = items.findIndex(val => {
4821
- return val.label === e.currentTarget.innerText;
4822
- });
4823
- //Prevent jumping to the next control/DOM element if
4824
- //we are on the last item in the drop down list
4825
- if (e.key === ARROW_DOWN_KEY) {
4826
- if (item.label === ((_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.label)) {
4827
- e.preventDefault();
4828
- }
4829
- if (index === -1 && item.label.trim() === '') {
4830
- index = 0;
4831
- }
4832
- const el = document.getElementById(`${PREFIX}-${label}-${(_b = items.at(index + 1)) === null || _b === void 0 ? void 0 : _b.value}`);
4833
- if (el) {
4834
- setElementFocus(e, el, true);
4835
- return;
4836
- }
4750
+ }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
4751
+ };
4752
+ const GoANumberControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4753
+ input: GoANumberInput
4754
+ }));
4755
+ const GoANumberControlTester = rankWith(2, isNumberControl);
4756
+ const GoAInputNumberControl = withJsonFormsControlProps(GoANumberControl);
4757
+
4758
+ const GoAInputInteger = props => {
4759
+ var _a, _b, _c, _d, _e, _f, _g;
4760
+ // eslint-disable-next-line
4761
+ const {
4762
+ data,
4763
+ config,
4764
+ id,
4765
+ enabled,
4766
+ uischema,
4767
+ isValid,
4768
+ path,
4769
+ handleChange,
4770
+ schema,
4771
+ label
4772
+ } = props;
4773
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
4774
+ const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
4775
+ const InputValue = data && data !== undefined ? data : '';
4776
+ const clonedSchema = JSON.parse(JSON.stringify(schema));
4777
+ const StepValue = clonedSchema.multipleOf ? clonedSchema.multipleOf : 0;
4778
+ const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
4779
+ const MaxValue = clonedSchema.exclusiveMaximum ? clonedSchema.exclusiveMaximum : '';
4780
+ const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
4781
+ const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : '100%';
4782
+ const errorsFormInput = checkFieldValidity(props);
4783
+ return jsx(GoAInput, Object.assign({
4784
+ type: "number",
4785
+ error: errorsFormInput.length > 0,
4786
+ width: width,
4787
+ disabled: !enabled,
4788
+ readonly: readOnly,
4789
+ value: InputValue,
4790
+ step: StepValue,
4791
+ min: MinValue,
4792
+ max: MaxValue,
4793
+ placeholder: placeholder,
4794
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
4795
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4796
+ onKeyPress: (name, value, key) => {
4797
+ onKeyPressNumericControl({
4798
+ name,
4799
+ value,
4800
+ key,
4801
+ controlProps: props
4802
+ });
4803
+ },
4804
+ onBlur: (name, value) => {
4805
+ onBlurForNumericControl({
4806
+ name,
4807
+ value,
4808
+ controlProps: props
4809
+ });
4810
+ },
4811
+ onChange: (name, value) => {
4812
+ onChangeForNumericControl({
4813
+ name,
4814
+ value,
4815
+ controlProps: props
4816
+ });
4837
4817
  }
4838
- if (e.key === ARROW_UP_KEY) {
4839
- if (index <= 0) {
4840
- e.preventDefault();
4841
- return;
4842
- }
4843
- const el = document.getElementById(`${PREFIX}-${label}-${(_c = items.at(index - 1)) === null || _c === void 0 ? void 0 : _c.value}`);
4844
- if (el) {
4845
- el.focus();
4846
- }
4818
+ }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
4819
+ };
4820
+ const GoAIntegerControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4821
+ input: GoAInputInteger
4822
+ }));
4823
+ const GoAIntegerControlTester = rankWith(2, isIntegerControl);
4824
+ const GoAInputIntegerControl = withJsonFormsControlProps(GoAIntegerControl);
4825
+
4826
+ const GoADateTimeInput = props => {
4827
+ var _a, _b, _c, _d, _e, _f, _g;
4828
+ // eslint-disable-next-line
4829
+ const {
4830
+ data,
4831
+ config,
4832
+ id,
4833
+ enabled,
4834
+ uischema,
4835
+ isValid,
4836
+ path,
4837
+ errors,
4838
+ handleChange,
4839
+ schema,
4840
+ label
4841
+ } = props;
4842
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
4843
+ const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
4844
+ const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : '100%';
4845
+ return jsx(GoAInputDateTime, Object.assign({
4846
+ error: checkFieldValidity(props).length > 0,
4847
+ width: width,
4848
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
4849
+ value: data ? new Date(data).toISOString() : '',
4850
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4851
+ disabled: !enabled,
4852
+ readonly: readOnly,
4853
+ onChange: (name, value) => {
4854
+ onChangeForDateTimeControl({
4855
+ name,
4856
+ value,
4857
+ controlProps: props
4858
+ });
4859
+ },
4860
+ onKeyPress: (name, value, key) => {
4861
+ onKeyPressForDateControl({
4862
+ name,
4863
+ value,
4864
+ key,
4865
+ controlProps: props
4866
+ });
4867
+ },
4868
+ onBlur: (name, value) => {
4869
+ onBlurForDateControl({
4870
+ name,
4871
+ value,
4872
+ controlProps: props
4873
+ });
4847
4874
  }
4848
- if (e.key === TAB_KEY) {
4849
- const val = `${PREFIX}-${label}-${(_d = items.at(index - 1)) === null || _d === void 0 ? void 0 : _d.value}`;
4850
- const el = document.getElementById(val);
4851
- if (el) {
4852
- setIsOpen(false);
4853
- }
4875
+ }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
4876
+ };
4877
+ const GoADateTimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4878
+ input: GoADateTimeInput
4879
+ }));
4880
+ const GoADateTimeControlTester = rankWith(2, isDateTimeControl);
4881
+ const GoAInputDateTimeControl = withJsonFormsControlProps(GoADateTimeControl);
4882
+
4883
+ const GoATimeInput = props => {
4884
+ var _a, _b, _c, _d, _e, _f, _g;
4885
+ // eslint-disable-next-line
4886
+ const {
4887
+ data,
4888
+ config,
4889
+ id,
4890
+ enabled,
4891
+ uischema,
4892
+ isValid,
4893
+ path,
4894
+ handleChange,
4895
+ schema,
4896
+ label
4897
+ } = props;
4898
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
4899
+ (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
4900
+ const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
4901
+ const errorsFormInput = checkFieldValidity(props);
4902
+ const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.readOnly) !== null && _f !== void 0 ? _f : '100%';
4903
+ return jsx(GoAInputTime, Object.assign({
4904
+ error: errorsFormInput.length > 0,
4905
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
4906
+ value: data,
4907
+ step: 1,
4908
+ width: width,
4909
+ disabled: !enabled,
4910
+ readonly: readOnly,
4911
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
4912
+ onBlur: (name, value) => {
4913
+ onBlurForTimeControl({
4914
+ name,
4915
+ value,
4916
+ controlProps: props
4917
+ });
4918
+ },
4919
+ // Dont use handleChange in the onChange event, use the keyPress or onBlur.
4920
+ // If you use it onChange along with keyPress event it will cause a
4921
+ // side effect that causes the validation to render when it shouldnt.
4922
+ onChange: (name, value) => {},
4923
+ onKeyPress: (name, value, key) => {
4924
+ onKeyPressForTimeControl({
4925
+ name,
4926
+ value,
4927
+ key,
4928
+ controlProps: props
4929
+ });
4854
4930
  }
4855
- };
4856
- return jsxs("div", {
4857
- "data-testid": id,
4858
- children: [jsx(GoADropdownTextbox, {
4859
- isOpen: isOpen,
4860
- onClick: e => {
4861
- setIsOpen(previousIsOpen => !previousIsOpen);
4862
- },
4863
- children: jsx(GoAInput, {
4864
- disabled: !enabled,
4865
- name: `dropdown-${label}`,
4866
- width: "100%",
4867
- value: inputText,
4868
- testId: `${id}-input`,
4869
- id: `${id}-input`,
4870
- readonly: !isAutoCompletion,
4871
- onChange: (name, value) => {
4872
- if (isAutoCompletion) {
4873
- setInputText(value);
4874
- const selectedItems = props.items.filter(item => {
4875
- return item.label.includes(value);
4876
- });
4877
- setItems(selectedItems);
4878
- }
4879
- },
4880
- onTrailingIconClick: () => {},
4881
- trailingIcon: trailingIcon
4882
- })
4883
- }), jsx(GoADropdownListContainerWrapper, {
4884
- isOpen: isOpen,
4885
- id: `${PREFIX}-dropDownListContainerWrapper-${label}`,
4886
- children: jsx(GoADropdownListContainer, {
4887
- id: `${PREFIX}-dropDownList-${label}`,
4888
- optionListMaxHeight: optionListMaxHeight,
4889
- children: items.map(item => {
4890
- return jsx(GoADropdownListOption, {
4891
- id: `${PREFIX}-option-${label}-${item.value}`,
4892
- isSelected: item.value === selected || item.value === selectedOption,
4893
- children: jsx("div", {
4894
- tabIndex: 0,
4895
- className: "dropDownListItem",
4896
- "data-testid": `${id}-${item.label}-option`,
4897
- id: `${PREFIX}-${label}-${item.value}`,
4898
- onKeyDown: e => {
4899
- handDropDownItemOnKeyDown(e, item);
4900
- },
4901
- onClick: e => {
4902
- updateDropDownData(item);
4903
- },
4904
- children: item.label
4905
- }, `${PREFIX}-${label}-${item.value}`)
4906
- }, `${PREFIX}-option-${label}-${item.value}`);
4907
- })
4908
- }, `${PREFIX}-dropDownList-${label}`)
4909
- }, `${PREFIX}-dropDownListContainerWrapper-${label}`)]
4910
- }, id);
4931
+ }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
4911
4932
  };
4933
+ const GoATimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4934
+ input: GoATimeInput
4935
+ }));
4936
+ const GoATimeControlTester = rankWith(4, isTimeControl);
4937
+ const GoAInputTimeControl = withJsonFormsControlProps(GoATimeControl);
4912
4938
 
4913
4939
  function fetchRegisterConfigFromOptions(options) {
4914
4940
  if (!(options === null || options === void 0 ? void 0 : options.url) && !(options === null || options === void 0 ? void 0 : options.urn)) return undefined;
@@ -5353,7 +5379,7 @@ const ReviewItemSection = styled.div(_t2$4 || (_t2$4 = _$5`
5353
5379
  border-radius: 5px;
5354
5380
 
5355
5381
  .element-style {
5356
- max-width: 1439px;
5382
+ max-width: 1600px;
5357
5383
  }
5358
5384
  `));
5359
5385
  const ReviewItemHeader = styled.div(_t3$3 || (_t3$3 = _$5`
@@ -6041,7 +6067,7 @@ const JsonFormsStepperContextProvider = ({
6041
6067
  }
6042
6068
  });
6043
6069
  }
6044
- }, [StepperProps.uischema]);
6070
+ }, [JSON.stringify(StepperProps.uischema)]);
6045
6071
  return jsx(JsonFormsStepperContext.Provider, {
6046
6072
  value: context,
6047
6073
  children: children
@@ -6678,7 +6704,7 @@ const NonEmptyCellStyle = styled.div(_t2$2 || (_t2$2 = _$2`
6678
6704
  const ToolBarHeader = styled.div(_t3$1 || (_t3$1 = _$2`
6679
6705
  margin-bottom: var(--goa-space-l);
6680
6706
  `));
6681
- const ObjectArrayTitle = styled.h2(_t4$1 || (_t4$1 = _$2`
6707
+ const ObjectArrayTitle = styled.h3(_t4$1 || (_t4$1 = _$2`
6682
6708
  margin-bottom: var(--goa-space-l);
6683
6709
  `));
6684
6710
  const TextCenter = styled.div(_t5$1 || (_t5$1 = _$2`
@@ -8397,7 +8423,6 @@ const AddressLookUpControl = props => {
8397
8423
  const formCtx = useContext(JsonFormContext);
8398
8424
  const formHost = formCtx === null || formCtx === void 0 ? void 0 : formCtx.formUrl;
8399
8425
  const formUrl = `${formHost}/${ADDRESS_PATH}`;
8400
- const ctx = useJsonForms();
8401
8426
  const autocompletion = ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.autocomplete) !== false;
8402
8427
  const [open, setOpen] = useState(false);
8403
8428
  const label = typeof (uischema === null || uischema === void 0 ? void 0 : uischema.label) === 'string' && uischema.label ? uischema.label : '';
@@ -8451,23 +8476,6 @@ const AddressLookUpControl = props => {
8451
8476
  showLabel: false
8452
8477
  }));
8453
8478
  };
8454
- useEffect(() => {
8455
- var _a;
8456
- if ((_a = ctx.core) === null || _a === void 0 ? void 0 : _a.ajv) {
8457
- // eslint-disable-next-line
8458
- const newError = [];
8459
- Object.keys(errors).forEach(err => {
8460
- newError.push({
8461
- instancePath: path,
8462
- message: err,
8463
- schemaPath: '',
8464
- keyword: '',
8465
- params: {}
8466
- });
8467
- });
8468
- ctx.core.ajv.errors = newError;
8469
- }
8470
- }, [errors, ctx, path]);
8471
8479
  useEffect(() => {
8472
8480
  const fetchSuggestions = () => __awaiter(void 0, void 0, void 0, function* () {
8473
8481
  if (searchTerm.length > 2 && dropdownSelected === false) {