@abgov/jsonforms-components 1.41.1 → 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 +35 -8
- 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) {
|
|
@@ -5140,6 +5152,11 @@ const Anchor = styled.div(_t5$1 || (_t5$1 = _$5`
|
|
|
5140
5152
|
text-decoration: underline;
|
|
5141
5153
|
outline: none;
|
|
5142
5154
|
cursor: pointer;
|
|
5155
|
+
|
|
5156
|
+
&:focus {
|
|
5157
|
+
outline: 2px solid #0070c4;
|
|
5158
|
+
background-color: #e6f7ff;
|
|
5159
|
+
}
|
|
5143
5160
|
`));
|
|
5144
5161
|
styled.div(_t6$1 || (_t6$1 = _$5`
|
|
5145
5162
|
margin-left: var(--goa-space-m);
|
|
@@ -5733,8 +5750,15 @@ const FormStepper = props => {
|
|
|
5733
5750
|
children: [jsx(ReviewItemTitle, {
|
|
5734
5751
|
children: categoryLabel
|
|
5735
5752
|
}), jsx(Anchor, {
|
|
5753
|
+
tabIndex: readOnly ? -1 : 0,
|
|
5736
5754
|
onClick: () => setPage(index + 1),
|
|
5737
5755
|
"data-testid": testId,
|
|
5756
|
+
onKeyDown: e => {
|
|
5757
|
+
if (!readOnly && (e.key === ' ' || e.key === 'Enter')) {
|
|
5758
|
+
e.preventDefault();
|
|
5759
|
+
setPage(index + 1);
|
|
5760
|
+
}
|
|
5761
|
+
},
|
|
5738
5762
|
children: readOnly ? 'View' : 'Edit'
|
|
5739
5763
|
})]
|
|
5740
5764
|
}), jsx(GoAGrid, {
|
|
@@ -8106,7 +8130,7 @@ const AddressViews = ({
|
|
|
8106
8130
|
data,
|
|
8107
8131
|
isAlbertaAddress
|
|
8108
8132
|
}) => {
|
|
8109
|
-
var _a;
|
|
8133
|
+
var _a, _b, _c, _d;
|
|
8110
8134
|
const provinces = [{
|
|
8111
8135
|
value: 'AB',
|
|
8112
8136
|
label: 'Alberta'
|
|
@@ -8152,7 +8176,8 @@ const AddressViews = ({
|
|
|
8152
8176
|
minChildWidth: "0",
|
|
8153
8177
|
gap: "s",
|
|
8154
8178
|
children: [jsx(GoAFormItem, {
|
|
8155
|
-
|
|
8179
|
+
error: ((_a = data === null || data === void 0 ? void 0 : data.addressLine1) === null || _a === void 0 ? void 0 : _a.length) === 0 ? 'addressLine1 is required' : '',
|
|
8180
|
+
label: `${isAlbertaAddress ? 'Alberta p' : 'Canada p'}ostal address`,
|
|
8156
8181
|
children: jsx("p", {
|
|
8157
8182
|
children: data === null || data === void 0 ? void 0 : data.addressLine1
|
|
8158
8183
|
})
|
|
@@ -8166,11 +8191,13 @@ const AddressViews = ({
|
|
|
8166
8191
|
minChildWidth: "0ch",
|
|
8167
8192
|
gap: "s",
|
|
8168
8193
|
children: [jsx(GoAFormItem, {
|
|
8194
|
+
error: ((_b = data === null || data === void 0 ? void 0 : data.municipality) === null || _b === void 0 ? void 0 : _b.length) === 0 ? 'city is required' : '',
|
|
8169
8195
|
label: "City",
|
|
8170
8196
|
children: jsx("p", {
|
|
8171
|
-
children: data === null || data === void 0 ? void 0 : data.
|
|
8197
|
+
children: data === null || data === void 0 ? void 0 : data.municipality
|
|
8172
8198
|
})
|
|
8173
8199
|
}), jsx(GoAFormItem, {
|
|
8200
|
+
error: ((_c = data === null || data === void 0 ? void 0 : data.postalCode) === null || _c === void 0 ? void 0 : _c.length) === 0 ? 'postalCode is required' : '',
|
|
8174
8201
|
label: "Postal Code",
|
|
8175
8202
|
children: jsx("p", {
|
|
8176
8203
|
children: data === null || data === void 0 ? void 0 : data.postalCode
|
|
@@ -8186,7 +8213,7 @@ const AddressViews = ({
|
|
|
8186
8213
|
children: "Alberta"
|
|
8187
8214
|
}), !isAlbertaAddress && jsx("div", {
|
|
8188
8215
|
"data-testid": "address-form-province-view",
|
|
8189
|
-
children: (
|
|
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
|
|
8190
8217
|
})]
|
|
8191
8218
|
}), jsx(GoAFormItem, {
|
|
8192
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",
|