@abgov/jsonforms-components 1.41.2 → 1.41.3
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 +19 -7
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -4425,6 +4425,8 @@ const ARROW_DOWN_KEY = 'ArrowDown';
|
|
|
4425
4425
|
const ARROW_UP_KEY = 'ArrowUp';
|
|
4426
4426
|
const TAB_KEY = 'Tab';
|
|
4427
4427
|
const SPACE_KEY = ' ';
|
|
4428
|
+
const ALT_KEY = 'Alt';
|
|
4429
|
+
const SHIFT_KEY = 'Shift';
|
|
4428
4430
|
|
|
4429
4431
|
let _$7 = t => t,
|
|
4430
4432
|
_t$7,
|
|
@@ -4466,6 +4468,8 @@ const GoADropdownListContainer = styled.div(_t3$4 || (_t3$4 = _$7`
|
|
|
4466
4468
|
&:hover {
|
|
4467
4469
|
background-color: var(--goa-color-interactive-hover) !important;
|
|
4468
4470
|
color: #fff !important;
|
|
4471
|
+
/* Fix to override scrollbar color in Firefox */
|
|
4472
|
+
scrollbar-color: #a8a8a8 var(--goa-color-greyscale-100) !important;
|
|
4469
4473
|
}
|
|
4470
4474
|
`), p => p.optionListMaxHeight || '272px');
|
|
4471
4475
|
const GoADropdownListOption = styled.div(_t4$2 || (_t4$2 = _$7`
|
|
@@ -4503,7 +4507,7 @@ const GoADropdownListOption = styled.div(_t4$2 || (_t4$2 = _$7`
|
|
|
4503
4507
|
`), 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');
|
|
4504
4508
|
|
|
4505
4509
|
const isValidKey = keyCode => {
|
|
4506
|
-
if (keyCode ===
|
|
4510
|
+
if (keyCode === SHIFT_KEY || keyCode === ALT_KEY) return false;
|
|
4507
4511
|
const regex = new RegExp(/^[a-zA-Z0-9!%$@.#?\-_]+$/);
|
|
4508
4512
|
return regex.test(keyCode);
|
|
4509
4513
|
};
|
|
@@ -4535,18 +4539,20 @@ const Dropdown = props => {
|
|
|
4535
4539
|
useEffect(() => {
|
|
4536
4540
|
if (textInput) {
|
|
4537
4541
|
textInput.addEventListener('click', inputTextOnClick);
|
|
4538
|
-
textInput.addEventListener('keydown', handleKeyDown
|
|
4539
|
-
textInput.addEventListener('blur', handleTextInputOnBlur
|
|
4542
|
+
textInput.addEventListener('keydown', handleKeyDown);
|
|
4543
|
+
textInput.addEventListener('blur', handleTextInputOnBlur);
|
|
4540
4544
|
}
|
|
4545
|
+
document.addEventListener('keydown', handleDocumentKeyDown);
|
|
4541
4546
|
return () => {
|
|
4542
4547
|
if (textInput) {
|
|
4543
4548
|
textInput.removeEventListener('click', inputTextOnClick);
|
|
4544
4549
|
textInput.removeEventListener('keydown', handleKeyDown);
|
|
4545
4550
|
textInput.removeEventListener('blur', handleTextInputOnBlur);
|
|
4546
4551
|
}
|
|
4552
|
+
document.removeEventListener('keydown', handleDocumentKeyDown);
|
|
4547
4553
|
};
|
|
4548
4554
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4549
|
-
}, [textInput]);
|
|
4555
|
+
}, [textInput, document]);
|
|
4550
4556
|
/* istanbul ignore next */
|
|
4551
4557
|
const handleTextInputOnBlur = e => {
|
|
4552
4558
|
if (e.relatedTarget === null) {
|
|
@@ -4584,6 +4590,12 @@ const Dropdown = props => {
|
|
|
4584
4590
|
}
|
|
4585
4591
|
};
|
|
4586
4592
|
/* istanbul ignore next */
|
|
4593
|
+
const handleDocumentKeyDown = e => {
|
|
4594
|
+
if (e.key === ESCAPE_KEY || e.key === TAB_KEY) {
|
|
4595
|
+
setIsOpen(false);
|
|
4596
|
+
}
|
|
4597
|
+
};
|
|
4598
|
+
/* istanbul ignore next */
|
|
4587
4599
|
const handleKeyDown = e => {
|
|
4588
4600
|
var _a, _b, _c;
|
|
4589
4601
|
if (e.key === ENTER_KEY || e.key === SPACE_KEY) {
|
|
@@ -8165,7 +8177,7 @@ const AddressViews = ({
|
|
|
8165
8177
|
gap: "s",
|
|
8166
8178
|
children: [jsx(GoAFormItem, {
|
|
8167
8179
|
error: ((_a = data === null || data === void 0 ? void 0 : data.addressLine1) === null || _a === void 0 ? void 0 : _a.length) === 0 ? 'addressLine1 is required' : '',
|
|
8168
|
-
label: `${isAlbertaAddress ? 'Alberta p' : '
|
|
8180
|
+
label: `${isAlbertaAddress ? 'Alberta p' : 'Canada p'}ostal address`,
|
|
8169
8181
|
children: jsx("p", {
|
|
8170
8182
|
children: data === null || data === void 0 ? void 0 : data.addressLine1
|
|
8171
8183
|
})
|
|
@@ -8182,7 +8194,7 @@ const AddressViews = ({
|
|
|
8182
8194
|
error: ((_b = data === null || data === void 0 ? void 0 : data.municipality) === null || _b === void 0 ? void 0 : _b.length) === 0 ? 'city is required' : '',
|
|
8183
8195
|
label: "City",
|
|
8184
8196
|
children: jsx("p", {
|
|
8185
|
-
children: data === null || data === void 0 ? void 0 : data.
|
|
8197
|
+
children: data === null || data === void 0 ? void 0 : data.municipality
|
|
8186
8198
|
})
|
|
8187
8199
|
}), jsx(GoAFormItem, {
|
|
8188
8200
|
error: ((_c = data === null || data === void 0 ? void 0 : data.postalCode) === null || _c === void 0 ? void 0 : _c.length) === 0 ? 'postalCode is required' : '',
|
|
@@ -8201,7 +8213,7 @@ const AddressViews = ({
|
|
|
8201
8213
|
children: "Alberta"
|
|
8202
8214
|
}), !isAlbertaAddress && jsx("div", {
|
|
8203
8215
|
"data-testid": "address-form-province-view",
|
|
8204
|
-
children: (_d = provinces.find(p => p.value === (data === null || data === void 0 ? void 0 : data.
|
|
8216
|
+
children: (_d = provinces.find(p => p.value === (data === null || data === void 0 ? void 0 : data.subdivisionCode))) === null || _d === void 0 ? void 0 : _d.label
|
|
8205
8217
|
})]
|
|
8206
8218
|
}), jsx(GoAFormItem, {
|
|
8207
8219
|
label: "Country",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.41.
|
|
3
|
+
"version": "1.41.3",
|
|
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",
|