@abgov/react-components 4.0.0-alpha.55 → 4.0.0-alpha.57
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/package.json +5 -6
- package/react-components.esm.js +34 -13
- package/react-components.umd.js +34 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/react-components",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.57",
|
|
4
4
|
"description": "Government of Alberta - UI components for React",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/GovAlta/ui-components/issues"
|
|
@@ -16,14 +16,13 @@
|
|
|
16
16
|
"url": "https://github.com/GovAlta/ui-components.git",
|
|
17
17
|
"directory": "libs/react-components"
|
|
18
18
|
},
|
|
19
|
-
"peerDependencies": {
|
|
20
|
-
"react": "^17.0.2",
|
|
21
|
-
"react-dom": "^17.0.2"
|
|
22
|
-
},
|
|
23
19
|
"dependencies": {
|
|
24
20
|
"date-fns": "^2.29.2"
|
|
25
21
|
},
|
|
26
22
|
"main": "./react-components.umd.js",
|
|
27
23
|
"module": "./react-components.esm.js",
|
|
28
|
-
"typings": "./index.d.ts"
|
|
24
|
+
"typings": "./index.d.ts",
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"react": "17.0.2"
|
|
27
|
+
}
|
|
29
28
|
}
|
package/react-components.esm.js
CHANGED
|
@@ -4796,7 +4796,7 @@ function get_each_context$4(ctx, list, i) {
|
|
|
4796
4796
|
child_ctx[39] = list[i];
|
|
4797
4797
|
child_ctx[41] = i;
|
|
4798
4798
|
return child_ctx;
|
|
4799
|
-
} // (
|
|
4799
|
+
} // (201:2) {#if isMenuVisible}
|
|
4800
4800
|
|
|
4801
4801
|
|
|
4802
4802
|
function create_if_block$c(ctx) {
|
|
@@ -4841,7 +4841,7 @@ function create_if_block$c(ctx) {
|
|
|
4841
4841
|
}
|
|
4842
4842
|
|
|
4843
4843
|
};
|
|
4844
|
-
} // (
|
|
4844
|
+
} // (242:4) {#each options as option, index}
|
|
4845
4845
|
|
|
4846
4846
|
|
|
4847
4847
|
function create_each_block$4(ctx) {
|
|
@@ -4854,6 +4854,7 @@ function create_each_block$4(ctx) {
|
|
|
4854
4854
|
let t;
|
|
4855
4855
|
let li_id_value;
|
|
4856
4856
|
let li_aria_label_value;
|
|
4857
|
+
let li_aria_selected_value;
|
|
4857
4858
|
let li_data_testid_value;
|
|
4858
4859
|
let li_data_index_value;
|
|
4859
4860
|
let li_style_value;
|
|
@@ -4876,19 +4877,24 @@ function create_each_block$4(ctx) {
|
|
|
4876
4877
|
attr(li, "id", li_id_value =
|
|
4877
4878
|
/*option*/
|
|
4878
4879
|
ctx[39].label);
|
|
4880
|
+
attr(li, "role", "option");
|
|
4879
4881
|
attr(li, "aria-label", li_aria_label_value =
|
|
4880
4882
|
/*option*/
|
|
4881
4883
|
ctx[39].label ||
|
|
4882
4884
|
/*option*/
|
|
4883
4885
|
ctx[39].value);
|
|
4884
|
-
attr(li, "
|
|
4886
|
+
attr(li, "aria-selected", li_aria_selected_value =
|
|
4887
|
+
/*_values*/
|
|
4888
|
+
ctx[9].includes(
|
|
4889
|
+
/*option*/
|
|
4890
|
+
ctx[39].value) ? "true" : "false");
|
|
4891
|
+
attr(li, "class", "goa-dropdown-option");
|
|
4885
4892
|
attr(li, "data-testid", li_data_testid_value = `${
|
|
4886
4893
|
/*option*/
|
|
4887
4894
|
ctx[39].value}-dropdown-item`);
|
|
4888
4895
|
attr(li, "data-index", li_data_index_value =
|
|
4889
4896
|
/*index*/
|
|
4890
4897
|
ctx[41]);
|
|
4891
|
-
attr(li, "class", "goa-dropdown-option");
|
|
4892
4898
|
attr(li, "style", li_style_value = `display: ${"block"}`);
|
|
4893
4899
|
toggle_class(li, "goa-dropdown-option--disabled", false);
|
|
4894
4900
|
toggle_class(li, "goa-dropdown-option--tabbed",
|
|
@@ -4941,6 +4947,16 @@ function create_each_block$4(ctx) {
|
|
|
4941
4947
|
attr(li, "aria-label", li_aria_label_value);
|
|
4942
4948
|
}
|
|
4943
4949
|
|
|
4950
|
+
if (dirty[0] &
|
|
4951
|
+
/*_values, options*/
|
|
4952
|
+
1536 && li_aria_selected_value !== (li_aria_selected_value =
|
|
4953
|
+
/*_values*/
|
|
4954
|
+
ctx[9].includes(
|
|
4955
|
+
/*option*/
|
|
4956
|
+
ctx[39].value) ? "true" : "false")) {
|
|
4957
|
+
attr(li, "aria-selected", li_aria_selected_value);
|
|
4958
|
+
}
|
|
4959
|
+
|
|
4944
4960
|
if (dirty[0] &
|
|
4945
4961
|
/*options*/
|
|
4946
4962
|
1024 && li_data_testid_value !== (li_data_testid_value = `${
|
|
@@ -5205,7 +5221,7 @@ function create_fragment$r(ctx) {
|
|
|
5205
5221
|
}
|
|
5206
5222
|
|
|
5207
5223
|
if (dirty[0] &
|
|
5208
|
-
/*options,
|
|
5224
|
+
/*options, _values, highlightedIndex, onSelect*/
|
|
5209
5225
|
534016) {
|
|
5210
5226
|
each_value =
|
|
5211
5227
|
/*options*/
|
|
@@ -5453,7 +5469,7 @@ function instance$p($$self, $$props, $$invalidate) {
|
|
|
5453
5469
|
} // Event handlers
|
|
5454
5470
|
|
|
5455
5471
|
|
|
5456
|
-
function onSelect(val, label) {
|
|
5472
|
+
function onSelect(val, label, close) {
|
|
5457
5473
|
if (_disabled) return;
|
|
5458
5474
|
$$invalidate(11, selectedLabel = label);
|
|
5459
5475
|
|
|
@@ -5478,7 +5494,9 @@ function instance$p($$self, $$props, $$invalidate) {
|
|
|
5478
5494
|
}));
|
|
5479
5495
|
}
|
|
5480
5496
|
|
|
5481
|
-
|
|
5497
|
+
if (close) {
|
|
5498
|
+
closeMenu();
|
|
5499
|
+
}
|
|
5482
5500
|
}
|
|
5483
5501
|
|
|
5484
5502
|
const onInputKeyDown = e => {
|
|
@@ -5503,23 +5521,26 @@ function instance$p($$self, $$props, $$invalidate) {
|
|
|
5503
5521
|
function onMenuKeyDown(e) {
|
|
5504
5522
|
switch (e.key) {
|
|
5505
5523
|
case "ArrowUp":
|
|
5506
|
-
if (highlightedIndex
|
|
5507
|
-
$$invalidate(13, highlightedIndex = options.length - 1);
|
|
5508
|
-
} else {
|
|
5524
|
+
if (highlightedIndex > 0) {
|
|
5509
5525
|
$$invalidate(13, highlightedIndex--, highlightedIndex);
|
|
5526
|
+
onSelect(options[highlightedIndex].value, options[highlightedIndex].label, false);
|
|
5510
5527
|
}
|
|
5511
5528
|
|
|
5512
5529
|
e.preventDefault();
|
|
5513
5530
|
break;
|
|
5514
5531
|
|
|
5515
5532
|
case "ArrowDown":
|
|
5516
|
-
|
|
5533
|
+
if (highlightedIndex < options.length - 1) {
|
|
5534
|
+
$$invalidate(13, highlightedIndex++, highlightedIndex);
|
|
5535
|
+
onSelect(options[highlightedIndex].value, options[highlightedIndex].label, false);
|
|
5536
|
+
}
|
|
5537
|
+
|
|
5517
5538
|
e.preventDefault();
|
|
5518
5539
|
break;
|
|
5519
5540
|
|
|
5520
5541
|
case "Tab":
|
|
5521
5542
|
case "Enter":
|
|
5522
|
-
|
|
5543
|
+
closeMenu();
|
|
5523
5544
|
e.preventDefault();
|
|
5524
5545
|
break;
|
|
5525
5546
|
|
|
@@ -5534,7 +5555,7 @@ function instance$p($$self, $$props, $$invalidate) {
|
|
|
5534
5555
|
$$invalidate(13, highlightedIndex = Number(e.target.dataset.index));
|
|
5535
5556
|
}
|
|
5536
5557
|
|
|
5537
|
-
const click_handler = option => onSelect(option.value, option.label);
|
|
5558
|
+
const click_handler = option => onSelect(option.value, option.label, true);
|
|
5538
5559
|
|
|
5539
5560
|
function ul_binding($$value) {
|
|
5540
5561
|
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
package/react-components.umd.js
CHANGED
|
@@ -4838,7 +4838,7 @@
|
|
|
4838
4838
|
child_ctx[39] = list[i];
|
|
4839
4839
|
child_ctx[41] = i;
|
|
4840
4840
|
return child_ctx;
|
|
4841
|
-
} // (
|
|
4841
|
+
} // (201:2) {#if isMenuVisible}
|
|
4842
4842
|
|
|
4843
4843
|
|
|
4844
4844
|
function create_if_block$c(ctx) {
|
|
@@ -4883,7 +4883,7 @@
|
|
|
4883
4883
|
}
|
|
4884
4884
|
|
|
4885
4885
|
};
|
|
4886
|
-
} // (
|
|
4886
|
+
} // (242:4) {#each options as option, index}
|
|
4887
4887
|
|
|
4888
4888
|
|
|
4889
4889
|
function create_each_block$4(ctx) {
|
|
@@ -4896,6 +4896,7 @@
|
|
|
4896
4896
|
let t;
|
|
4897
4897
|
let li_id_value;
|
|
4898
4898
|
let li_aria_label_value;
|
|
4899
|
+
let li_aria_selected_value;
|
|
4899
4900
|
let li_data_testid_value;
|
|
4900
4901
|
let li_data_index_value;
|
|
4901
4902
|
let li_style_value;
|
|
@@ -4918,19 +4919,24 @@
|
|
|
4918
4919
|
attr(li, "id", li_id_value =
|
|
4919
4920
|
/*option*/
|
|
4920
4921
|
ctx[39].label);
|
|
4922
|
+
attr(li, "role", "option");
|
|
4921
4923
|
attr(li, "aria-label", li_aria_label_value =
|
|
4922
4924
|
/*option*/
|
|
4923
4925
|
ctx[39].label ||
|
|
4924
4926
|
/*option*/
|
|
4925
4927
|
ctx[39].value);
|
|
4926
|
-
attr(li, "
|
|
4928
|
+
attr(li, "aria-selected", li_aria_selected_value =
|
|
4929
|
+
/*_values*/
|
|
4930
|
+
ctx[9].includes(
|
|
4931
|
+
/*option*/
|
|
4932
|
+
ctx[39].value) ? "true" : "false");
|
|
4933
|
+
attr(li, "class", "goa-dropdown-option");
|
|
4927
4934
|
attr(li, "data-testid", li_data_testid_value = `${
|
|
4928
4935
|
/*option*/
|
|
4929
4936
|
ctx[39].value}-dropdown-item`);
|
|
4930
4937
|
attr(li, "data-index", li_data_index_value =
|
|
4931
4938
|
/*index*/
|
|
4932
4939
|
ctx[41]);
|
|
4933
|
-
attr(li, "class", "goa-dropdown-option");
|
|
4934
4940
|
attr(li, "style", li_style_value = `display: ${"block"}`);
|
|
4935
4941
|
toggle_class(li, "goa-dropdown-option--disabled", false);
|
|
4936
4942
|
toggle_class(li, "goa-dropdown-option--tabbed",
|
|
@@ -4983,6 +4989,16 @@
|
|
|
4983
4989
|
attr(li, "aria-label", li_aria_label_value);
|
|
4984
4990
|
}
|
|
4985
4991
|
|
|
4992
|
+
if (dirty[0] &
|
|
4993
|
+
/*_values, options*/
|
|
4994
|
+
1536 && li_aria_selected_value !== (li_aria_selected_value =
|
|
4995
|
+
/*_values*/
|
|
4996
|
+
ctx[9].includes(
|
|
4997
|
+
/*option*/
|
|
4998
|
+
ctx[39].value) ? "true" : "false")) {
|
|
4999
|
+
attr(li, "aria-selected", li_aria_selected_value);
|
|
5000
|
+
}
|
|
5001
|
+
|
|
4986
5002
|
if (dirty[0] &
|
|
4987
5003
|
/*options*/
|
|
4988
5004
|
1024 && li_data_testid_value !== (li_data_testid_value = `${
|
|
@@ -5247,7 +5263,7 @@
|
|
|
5247
5263
|
}
|
|
5248
5264
|
|
|
5249
5265
|
if (dirty[0] &
|
|
5250
|
-
/*options,
|
|
5266
|
+
/*options, _values, highlightedIndex, onSelect*/
|
|
5251
5267
|
534016) {
|
|
5252
5268
|
each_value =
|
|
5253
5269
|
/*options*/
|
|
@@ -5498,7 +5514,7 @@
|
|
|
5498
5514
|
} // Event handlers
|
|
5499
5515
|
|
|
5500
5516
|
|
|
5501
|
-
function onSelect(val, label) {
|
|
5517
|
+
function onSelect(val, label, close) {
|
|
5502
5518
|
if (_disabled) return;
|
|
5503
5519
|
$$invalidate(11, selectedLabel = label);
|
|
5504
5520
|
|
|
@@ -5523,7 +5539,9 @@
|
|
|
5523
5539
|
}));
|
|
5524
5540
|
}
|
|
5525
5541
|
|
|
5526
|
-
|
|
5542
|
+
if (close) {
|
|
5543
|
+
closeMenu();
|
|
5544
|
+
}
|
|
5527
5545
|
}
|
|
5528
5546
|
|
|
5529
5547
|
const onInputKeyDown = e => {
|
|
@@ -5548,23 +5566,26 @@
|
|
|
5548
5566
|
function onMenuKeyDown(e) {
|
|
5549
5567
|
switch (e.key) {
|
|
5550
5568
|
case "ArrowUp":
|
|
5551
|
-
if (highlightedIndex
|
|
5552
|
-
$$invalidate(13, highlightedIndex = options.length - 1);
|
|
5553
|
-
} else {
|
|
5569
|
+
if (highlightedIndex > 0) {
|
|
5554
5570
|
$$invalidate(13, highlightedIndex--, highlightedIndex);
|
|
5571
|
+
onSelect(options[highlightedIndex].value, options[highlightedIndex].label, false);
|
|
5555
5572
|
}
|
|
5556
5573
|
|
|
5557
5574
|
e.preventDefault();
|
|
5558
5575
|
break;
|
|
5559
5576
|
|
|
5560
5577
|
case "ArrowDown":
|
|
5561
|
-
|
|
5578
|
+
if (highlightedIndex < options.length - 1) {
|
|
5579
|
+
$$invalidate(13, highlightedIndex++, highlightedIndex);
|
|
5580
|
+
onSelect(options[highlightedIndex].value, options[highlightedIndex].label, false);
|
|
5581
|
+
}
|
|
5582
|
+
|
|
5562
5583
|
e.preventDefault();
|
|
5563
5584
|
break;
|
|
5564
5585
|
|
|
5565
5586
|
case "Tab":
|
|
5566
5587
|
case "Enter":
|
|
5567
|
-
|
|
5588
|
+
closeMenu();
|
|
5568
5589
|
e.preventDefault();
|
|
5569
5590
|
break;
|
|
5570
5591
|
|
|
@@ -5579,7 +5600,7 @@
|
|
|
5579
5600
|
$$invalidate(13, highlightedIndex = Number(e.target.dataset.index));
|
|
5580
5601
|
}
|
|
5581
5602
|
|
|
5582
|
-
const click_handler = option => onSelect(option.value, option.label);
|
|
5603
|
+
const click_handler = option => onSelect(option.value, option.label, true);
|
|
5583
5604
|
|
|
5584
5605
|
function ul_binding($$value) {
|
|
5585
5606
|
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|