@abgov/jsonforms-components 2.48.2 → 2.49.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.esm.js +141 -461
  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';
@@ -3561,22 +3561,33 @@ const ensureGoaDatePointerCursor = host => {
3561
3561
  const style = document.createElement('style');
3562
3562
  style.id = 'goa-date-cursor-style';
3563
3563
  style.textContent = `
3564
- input[type="date"] { cursor: pointer !important; }
3565
- input[type="date"]:disabled { cursor: not-allowed !important; }
3564
+ /* keep text cursor in field */
3565
+ input[type="date"] {
3566
+ cursor: text;
3567
+ }
3568
+
3569
+ /* 👇 hand cursor ONLY on calendar icon */
3570
+ input[type="date"]::-webkit-calendar-picker-indicator {
3571
+ cursor: pointer;
3572
+ }
3573
+
3574
+ input[type="date"]:disabled::-webkit-calendar-picker-indicator {
3575
+ cursor: not-allowed;
3576
+ }
3566
3577
  `;
3567
3578
  sr.appendChild(style);
3568
3579
  };
3569
3580
 
3570
- let _$b = t => t,
3571
- _t$c,
3572
- _t2$7;
3573
- styled.div(_t$c || (_t$c = _$b`
3581
+ let _$a = t => t,
3582
+ _t$b,
3583
+ _t2$6;
3584
+ styled.div(_t$b || (_t$b = _$a`
3574
3585
  height: 70vh;
3575
3586
  overflow-y: auto;
3576
3587
  padding-left: var(--goa-space-2xs);
3577
3588
  padding-right: var(--goa-space-2xs);
3578
3589
  `));
3579
- const Visible = styled.div(_t2$7 || (_t2$7 = _$b`
3590
+ const Visible = styled.div(_t2$6 || (_t2$6 = _$a`
3580
3591
  display: ${0};
3581
3592
  width: 100%;
3582
3593
  `), p => p.visible ? 'block' : 'none');
@@ -5199,12 +5210,12 @@ const JsonFormRegisterProvider = ({
5199
5210
  });
5200
5211
  };
5201
5212
 
5202
- let _$a = t => t,
5203
- _t$b,
5204
- _t2$6,
5205
- _t3$5,
5206
- _t4$5,
5207
- _t5$4,
5213
+ let _$9 = t => t,
5214
+ _t$a,
5215
+ _t2$5,
5216
+ _t3$4,
5217
+ _t4$4,
5218
+ _t5$3,
5208
5219
  _t6$3,
5209
5220
  _t7$2,
5210
5221
  _t8$2,
@@ -5212,10 +5223,10 @@ let _$a = t => t,
5212
5223
  _t0$2,
5213
5224
  _t1$2,
5214
5225
  _t10$2;
5215
- const FormFieldWrapper = styled.div(_t$b || (_t$b = _$a`
5226
+ const FormFieldWrapper = styled.div(_t$a || (_t$a = _$9`
5216
5227
  margin-bottom: var(--goa-space-l);
5217
5228
  `));
5218
- const WarningIconDiv = styled.div(_t2$6 || (_t2$6 = _$a`
5229
+ const WarningIconDiv = styled.div(_t2$5 || (_t2$5 = _$9`
5219
5230
  display: flex;
5220
5231
  align-items: flex-start;
5221
5232
  gap: var(--goa-space-2xs);
@@ -5223,58 +5234,58 @@ const WarningIconDiv = styled.div(_t2$6 || (_t2$6 = _$a`
5223
5234
  color: var(--goa-form-item-error-message-color);
5224
5235
  margin-top: var(--goa-form-item-message-margin-top);
5225
5236
  `));
5226
- const RequiredTextLabel = styled.label(_t3$5 || (_t3$5 = _$a`
5237
+ const RequiredTextLabel = styled.label(_t3$4 || (_t3$4 = _$9`
5227
5238
  color: var(--goa-color-greyscale-700);
5228
5239
  font-weight: var(--goa-font-weight-regular);
5229
5240
  font-size: var(--goa-font-size-2);
5230
5241
  line-height: var(--goa-line-height-1);
5231
5242
  font-style: normal;
5232
5243
  `));
5233
- styled.td(_t4$5 || (_t4$5 = _$a`
5244
+ styled.td(_t4$4 || (_t4$4 = _$9`
5234
5245
  width: 40%;
5235
5246
  padding-top: var(--goa-space-s);
5236
5247
  padding-bottom: var(--goa-space-s);
5237
5248
  padding-right: var(--goa-space-m);
5238
5249
  vertical-align: top;
5239
5250
  `));
5240
- styled.td(_t5$4 || (_t5$4 = _$a`
5251
+ styled.td(_t5$3 || (_t5$3 = _$9`
5241
5252
  width: 40%;
5242
5253
  text-align: left;
5243
5254
  vertical-align: top;
5244
5255
  `));
5245
- const PageReviewContainer = styled.td(_t6$3 || (_t6$3 = _$a`
5256
+ const PageReviewContainer = styled.td(_t6$3 || (_t6$3 = _$9`
5246
5257
  padding: 12px 0px;
5247
5258
  border-bottom: 1px solid #ccc;
5248
5259
  width: 100%;
5249
5260
  vertical-align: top;
5250
5261
  `));
5251
- const ReviewHeader = styled.div(_t7$2 || (_t7$2 = _$a`
5262
+ const ReviewHeader = styled.div(_t7$2 || (_t7$2 = _$9`
5252
5263
  display: flex;
5253
5264
  justify-content: space-between;
5254
5265
  align-items: center;
5255
5266
  width: 100%;
5256
5267
  `));
5257
- const ReviewLabel = styled.div(_t8$2 || (_t8$2 = _$a`
5268
+ const ReviewLabel = styled.div(_t8$2 || (_t8$2 = _$9`
5258
5269
  font-weight: var(--goa-font-weight-bold);
5259
5270
  font-size: var(--goa-font-size-4);
5260
5271
  line-height: var(--goa-line-height-3);
5261
5272
  color: var(--goa-color-text-default);
5262
5273
  `));
5263
- const ReviewValue = styled.div(_t9$2 || (_t9$2 = _$a`
5274
+ const ReviewValue = styled.div(_t9$2 || (_t9$2 = _$9`
5264
5275
  margin-top: var(--goa-space-m);
5265
5276
  color: var(--goa-color-text-default);
5266
5277
  font-size: var(--goa-font-size-4);
5267
5278
  line-height: var(--goa-line-height-3);
5268
5279
  `));
5269
5280
  //Check and unchecked are different heights otherwise
5270
- const CheckboxWrapper = styled.div(_t0$2 || (_t0$2 = _$a`
5281
+ const CheckboxWrapper = styled.div(_t0$2 || (_t0$2 = _$9`
5271
5282
  min-height: 28px;
5272
5283
  `));
5273
- styled.h4(_t1$2 || (_t1$2 = _$a`
5284
+ styled.h4(_t1$2 || (_t1$2 = _$9`
5274
5285
  margin: 0 0 0.25rem 0;
5275
5286
  fontsize: larger;
5276
5287
  `));
5277
- styled.h4(_t10$2 || (_t10$2 = _$a`
5288
+ styled.h4(_t10$2 || (_t10$2 = _$9`
5278
5289
  border-bottom: 1px solid #ddd;
5279
5290
  `));
5280
5291
 
@@ -5399,7 +5410,7 @@ const pickPropertyValues = (obj, property, endWithType) => {
5399
5410
  Object.entries(obj).forEach(function ([key, value]) {
5400
5411
  if (key === property) {
5401
5412
  values.push(value);
5402
- } else if (_$c.isObject(value)) {
5413
+ } else if (_$b.isObject(value)) {
5403
5414
  // if the object type is equal to end type, we are not going to continue the recursive approach
5404
5415
  if ((value == null ? void 0 : value.type) === endWithType) {
5405
5416
  if (property in value) {
@@ -5408,7 +5419,7 @@ const pickPropertyValues = (obj, property, endWithType) => {
5408
5419
  } else {
5409
5420
  values = [...values, ...pickPropertyValues(value, property, endWithType)];
5410
5421
  }
5411
- } else if (_$c.isArray(value)) {
5422
+ } else if (_$b.isArray(value)) {
5412
5423
  const nextValues = value.map(function (arrayObj) {
5413
5424
  return pickPropertyValues(arrayObj, property, endWithType);
5414
5425
  });
@@ -6925,401 +6936,6 @@ fixRegExpWellKnownSymbolLogic$1('match', function (MATCH, nativeMatch, maybeCall
6925
6936
  ];
6926
6937
  });
6927
6938
 
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
6939
  //type DebounceValueType = string | boolean | number | Record<string, unknown>;
7324
6940
  /**
7325
6941
  * A helper util to return a value at a certain delay. The delay is reset if the value arg changes
@@ -7439,18 +7055,20 @@ const GoAInputText = props => {
7439
7055
  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
7056
  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
7057
  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 || '',
7058
+ children: mergedOptions.length > 0 ? jsx(GoabDropdown, {
7059
+ name: `jsonforms-${path}-dropdown`,
7060
+ value: data,
7061
+ disabled: !enabled,
7062
+ id: `jsonforms-${path}-dropdown`,
7063
+ filterable: autoCompletion,
7064
+ onChange: detail => handleChange(path, detail.value),
7448
7065
  width: width,
7449
- isAutoCompletion: autoCompletion,
7450
- onChange: value => {
7451
- handleChange(path, value);
7452
- }
7453
- }, `jsonforms-${label}-dropdown`) : jsx(GoabInput, Object.assign({
7066
+ testId: `jsonforms-${path}-dropdown`,
7067
+ children: mergedOptions.map(item => jsx(GoabDropdownItem, {
7068
+ label: item.label,
7069
+ value: item.value ? item.value : ''
7070
+ }, item.label))
7071
+ }, `jsonforms-${path}-dropdown`) : jsx(GoabInput, Object.assign({
7454
7072
  error: isVisited && errors.length > 0,
7455
7073
  type: appliedUiSchemaOptions.format === 'password' ? 'password' : 'text',
7456
7074
  disabled: !enabled,
@@ -7563,15 +7181,15 @@ const MultiLineTextControlTester = rankWith(3, and(isStringControl, optionIs('mu
7563
7181
  const MultiLineTextControl = withJsonFormsControlProps(MultiLineTextControlInput);
7564
7182
 
7565
7183
  var toIntegerOrInfinity$1 = toIntegerOrInfinity$9;
7566
- var toString$7 = toString$m;
7567
- var requireObjectCoercible$3 = requireObjectCoercible$e;
7184
+ var toString$8 = toString$m;
7185
+ var requireObjectCoercible$4 = requireObjectCoercible$e;
7568
7186
 
7569
7187
  var $RangeError$1 = RangeError;
7570
7188
 
7571
7189
  // `String.prototype.repeat` method implementation
7572
7190
  // https://tc39.es/ecma262/#sec-string.prototype.repeat
7573
7191
  var stringRepeat = function repeat(count) {
7574
- var str = toString$7(requireObjectCoercible$3(this));
7192
+ var str = toString$8(requireObjectCoercible$4(this));
7575
7193
  var result = '';
7576
7194
  var n = toIntegerOrInfinity$1(count);
7577
7195
  if (n < 0 || n === Infinity) throw new $RangeError$1('Wrong number of repetitions');
@@ -7580,23 +7198,23 @@ var stringRepeat = function repeat(count) {
7580
7198
  };
7581
7199
 
7582
7200
  // https://github.com/tc39/proposal-string-pad-start-end
7583
- var uncurryThis$9 = functionUncurryThis;
7201
+ var uncurryThis$a = functionUncurryThis;
7584
7202
  var toLength$2 = toLength$7;
7585
- var toString$6 = toString$m;
7203
+ var toString$7 = toString$m;
7586
7204
  var $repeat = stringRepeat;
7587
- var requireObjectCoercible$2 = requireObjectCoercible$e;
7205
+ var requireObjectCoercible$3 = requireObjectCoercible$e;
7588
7206
 
7589
- var repeat = uncurryThis$9($repeat);
7590
- var stringSlice$3 = uncurryThis$9(''.slice);
7207
+ var repeat = uncurryThis$a($repeat);
7208
+ var stringSlice$3 = uncurryThis$a(''.slice);
7591
7209
  var ceil = Math.ceil;
7592
7210
 
7593
7211
  // `String.prototype.{ padStart, padEnd }` methods implementation
7594
- var createMethod = function (IS_END) {
7212
+ var createMethod$1 = function (IS_END) {
7595
7213
  return function ($this, maxLength, fillString) {
7596
- var S = toString$6(requireObjectCoercible$2($this));
7214
+ var S = toString$7(requireObjectCoercible$3($this));
7597
7215
  var intMaxLength = toLength$2(maxLength);
7598
7216
  var stringLength = S.length;
7599
- var fillStr = fillString === undefined ? ' ' : toString$6(fillString);
7217
+ var fillStr = fillString === undefined ? ' ' : toString$7(fillString);
7600
7218
  var fillLen, stringFiller;
7601
7219
  if (intMaxLength <= stringLength || fillStr === '') return S;
7602
7220
  fillLen = intMaxLength - stringLength;
@@ -7609,20 +7227,20 @@ var createMethod = function (IS_END) {
7609
7227
  var stringPad = {
7610
7228
  // `String.prototype.padStart` method
7611
7229
  // https://tc39.es/ecma262/#sec-string.prototype.padstart
7612
- start: createMethod(false)};
7230
+ start: createMethod$1(false)};
7613
7231
 
7614
7232
  // https://github.com/zloirock/core-js/issues/280
7615
7233
  var userAgent = engineUserAgent;
7616
7234
 
7617
7235
  var stringPadWebkitBug = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent);
7618
7236
 
7619
- var $$9 = _export;
7237
+ var $$a = _export;
7620
7238
  var $padStart = stringPad.start;
7621
7239
  var WEBKIT_BUG = stringPadWebkitBug;
7622
7240
 
7623
7241
  // `String.prototype.padStart` method
7624
7242
  // https://tc39.es/ecma262/#sec-string.prototype.padstart
7625
- $$9({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
7243
+ $$a({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
7626
7244
  padStart: function padStart(maxLength /* , fillString = ' ' */) {
7627
7245
  return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
7628
7246
  }
@@ -8198,23 +7816,28 @@ const EnumSelect = props => {
8198
7816
  return jsx("div", {
8199
7817
  children: error.length > 0 ? callout({
8200
7818
  message: error
8201
- }) : jsx(Dropdown, {
8202
- items: mergedOptions,
8203
- enabled: enabled,
8204
- selected: typeof data === 'object' ? ___default.get(data, valuePath) : data,
8205
- width: width,
7819
+ }) : jsx(GoabDropdown, {
7820
+ name: `jsonforms-${path}-dropdown`,
7821
+ value: typeof data === 'object' ? ___default.get(data, valuePath) : data,
7822
+ disabled: !enabled,
8206
7823
  id: `jsonforms-${path}-dropdown`,
8207
- label: label,
8208
- isAutoCompletion: autoCompletion,
8209
- onChange: value => {
7824
+ filterable: autoCompletion,
7825
+ onChange: detail => {
8210
7826
  if (schema.type === 'object') {
8211
7827
  handleChange(path, registerData.find(o => {
8212
- return ___default.get(o, valuePath) === value;
7828
+ return ___default.get(o, valuePath) === detail.value;
8213
7829
  }));
8214
7830
  } else {
8215
- handleChange(path, value);
7831
+ handleChange(path, detail.value);
8216
7832
  }
8217
- }
7833
+ },
7834
+ width: width,
7835
+ testId: `jsonforms-${path}-dropdown`,
7836
+ children: mergedOptions.map(item => jsx(GoabDropdownItem, {
7837
+ testId: `jsonforms-${path}-dropdown-${item.label}`,
7838
+ label: item.label,
7839
+ value: item.value
7840
+ }, item.label))
8218
7841
  }, `jsonforms-${path}-dropdown`)
8219
7842
  });
8220
7843
  };
@@ -8478,6 +8101,63 @@ const EnumCheckboxControl = props => {
8478
8101
  const GoAEnumCheckboxGroupControl = withJsonFormsEnumProps(withTranslateProps(EnumCheckboxControl), true);
8479
8102
  const GoACheckoutGroupControlTester = rankWith(18, and(optionIs('format', 'checkbox')));
8480
8103
 
8104
+ // a string of all valid unicode whitespaces
8105
+ var whitespaces$3 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
8106
+ '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
8107
+
8108
+ var uncurryThis$9 = functionUncurryThis;
8109
+ var requireObjectCoercible$2 = requireObjectCoercible$e;
8110
+ var toString$6 = toString$m;
8111
+ var whitespaces$2 = whitespaces$3;
8112
+
8113
+ var replace$3 = uncurryThis$9(''.replace);
8114
+ var ltrim = RegExp('^[' + whitespaces$2 + ']+');
8115
+ var rtrim = RegExp('(^|[^' + whitespaces$2 + '])[' + whitespaces$2 + ']+$');
8116
+
8117
+ // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
8118
+ var createMethod = function (TYPE) {
8119
+ return function ($this) {
8120
+ var string = toString$6(requireObjectCoercible$2($this));
8121
+ if (TYPE & 1) string = replace$3(string, ltrim, '');
8122
+ if (TYPE & 2) string = replace$3(string, rtrim, '$1');
8123
+ return string;
8124
+ };
8125
+ };
8126
+
8127
+ var stringTrim = {
8128
+ // `String.prototype.trim` method
8129
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
8130
+ trim: createMethod(3)
8131
+ };
8132
+
8133
+ var PROPER_FUNCTION_NAME = functionName.PROPER;
8134
+ var fails$3 = fails$x;
8135
+ var whitespaces$1 = whitespaces$3;
8136
+
8137
+ var non = '\u200B\u0085\u180E';
8138
+
8139
+ // check that a method works with the correct list
8140
+ // of whitespaces and has a correct name
8141
+ var stringTrimForced = function (METHOD_NAME) {
8142
+ return fails$3(function () {
8143
+ return !!whitespaces$1[METHOD_NAME]()
8144
+ || non[METHOD_NAME]() !== non
8145
+ || (PROPER_FUNCTION_NAME && whitespaces$1[METHOD_NAME].name !== METHOD_NAME);
8146
+ });
8147
+ };
8148
+
8149
+ var $$9 = _export;
8150
+ var $trim = stringTrim.trim;
8151
+ var forcedStringTrimMethod = stringTrimForced;
8152
+
8153
+ // `String.prototype.trim` method
8154
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
8155
+ $$9({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
8156
+ trim: function trim() {
8157
+ return $trim(this);
8158
+ }
8159
+ });
8160
+
8481
8161
  const warningIcon = errorMessage => {
8482
8162
  return jsxs(WarningIconDiv, {
8483
8163
  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.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",