@abgov/jsonforms-components 2.48.2 → 2.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.esm.js +128 -459
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import * as runtime from 'react/jsx-runtime';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
3
  import React, { createContext, useContext, useReducer, useMemo, useEffect, useCallback, useRef, useState, useLayoutEffect } from 'react';
4
- import { GoabFormItem, GoabInput, GoabTextArea, GoabCallout, GoabRadioGroup, GoabRadioItem, GoabCheckbox, GoabIcon, GoabButton, GoabGrid, GoabIconButton, GoabTable, GoabModal, GoabButtonGroup, GoabContainer, GoabDropdown, GoabDropdownItem, GoabDetails, GoabFormStepper, GoabFormStep, GoabPages, GoabBadge, GoabText, GoabFileUploadInput, GoabCircularProgress, GoabSpinner } from '@abgov/react-components';
4
+ import { GoabFormItem, GoabDropdown, GoabDropdownItem, GoabInput, GoabTextArea, GoabCallout, GoabRadioGroup, GoabRadioItem, GoabCheckbox, GoabIcon, GoabButton, GoabGrid, GoabIconButton, GoabTable, GoabModal, GoabButtonGroup, GoabContainer, GoabDetails, GoabFormStepper, GoabFormStep, GoabPages, GoabBadge, GoabText, GoabFileUploadInput, GoabCircularProgress, GoabSpinner } from '@abgov/react-components';
5
5
  import styled from 'styled-components';
6
6
  import axios from 'axios';
7
7
  import get$1 from 'lodash/get';
8
8
  import { isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, isBooleanControl, createDefaultValue, Paths, Resolve, toDataPath, schemaMatches, getAjv, or, isObjectArrayControl, isPrimitiveArrayControl, composePaths, schemaTypeIs, formatIs, hasType, isCategorization, isLayout } from '@jsonforms/core';
9
- import * as _$c from 'lodash';
10
- import ___default, { isEqual, isObject as isObject$i, isEmpty as isEmpty$1 } from 'lodash';
9
+ import * as _$b from 'lodash';
10
+ import ___default, { isObject as isObject$i, isEmpty as isEmpty$1 } from 'lodash';
11
11
  import { useJsonForms, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsArrayLayoutProps, withJsonFormsLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
12
12
  import Ajv from 'ajv';
13
13
  import dompurify from 'dompurify';
@@ -3567,16 +3567,16 @@ const ensureGoaDatePointerCursor = host => {
3567
3567
  sr.appendChild(style);
3568
3568
  };
3569
3569
 
3570
- let _$b = t => t,
3571
- _t$c,
3572
- _t2$7;
3573
- styled.div(_t$c || (_t$c = _$b`
3570
+ let _$a = t => t,
3571
+ _t$b,
3572
+ _t2$6;
3573
+ styled.div(_t$b || (_t$b = _$a`
3574
3574
  height: 70vh;
3575
3575
  overflow-y: auto;
3576
3576
  padding-left: var(--goa-space-2xs);
3577
3577
  padding-right: var(--goa-space-2xs);
3578
3578
  `));
3579
- const Visible = styled.div(_t2$7 || (_t2$7 = _$b`
3579
+ const Visible = styled.div(_t2$6 || (_t2$6 = _$a`
3580
3580
  display: ${0};
3581
3581
  width: 100%;
3582
3582
  `), p => p.visible ? 'block' : 'none');
@@ -5199,12 +5199,12 @@ const JsonFormRegisterProvider = ({
5199
5199
  });
5200
5200
  };
5201
5201
 
5202
- let _$a = t => t,
5203
- _t$b,
5204
- _t2$6,
5205
- _t3$5,
5206
- _t4$5,
5207
- _t5$4,
5202
+ let _$9 = t => t,
5203
+ _t$a,
5204
+ _t2$5,
5205
+ _t3$4,
5206
+ _t4$4,
5207
+ _t5$3,
5208
5208
  _t6$3,
5209
5209
  _t7$2,
5210
5210
  _t8$2,
@@ -5212,10 +5212,10 @@ let _$a = t => t,
5212
5212
  _t0$2,
5213
5213
  _t1$2,
5214
5214
  _t10$2;
5215
- const FormFieldWrapper = styled.div(_t$b || (_t$b = _$a`
5215
+ const FormFieldWrapper = styled.div(_t$a || (_t$a = _$9`
5216
5216
  margin-bottom: var(--goa-space-l);
5217
5217
  `));
5218
- const WarningIconDiv = styled.div(_t2$6 || (_t2$6 = _$a`
5218
+ const WarningIconDiv = styled.div(_t2$5 || (_t2$5 = _$9`
5219
5219
  display: flex;
5220
5220
  align-items: flex-start;
5221
5221
  gap: var(--goa-space-2xs);
@@ -5223,58 +5223,58 @@ const WarningIconDiv = styled.div(_t2$6 || (_t2$6 = _$a`
5223
5223
  color: var(--goa-form-item-error-message-color);
5224
5224
  margin-top: var(--goa-form-item-message-margin-top);
5225
5225
  `));
5226
- const RequiredTextLabel = styled.label(_t3$5 || (_t3$5 = _$a`
5226
+ const RequiredTextLabel = styled.label(_t3$4 || (_t3$4 = _$9`
5227
5227
  color: var(--goa-color-greyscale-700);
5228
5228
  font-weight: var(--goa-font-weight-regular);
5229
5229
  font-size: var(--goa-font-size-2);
5230
5230
  line-height: var(--goa-line-height-1);
5231
5231
  font-style: normal;
5232
5232
  `));
5233
- styled.td(_t4$5 || (_t4$5 = _$a`
5233
+ styled.td(_t4$4 || (_t4$4 = _$9`
5234
5234
  width: 40%;
5235
5235
  padding-top: var(--goa-space-s);
5236
5236
  padding-bottom: var(--goa-space-s);
5237
5237
  padding-right: var(--goa-space-m);
5238
5238
  vertical-align: top;
5239
5239
  `));
5240
- styled.td(_t5$4 || (_t5$4 = _$a`
5240
+ styled.td(_t5$3 || (_t5$3 = _$9`
5241
5241
  width: 40%;
5242
5242
  text-align: left;
5243
5243
  vertical-align: top;
5244
5244
  `));
5245
- const PageReviewContainer = styled.td(_t6$3 || (_t6$3 = _$a`
5245
+ const PageReviewContainer = styled.td(_t6$3 || (_t6$3 = _$9`
5246
5246
  padding: 12px 0px;
5247
5247
  border-bottom: 1px solid #ccc;
5248
5248
  width: 100%;
5249
5249
  vertical-align: top;
5250
5250
  `));
5251
- const ReviewHeader = styled.div(_t7$2 || (_t7$2 = _$a`
5251
+ const ReviewHeader = styled.div(_t7$2 || (_t7$2 = _$9`
5252
5252
  display: flex;
5253
5253
  justify-content: space-between;
5254
5254
  align-items: center;
5255
5255
  width: 100%;
5256
5256
  `));
5257
- const ReviewLabel = styled.div(_t8$2 || (_t8$2 = _$a`
5257
+ const ReviewLabel = styled.div(_t8$2 || (_t8$2 = _$9`
5258
5258
  font-weight: var(--goa-font-weight-bold);
5259
5259
  font-size: var(--goa-font-size-4);
5260
5260
  line-height: var(--goa-line-height-3);
5261
5261
  color: var(--goa-color-text-default);
5262
5262
  `));
5263
- const ReviewValue = styled.div(_t9$2 || (_t9$2 = _$a`
5263
+ const ReviewValue = styled.div(_t9$2 || (_t9$2 = _$9`
5264
5264
  margin-top: var(--goa-space-m);
5265
5265
  color: var(--goa-color-text-default);
5266
5266
  font-size: var(--goa-font-size-4);
5267
5267
  line-height: var(--goa-line-height-3);
5268
5268
  `));
5269
5269
  //Check and unchecked are different heights otherwise
5270
- const CheckboxWrapper = styled.div(_t0$2 || (_t0$2 = _$a`
5270
+ const CheckboxWrapper = styled.div(_t0$2 || (_t0$2 = _$9`
5271
5271
  min-height: 28px;
5272
5272
  `));
5273
- styled.h4(_t1$2 || (_t1$2 = _$a`
5273
+ styled.h4(_t1$2 || (_t1$2 = _$9`
5274
5274
  margin: 0 0 0.25rem 0;
5275
5275
  fontsize: larger;
5276
5276
  `));
5277
- styled.h4(_t10$2 || (_t10$2 = _$a`
5277
+ styled.h4(_t10$2 || (_t10$2 = _$9`
5278
5278
  border-bottom: 1px solid #ddd;
5279
5279
  `));
5280
5280
 
@@ -5399,7 +5399,7 @@ const pickPropertyValues = (obj, property, endWithType) => {
5399
5399
  Object.entries(obj).forEach(function ([key, value]) {
5400
5400
  if (key === property) {
5401
5401
  values.push(value);
5402
- } else if (_$c.isObject(value)) {
5402
+ } else if (_$b.isObject(value)) {
5403
5403
  // if the object type is equal to end type, we are not going to continue the recursive approach
5404
5404
  if ((value == null ? void 0 : value.type) === endWithType) {
5405
5405
  if (property in value) {
@@ -5408,7 +5408,7 @@ const pickPropertyValues = (obj, property, endWithType) => {
5408
5408
  } else {
5409
5409
  values = [...values, ...pickPropertyValues(value, property, endWithType)];
5410
5410
  }
5411
- } else if (_$c.isArray(value)) {
5411
+ } else if (_$b.isArray(value)) {
5412
5412
  const nextValues = value.map(function (arrayObj) {
5413
5413
  return pickPropertyValues(arrayObj, property, endWithType);
5414
5414
  });
@@ -6925,401 +6925,6 @@ fixRegExpWellKnownSymbolLogic$1('match', function (MATCH, nativeMatch, maybeCall
6925
6925
  ];
6926
6926
  });
6927
6927
 
6928
- // a string of all valid unicode whitespaces
6929
- var whitespaces$3 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
6930
- '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
6931
-
6932
- var uncurryThis$a = functionUncurryThis;
6933
- var requireObjectCoercible$4 = requireObjectCoercible$e;
6934
- var toString$8 = toString$m;
6935
- var whitespaces$2 = whitespaces$3;
6936
-
6937
- var replace$3 = uncurryThis$a(''.replace);
6938
- var ltrim = RegExp('^[' + whitespaces$2 + ']+');
6939
- var rtrim = RegExp('(^|[^' + whitespaces$2 + '])[' + whitespaces$2 + ']+$');
6940
-
6941
- // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
6942
- var createMethod$1 = function (TYPE) {
6943
- return function ($this) {
6944
- var string = toString$8(requireObjectCoercible$4($this));
6945
- if (TYPE & 1) string = replace$3(string, ltrim, '');
6946
- if (TYPE & 2) string = replace$3(string, rtrim, '$1');
6947
- return string;
6948
- };
6949
- };
6950
-
6951
- var stringTrim = {
6952
- // `String.prototype.trim` method
6953
- // https://tc39.es/ecma262/#sec-string.prototype.trim
6954
- trim: createMethod$1(3)
6955
- };
6956
-
6957
- var PROPER_FUNCTION_NAME = functionName.PROPER;
6958
- var fails$3 = fails$x;
6959
- var whitespaces$1 = whitespaces$3;
6960
-
6961
- var non = '\u200B\u0085\u180E';
6962
-
6963
- // check that a method works with the correct list
6964
- // of whitespaces and has a correct name
6965
- var stringTrimForced = function (METHOD_NAME) {
6966
- return fails$3(function () {
6967
- return !!whitespaces$1[METHOD_NAME]()
6968
- || non[METHOD_NAME]() !== non
6969
- || (PROPER_FUNCTION_NAME && whitespaces$1[METHOD_NAME].name !== METHOD_NAME);
6970
- });
6971
- };
6972
-
6973
- var $$a = _export;
6974
- var $trim = stringTrim.trim;
6975
- var forcedStringTrimMethod = stringTrimForced;
6976
-
6977
- // `String.prototype.trim` method
6978
- // https://tc39.es/ecma262/#sec-string.prototype.trim
6979
- $$a({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
6980
- trim: function trim() {
6981
- return $trim(this);
6982
- }
6983
- });
6984
-
6985
- const ENTER_KEY = 'Enter';
6986
- const ESCAPE_KEY = 'Escape';
6987
- const ARROW_DOWN_KEY = 'ArrowDown';
6988
- const ARROW_UP_KEY = 'ArrowUp';
6989
- const TAB_KEY = 'Tab';
6990
- const SPACE_KEY = ' ';
6991
- const ALT_KEY = 'Alt';
6992
- const SHIFT_KEY = 'Shift';
6993
-
6994
- let _$9 = t => t,
6995
- _t$a,
6996
- _t2$5,
6997
- _t3$4,
6998
- _t4$4,
6999
- _t5$3;
7000
- const GoADropdownTextbox = styled.div(_t$a || (_t$a = _$9`
7001
- border-radius: var(--goa-space-2xs);
7002
- box-shadow: ${0};
7003
- &:hover {
7004
- cursor: pointer;
7005
- }
7006
-
7007
- .inputStyle {
7008
- box-shadow: ${0};
7009
- }
7010
- `), 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` : '');
7011
- const GoADropdownListContainerWrapper = styled.div(_t2$5 || (_t2$5 = _$9`
7012
- position: relative;
7013
- display: ${0};
7014
- `), p => !(p != null && p.isOpen) && 'none');
7015
- const GoADropdownListContainer = styled.div(_t3$4 || (_t3$4 = _$9`
7016
- border: solid 1px var(--goa-color-greyscale-200);
7017
- border-radius: var(--goa-space-2xs);
7018
- background: var(--goa-color-greyscale-white);
7019
- padding: 0;
7020
- margin-top: 3px;
7021
- width: 100%;
7022
- overflow-y: auto;
7023
- z-index: 1000;
7024
- caret-color: transparent;
7025
- position: absolute;
7026
- line-height: var(--goa-space-xl);
7027
- max-height: ${0};
7028
-
7029
- &:focus-visible {
7030
- outline-color: var(--goa-color-interactive-default);
7031
- }
7032
- &:hover {
7033
- background-color: var(--goa-color-interactive-hover) !important;
7034
- color: #fff !important;
7035
- /* Fix to override scrollbar color in Firefox */
7036
- scrollbar-color: #a8a8a8 var(--goa-color-greyscale-100) !important;
7037
- }
7038
- `), p => p.optionListMaxHeight || '272px');
7039
- const GoADropdownListOption = styled.div(_t4$4 || (_t4$4 = _$9`
7040
- padding: var(--goa-space-2xs) var(--goa-space-s);
7041
- text-overflow: ellipsis;
7042
- color: ${0} !important;
7043
- border: 0px solid var(--goa-color-greyscale-100);
7044
- z-index: 1001;
7045
- cursor: pointer;
7046
- background: ${0};
7047
- :has(div:focus) {
7048
- background-color: ${0};
7049
- color: ${0};
7050
- }
7051
- &:hover {
7052
- background-color: ${0};
7053
- color: ${0};
7054
- }
7055
-
7056
- &:focus-visible {
7057
- caret-color: transparent;
7058
- color: black !important;
7059
- background-color: ${0};
7060
- }
7061
- &:focus-within {
7062
- caret-color: transparent;
7063
- color: #fff !important;
7064
- background-color: ${0};
7065
- }
7066
- .dropDownListItem:focus-visible {
7067
- caret-color: transparent;
7068
- outline: none !important;
7069
- color: ${0};
7070
- }
7071
- `), 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');
7072
- const LabelItem = styled.span(_t5$3 || (_t5$3 = _$9`
7073
- font: var(--goa-dropdown-typography);
7074
- `));
7075
-
7076
- const isValidKey = keyCode => {
7077
- if (keyCode === SHIFT_KEY || keyCode === ALT_KEY) return false;
7078
- const regex = new RegExp(/^[a-zA-Z0-9!%$@.#?\-_]+$/);
7079
- return regex.test(keyCode);
7080
- };
7081
- const Dropdown = props => {
7082
- var _document$getElements;
7083
- const {
7084
- label,
7085
- selected,
7086
- onChange,
7087
- optionListMaxHeight,
7088
- isAutoCompletion,
7089
- enabled,
7090
- id,
7091
- width
7092
- } = props;
7093
- const [isOpen, setIsOpen] = useState(false);
7094
- const [selectedOption, setSelectedOption] = useState(selected);
7095
- const [items, setItems] = useState(props.items);
7096
- const [inputText, setInputText] = useState(selected);
7097
- const prevCountRef = useRef(props.items);
7098
- const trailingIcon = isOpen ? 'chevron-up' : 'chevron-down';
7099
- const textInputName = `dropdown-${label}-${id}`;
7100
- const textInput = (_document$getElements = document.getElementsByName(textInputName)[0]) != null ? _document$getElements : null;
7101
- const PREFIX = 'jsonforms-dropdown';
7102
- useEffect(() => {
7103
- setItems(props.items);
7104
- prevCountRef.current = props.items;
7105
- // eslint-disable-next-line react-hooks/exhaustive-deps
7106
- }, [isEqual(props.items, prevCountRef.current)]);
7107
- useEffect(() => {
7108
- if (textInput) {
7109
- textInput.addEventListener('keydown', handleKeyDown);
7110
- textInput.addEventListener('blur', handleTextInputOnBlur);
7111
- }
7112
- document.addEventListener('keydown', handleDocumentKeyDown);
7113
- return () => {
7114
- if (textInput) {
7115
- textInput.removeEventListener('keydown', handleKeyDown);
7116
- textInput.removeEventListener('blur', handleTextInputOnBlur);
7117
- }
7118
- document.removeEventListener('keydown', handleDocumentKeyDown);
7119
- };
7120
- // eslint-disable-next-line react-hooks/exhaustive-deps
7121
- }, [textInput, document]);
7122
- /* istanbul ignore next */
7123
- const handleTextInputOnBlur = e => {
7124
- if (e.relatedTarget === null) {
7125
- setIsOpen(false);
7126
- } else if (e.relatedTarget && !isAutoCompletion) {
7127
- const dropDownEl = e.relatedTarget;
7128
- if (dropDownEl) {
7129
- if (!dropDownEl.id.startsWith(`${PREFIX}-${label}`)) {
7130
- setIsOpen(false);
7131
- }
7132
- }
7133
- }
7134
- };
7135
- const updateDropDownData = item => {
7136
- onChange(item.value);
7137
- setSelectedOption(item.value);
7138
- setInputText(item.label);
7139
- if (isAutoCompletion) {
7140
- const selectedItems = props.items.filter(filterItem => {
7141
- return filterItem.label === item.label;
7142
- });
7143
- setItems(selectedItems);
7144
- }
7145
- setIsOpen(false);
7146
- };
7147
- const setInputTextFocus = () => {
7148
- const inputEl = document.getElementById(`${id}-input`);
7149
- if (inputEl) {
7150
- //The 'focused' property is part of the GoabInput component that is used to
7151
- //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.
7152
- inputEl.focused = true;
7153
- inputEl.focus();
7154
- inputEl.focused = false;
7155
- }
7156
- };
7157
- const setElementFocus = (e, element, preventDefault) => {
7158
- if (element) {
7159
- element.focus();
7160
- if (preventDefault) {
7161
- e.preventDefault();
7162
- }
7163
- }
7164
- };
7165
- /* istanbul ignore next */
7166
- const handleDocumentKeyDown = e => {
7167
- if (e.key === ESCAPE_KEY || e.key === TAB_KEY) {
7168
- setIsOpen(false);
7169
- }
7170
- };
7171
- /* istanbul ignore next */
7172
- const handleKeyDown = e => {
7173
- if (e.key === ENTER_KEY || e.key === SPACE_KEY) {
7174
- var _items$at;
7175
- setIsOpen(previousIsOpen => !previousIsOpen);
7176
- const el = document.getElementById(`${PREFIX}-${label}-${(_items$at = items.at(0)) == null ? void 0 : _items$at.value}`);
7177
- setInputTextFocus();
7178
- setElementFocus(e, el, false);
7179
- } else if (e.key === ARROW_UP_KEY) {
7180
- var _items$at2;
7181
- setIsOpen(true);
7182
- const val = `${PREFIX}-${label}-${(_items$at2 = items.at(1)) == null ? void 0 : _items$at2.value}`;
7183
- const el = document.getElementById(val);
7184
- setElementFocus(e, el, false);
7185
- } else if (e.key === ARROW_DOWN_KEY) {
7186
- var _props$items$at;
7187
- setIsOpen(true);
7188
- const firstItem = props.items.at(0);
7189
- let index = 0;
7190
- if ((firstItem == null ? void 0 : firstItem.label.trim()) === '') {
7191
- index = 1;
7192
- }
7193
- let el = document.getElementById(`${PREFIX}-${label}-${(_props$items$at = props.items.at(index)) == null ? void 0 : _props$items$at.value}`);
7194
- if (el === null && !isAutoCompletion) {
7195
- const elements = document.querySelectorAll(`[id='${PREFIX}-dropDownList-${label}']`);
7196
- const element = elements.item(0).children.item(1);
7197
- el = document.getElementById(`${PREFIX}-${label}-${element.innerText}`);
7198
- } else if (el === null && isAutoCompletion) {
7199
- const elements = document.querySelectorAll(`[id=${PREFIX}-dropDownList-${label}]`);
7200
- const element = elements[0].children[0];
7201
- el = document.getElementById(`${PREFIX}-${label}-${element.innerText}`);
7202
- }
7203
- setElementFocus(e, el, true);
7204
- } else if (e.key === ESCAPE_KEY || e.key === TAB_KEY) {
7205
- setIsOpen(false);
7206
- } else {
7207
- if (isValidKey(e.key)) {
7208
- setIsOpen(true);
7209
- }
7210
- }
7211
- };
7212
- const handDropDownItemOnKeyDown = (e, item) => {
7213
- if (e.key === ENTER_KEY || e.key === SPACE_KEY) {
7214
- updateDropDownData(item);
7215
- setInputTextFocus();
7216
- }
7217
- if (e.key === ESCAPE_KEY) {
7218
- setIsOpen(false);
7219
- setInputTextFocus();
7220
- }
7221
- let index = items.findIndex(val => {
7222
- return val.label === e.currentTarget.innerText;
7223
- });
7224
- //Prevent jumping to the next control/DOM element if
7225
- //we are on the last item in the drop down list
7226
- if (e.key === ARROW_DOWN_KEY) {
7227
- var _items$at3, _items$at4;
7228
- if (item.label === ((_items$at3 = items.at(-1)) == null ? void 0 : _items$at3.label)) {
7229
- e.preventDefault();
7230
- }
7231
- if (index === -1 && item.label.trim() === '') {
7232
- index = 0;
7233
- }
7234
- const el = document.getElementById(`${PREFIX}-${label}-${(_items$at4 = items.at(index + 1)) == null ? void 0 : _items$at4.value}`);
7235
- if (el) {
7236
- setElementFocus(e, el, true);
7237
- return;
7238
- }
7239
- }
7240
- if (e.key === ARROW_UP_KEY) {
7241
- var _items$at5;
7242
- if (index <= 0) {
7243
- e.preventDefault();
7244
- return;
7245
- }
7246
- const el = document.getElementById(`${PREFIX}-${label}-${(_items$at5 = items.at(index - 1)) == null ? void 0 : _items$at5.value}`);
7247
- if (el) {
7248
- el.focus();
7249
- }
7250
- }
7251
- if (e.key === TAB_KEY) {
7252
- var _items$at6;
7253
- const val = `${PREFIX}-${label}-${(_items$at6 = items.at(index - 1)) == null ? void 0 : _items$at6.value}`;
7254
- const el = document.getElementById(val);
7255
- if (el) {
7256
- setIsOpen(false);
7257
- }
7258
- }
7259
- };
7260
- return jsxs("div", {
7261
- "data-testid": id,
7262
- style: {
7263
- width: width || '100%'
7264
- },
7265
- children: [jsx(GoADropdownTextbox, {
7266
- isOpen: isOpen,
7267
- onClick: e => {
7268
- setIsOpen(previousIsOpen => !previousIsOpen);
7269
- },
7270
- children: jsx(GoabInput, {
7271
- disabled: !enabled,
7272
- name: `dropdown-${label}-${id}`,
7273
- width: "100%",
7274
- value: inputText,
7275
- testId: `${id}-input`,
7276
- ariaLabel: `${id}-input`,
7277
- id: `${id}-input`,
7278
- readonly: !isAutoCompletion,
7279
- onChange: detail => {
7280
- if (isAutoCompletion) {
7281
- setInputText(detail.value);
7282
- const selectedItems = props.items.filter(item => {
7283
- return item.label.includes(detail.value);
7284
- });
7285
- setItems(selectedItems);
7286
- }
7287
- },
7288
- onTrailingIconClick: () => {},
7289
- trailingIcon: trailingIcon
7290
- })
7291
- }), jsx(GoADropdownListContainerWrapper, {
7292
- isOpen: isOpen,
7293
- id: `${PREFIX}-dropDownListContainerWrapper-${label}`,
7294
- children: jsx(GoADropdownListContainer, {
7295
- id: `${PREFIX}-dropDownList-${label}`,
7296
- optionListMaxHeight: optionListMaxHeight,
7297
- children: items.map(item => {
7298
- return jsx(GoADropdownListOption, {
7299
- id: `${PREFIX}-option-${label}-${item.value}`,
7300
- isSelected: item.value === selected || item.value === selectedOption,
7301
- children: jsx("div", {
7302
- tabIndex: 0,
7303
- className: "dropDownListItem",
7304
- "data-testid": `${id}-${item.label}-option`,
7305
- id: `${PREFIX}-${label}-${item.value}`,
7306
- onKeyDown: e => {
7307
- handDropDownItemOnKeyDown(e, item);
7308
- },
7309
- onClick: e => {
7310
- updateDropDownData(item);
7311
- },
7312
- children: jsx(LabelItem, {
7313
- children: item.label
7314
- })
7315
- }, `${PREFIX}-${label}-${item.value}`)
7316
- }, `${PREFIX}-option-${label}-${item.value}`);
7317
- })
7318
- }, `${PREFIX}-dropDownList-${label}`)
7319
- }, `${PREFIX}-dropDownListContainerWrapper-${label}`)]
7320
- }, id);
7321
- };
7322
-
7323
6928
  //type DebounceValueType = string | boolean | number | Record<string, unknown>;
7324
6929
  /**
7325
6930
  * A helper util to return a value at a certain delay. The delay is reset if the value arg changes
@@ -7439,18 +7044,20 @@ const GoAInputText = props => {
7439
7044
  const autoCapitalize = (uischema == null || (_uischema$options2 = uischema.options) == null || (_uischema$options2 = _uischema$options2.componentProps) == null ? void 0 : _uischema$options2.autoCapitalize) === true || (uischema == null || (_uischema$options3 = uischema.options) == null ? void 0 : _uischema$options3.autoCapitalize) === true;
7440
7045
  const readOnly = (_uischema$options$com2 = uischema == null || (_uischema$options4 = uischema.options) == null || (_uischema$options4 = _uischema$options4.componentProps) == null ? void 0 : _uischema$options4.readOnly) != null ? _uischema$options$com2 : false;
7441
7046
  return jsx("div", {
7442
- children: mergedOptions.length > 0 ? jsx(Dropdown, {
7443
- items: mergedOptions,
7444
- enabled: enabled,
7445
- selected: data,
7446
- id: `jsonforms-${label}-dropdown`,
7447
- label: label || '',
7047
+ children: mergedOptions.length > 0 ? jsx(GoabDropdown, {
7048
+ name: `jsonforms-${path}-dropdown`,
7049
+ value: data,
7050
+ disabled: !enabled,
7051
+ id: `jsonforms-${path}-dropdown`,
7052
+ filterable: autoCompletion,
7053
+ onChange: detail => handleChange(path, detail.value),
7448
7054
  width: width,
7449
- isAutoCompletion: autoCompletion,
7450
- onChange: value => {
7451
- handleChange(path, value);
7452
- }
7453
- }, `jsonforms-${label}-dropdown`) : jsx(GoabInput, Object.assign({
7055
+ testId: `jsonforms-${path}-dropdown`,
7056
+ children: mergedOptions.map(item => jsx(GoabDropdownItem, {
7057
+ label: item.label,
7058
+ value: item.value ? item.value : ''
7059
+ }, item.label))
7060
+ }, `jsonforms-${path}-dropdown`) : jsx(GoabInput, Object.assign({
7454
7061
  error: isVisited && errors.length > 0,
7455
7062
  type: appliedUiSchemaOptions.format === 'password' ? 'password' : 'text',
7456
7063
  disabled: !enabled,
@@ -7563,15 +7170,15 @@ const MultiLineTextControlTester = rankWith(3, and(isStringControl, optionIs('mu
7563
7170
  const MultiLineTextControl = withJsonFormsControlProps(MultiLineTextControlInput);
7564
7171
 
7565
7172
  var toIntegerOrInfinity$1 = toIntegerOrInfinity$9;
7566
- var toString$7 = toString$m;
7567
- var requireObjectCoercible$3 = requireObjectCoercible$e;
7173
+ var toString$8 = toString$m;
7174
+ var requireObjectCoercible$4 = requireObjectCoercible$e;
7568
7175
 
7569
7176
  var $RangeError$1 = RangeError;
7570
7177
 
7571
7178
  // `String.prototype.repeat` method implementation
7572
7179
  // https://tc39.es/ecma262/#sec-string.prototype.repeat
7573
7180
  var stringRepeat = function repeat(count) {
7574
- var str = toString$7(requireObjectCoercible$3(this));
7181
+ var str = toString$8(requireObjectCoercible$4(this));
7575
7182
  var result = '';
7576
7183
  var n = toIntegerOrInfinity$1(count);
7577
7184
  if (n < 0 || n === Infinity) throw new $RangeError$1('Wrong number of repetitions');
@@ -7580,23 +7187,23 @@ var stringRepeat = function repeat(count) {
7580
7187
  };
7581
7188
 
7582
7189
  // https://github.com/tc39/proposal-string-pad-start-end
7583
- var uncurryThis$9 = functionUncurryThis;
7190
+ var uncurryThis$a = functionUncurryThis;
7584
7191
  var toLength$2 = toLength$7;
7585
- var toString$6 = toString$m;
7192
+ var toString$7 = toString$m;
7586
7193
  var $repeat = stringRepeat;
7587
- var requireObjectCoercible$2 = requireObjectCoercible$e;
7194
+ var requireObjectCoercible$3 = requireObjectCoercible$e;
7588
7195
 
7589
- var repeat = uncurryThis$9($repeat);
7590
- var stringSlice$3 = uncurryThis$9(''.slice);
7196
+ var repeat = uncurryThis$a($repeat);
7197
+ var stringSlice$3 = uncurryThis$a(''.slice);
7591
7198
  var ceil = Math.ceil;
7592
7199
 
7593
7200
  // `String.prototype.{ padStart, padEnd }` methods implementation
7594
- var createMethod = function (IS_END) {
7201
+ var createMethod$1 = function (IS_END) {
7595
7202
  return function ($this, maxLength, fillString) {
7596
- var S = toString$6(requireObjectCoercible$2($this));
7203
+ var S = toString$7(requireObjectCoercible$3($this));
7597
7204
  var intMaxLength = toLength$2(maxLength);
7598
7205
  var stringLength = S.length;
7599
- var fillStr = fillString === undefined ? ' ' : toString$6(fillString);
7206
+ var fillStr = fillString === undefined ? ' ' : toString$7(fillString);
7600
7207
  var fillLen, stringFiller;
7601
7208
  if (intMaxLength <= stringLength || fillStr === '') return S;
7602
7209
  fillLen = intMaxLength - stringLength;
@@ -7609,20 +7216,20 @@ var createMethod = function (IS_END) {
7609
7216
  var stringPad = {
7610
7217
  // `String.prototype.padStart` method
7611
7218
  // https://tc39.es/ecma262/#sec-string.prototype.padstart
7612
- start: createMethod(false)};
7219
+ start: createMethod$1(false)};
7613
7220
 
7614
7221
  // https://github.com/zloirock/core-js/issues/280
7615
7222
  var userAgent = engineUserAgent;
7616
7223
 
7617
7224
  var stringPadWebkitBug = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent);
7618
7225
 
7619
- var $$9 = _export;
7226
+ var $$a = _export;
7620
7227
  var $padStart = stringPad.start;
7621
7228
  var WEBKIT_BUG = stringPadWebkitBug;
7622
7229
 
7623
7230
  // `String.prototype.padStart` method
7624
7231
  // https://tc39.es/ecma262/#sec-string.prototype.padstart
7625
- $$9({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
7232
+ $$a({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
7626
7233
  padStart: function padStart(maxLength /* , fillString = ' ' */) {
7627
7234
  return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
7628
7235
  }
@@ -8198,23 +7805,28 @@ const EnumSelect = props => {
8198
7805
  return jsx("div", {
8199
7806
  children: error.length > 0 ? callout({
8200
7807
  message: error
8201
- }) : jsx(Dropdown, {
8202
- items: mergedOptions,
8203
- enabled: enabled,
8204
- selected: typeof data === 'object' ? ___default.get(data, valuePath) : data,
8205
- width: width,
7808
+ }) : jsx(GoabDropdown, {
7809
+ name: `jsonforms-${path}-dropdown`,
7810
+ value: typeof data === 'object' ? ___default.get(data, valuePath) : data,
7811
+ disabled: !enabled,
8206
7812
  id: `jsonforms-${path}-dropdown`,
8207
- label: label,
8208
- isAutoCompletion: autoCompletion,
8209
- onChange: value => {
7813
+ filterable: autoCompletion,
7814
+ onChange: detail => {
8210
7815
  if (schema.type === 'object') {
8211
7816
  handleChange(path, registerData.find(o => {
8212
- return ___default.get(o, valuePath) === value;
7817
+ return ___default.get(o, valuePath) === detail.value;
8213
7818
  }));
8214
7819
  } else {
8215
- handleChange(path, value);
7820
+ handleChange(path, detail.value);
8216
7821
  }
8217
- }
7822
+ },
7823
+ width: width,
7824
+ testId: `jsonforms-${path}-dropdown`,
7825
+ children: mergedOptions.map(item => jsx(GoabDropdownItem, {
7826
+ testId: `jsonforms-${path}-dropdown-${item.label}`,
7827
+ label: item.label,
7828
+ value: item.value
7829
+ }, item.label))
8218
7830
  }, `jsonforms-${path}-dropdown`)
8219
7831
  });
8220
7832
  };
@@ -8478,6 +8090,63 @@ const EnumCheckboxControl = props => {
8478
8090
  const GoAEnumCheckboxGroupControl = withJsonFormsEnumProps(withTranslateProps(EnumCheckboxControl), true);
8479
8091
  const GoACheckoutGroupControlTester = rankWith(18, and(optionIs('format', 'checkbox')));
8480
8092
 
8093
+ // a string of all valid unicode whitespaces
8094
+ var whitespaces$3 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
8095
+ '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
8096
+
8097
+ var uncurryThis$9 = functionUncurryThis;
8098
+ var requireObjectCoercible$2 = requireObjectCoercible$e;
8099
+ var toString$6 = toString$m;
8100
+ var whitespaces$2 = whitespaces$3;
8101
+
8102
+ var replace$3 = uncurryThis$9(''.replace);
8103
+ var ltrim = RegExp('^[' + whitespaces$2 + ']+');
8104
+ var rtrim = RegExp('(^|[^' + whitespaces$2 + '])[' + whitespaces$2 + ']+$');
8105
+
8106
+ // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
8107
+ var createMethod = function (TYPE) {
8108
+ return function ($this) {
8109
+ var string = toString$6(requireObjectCoercible$2($this));
8110
+ if (TYPE & 1) string = replace$3(string, ltrim, '');
8111
+ if (TYPE & 2) string = replace$3(string, rtrim, '$1');
8112
+ return string;
8113
+ };
8114
+ };
8115
+
8116
+ var stringTrim = {
8117
+ // `String.prototype.trim` method
8118
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
8119
+ trim: createMethod(3)
8120
+ };
8121
+
8122
+ var PROPER_FUNCTION_NAME = functionName.PROPER;
8123
+ var fails$3 = fails$x;
8124
+ var whitespaces$1 = whitespaces$3;
8125
+
8126
+ var non = '\u200B\u0085\u180E';
8127
+
8128
+ // check that a method works with the correct list
8129
+ // of whitespaces and has a correct name
8130
+ var stringTrimForced = function (METHOD_NAME) {
8131
+ return fails$3(function () {
8132
+ return !!whitespaces$1[METHOD_NAME]()
8133
+ || non[METHOD_NAME]() !== non
8134
+ || (PROPER_FUNCTION_NAME && whitespaces$1[METHOD_NAME].name !== METHOD_NAME);
8135
+ });
8136
+ };
8137
+
8138
+ var $$9 = _export;
8139
+ var $trim = stringTrim.trim;
8140
+ var forcedStringTrimMethod = stringTrimForced;
8141
+
8142
+ // `String.prototype.trim` method
8143
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
8144
+ $$9({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
8145
+ trim: function trim() {
8146
+ return $trim(this);
8147
+ }
8148
+ });
8149
+
8481
8150
  const warningIcon = errorMessage => {
8482
8151
  return jsxs(WarningIconDiv, {
8483
8152
  children: [jsx(GoabIcon, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.48.2",
3
+ "version": "2.49.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",