@angular/aria 22.0.0-next.7 → 22.0.0-rc.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 (96) hide show
  1. package/fesm2022/_accordion-chunk.mjs +11 -1
  2. package/fesm2022/_accordion-chunk.mjs.map +1 -1
  3. package/fesm2022/_click-event-manager-chunk.mjs +1 -1
  4. package/fesm2022/_deferred-content-chunk.mjs +6 -6
  5. package/fesm2022/_list-chunk.mjs +4 -1
  6. package/fesm2022/_list-chunk.mjs.map +1 -1
  7. package/fesm2022/_list-navigation-chunk.mjs +1 -1
  8. package/fesm2022/_list-typeahead-chunk.mjs +1 -1
  9. package/fesm2022/_menu-chunk.mjs +10 -1
  10. package/fesm2022/_menu-chunk.mjs.map +1 -1
  11. package/fesm2022/{_combobox-listbox-chunk.mjs → _option-chunk.mjs} +13 -50
  12. package/fesm2022/_option-chunk.mjs.map +1 -0
  13. package/fesm2022/_tabs-chunk.mjs +1 -1
  14. package/fesm2022/_toolbar-widget-group-chunk.mjs +10 -1
  15. package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -1
  16. package/fesm2022/_transforms-chunk.mjs +8 -0
  17. package/fesm2022/_transforms-chunk.mjs.map +1 -0
  18. package/fesm2022/{_combobox-tree-chunk.mjs → _tree-chunk.mjs} +8 -48
  19. package/fesm2022/_tree-chunk.mjs.map +1 -0
  20. package/fesm2022/{_signal-like-chunk.mjs → _violations-chunk.mjs} +60 -2
  21. package/fesm2022/_violations-chunk.mjs.map +1 -0
  22. package/fesm2022/_widget-chunk.mjs +46 -15
  23. package/fesm2022/_widget-chunk.mjs.map +1 -1
  24. package/fesm2022/accordion.mjs +116 -89
  25. package/fesm2022/accordion.mjs.map +1 -1
  26. package/fesm2022/aria.mjs +1 -1
  27. package/fesm2022/aria.mjs.map +1 -1
  28. package/fesm2022/combobox-testing.mjs +79 -0
  29. package/fesm2022/combobox-testing.mjs.map +1 -0
  30. package/fesm2022/combobox.mjs +273 -307
  31. package/fesm2022/combobox.mjs.map +1 -1
  32. package/fesm2022/grid-testing.mjs +8 -0
  33. package/fesm2022/grid-testing.mjs.map +1 -1
  34. package/fesm2022/grid.mjs +75 -87
  35. package/fesm2022/grid.mjs.map +1 -1
  36. package/fesm2022/listbox-testing.mjs +4 -0
  37. package/fesm2022/listbox-testing.mjs.map +1 -1
  38. package/fesm2022/listbox.mjs +192 -215
  39. package/fesm2022/listbox.mjs.map +1 -1
  40. package/fesm2022/menu-testing.mjs +11 -0
  41. package/fesm2022/menu-testing.mjs.map +1 -1
  42. package/fesm2022/menu.mjs +60 -66
  43. package/fesm2022/menu.mjs.map +1 -1
  44. package/fesm2022/private.mjs +19 -13
  45. package/fesm2022/private.mjs.map +1 -1
  46. package/fesm2022/tabs.mjs +172 -115
  47. package/fesm2022/tabs.mjs.map +1 -1
  48. package/fesm2022/toolbar-testing.mjs +5 -1
  49. package/fesm2022/toolbar-testing.mjs.map +1 -1
  50. package/fesm2022/toolbar.mjs +41 -30
  51. package/fesm2022/toolbar.mjs.map +1 -1
  52. package/fesm2022/tree-testing.mjs +12 -0
  53. package/fesm2022/tree-testing.mjs.map +1 -1
  54. package/fesm2022/tree.mjs +126 -156
  55. package/fesm2022/tree.mjs.map +1 -1
  56. package/package.json +6 -6
  57. package/types/_accordion-chunk.d.ts +4 -2
  58. package/types/_collection-chunk.d.ts +42 -0
  59. package/types/_expansion-chunk.d.ts +1 -1
  60. package/types/_grid-chunk.d.ts +11 -3
  61. package/types/_keyboard-event-manager-chunk.d.ts +1 -1
  62. package/types/_list-chunk.d.ts +1 -1
  63. package/types/_list-navigation-chunk.d.ts +1 -1
  64. package/types/_listbox-chunk.d.ts +1 -1
  65. package/types/_menu-chunk.d.ts +3 -1
  66. package/types/_tabs-chunk.d.ts +1 -1
  67. package/types/_toolbar-chunk.d.ts +3 -1
  68. package/types/_tree-chunk.d.ts +1 -1
  69. package/types/accordion.d.ts +10 -18
  70. package/types/combobox-testing.d.ts +63 -0
  71. package/types/combobox.d.ts +96 -193
  72. package/types/grid-testing.d.ts +4 -0
  73. package/types/grid.d.ts +99 -103
  74. package/types/listbox-testing.d.ts +25 -0
  75. package/types/listbox.d.ts +53 -62
  76. package/types/menu-testing.d.ts +6 -0
  77. package/types/menu.d.ts +17 -23
  78. package/types/private.d.ts +26 -137
  79. package/types/tabs.d.ts +69 -80
  80. package/types/toolbar-testing.d.ts +4 -0
  81. package/types/toolbar.d.ts +6 -12
  82. package/types/tree-testing.d.ts +8 -0
  83. package/types/tree.d.ts +7 -20
  84. package/fesm2022/_combobox-chunk.mjs +0 -478
  85. package/fesm2022/_combobox-chunk.mjs.map +0 -1
  86. package/fesm2022/_combobox-listbox-chunk.mjs.map +0 -1
  87. package/fesm2022/_combobox-tree-chunk.mjs.map +0 -1
  88. package/fesm2022/_element-chunk.mjs +0 -6
  89. package/fesm2022/_element-chunk.mjs.map +0 -1
  90. package/fesm2022/_signal-like-chunk.mjs.map +0 -1
  91. package/fesm2022/simple-combobox.mjs +0 -443
  92. package/fesm2022/simple-combobox.mjs.map +0 -1
  93. package/types/_combobox-chunk.d.ts +0 -224
  94. package/types/_element-chunk.d.ts +0 -10
  95. package/types/_signal-like-chunk.d.ts +0 -14
  96. package/types/simple-combobox.d.ts +0 -124
@@ -1,4 +1,4 @@
1
- import { computed, signal, linkedSignal, KeyboardEventManager, Modifier } from './_signal-like-chunk.mjs';
1
+ import { computed, signal, linkedSignal, KeyboardEventManager, Modifier } from './_violations-chunk.mjs';
2
2
  import { ClickEventManager } from './_click-event-manager-chunk.mjs';
3
3
  import { untracked } from '@angular/core/primitives/signals';
4
4
  import { ElementRef } from '@angular/core';
@@ -707,6 +707,16 @@ class GridPattern {
707
707
  cells: computed(() => this.inputs.rows().map(row => row.inputs.cells()))
708
708
  });
709
709
  }
710
+ validate() {
711
+ const violations = [];
712
+ const rows = this.inputs.rows();
713
+ for (const row of rows) {
714
+ if (row.inputs.cells().length === 0) {
715
+ violations.push('ngGridRow must contain at least one ngGridCell.');
716
+ }
717
+ }
718
+ return violations;
719
+ }
710
720
  onKeydown(event) {
711
721
  if (this.disabled()) return;
712
722
  this.hasBeenInteracted.set(true);
@@ -831,11 +841,6 @@ class GridCellPattern {
831
841
  onKeydown(event) {
832
842
  if (this.disabled()) return;
833
843
  this.widget()?.onKeydown(event);
834
- if (this.widget()?.inputs.widgetType() === 'simple') {
835
- if (event.key === 'Enter' || event.key === ' ') {
836
- this.inputs.onActivate?.(event);
837
- }
838
- }
839
844
  }
840
845
  onFocusIn(event) {
841
846
  this.isFocused.set(true);
@@ -877,23 +882,31 @@ class GridCellWidgetPattern {
877
882
  element = () => this.inputs.element();
878
883
  widgetHost = () => resolveElement(this.inputs.focusTarget(), this.element()) ?? this.element();
879
884
  disabled = computed(() => this.inputs.disabled() || this.inputs.cell().disabled());
880
- tabIndex = computed(() => this.inputs.cell().widgetTabIndex());
885
+ tabIndex = computed(() => {
886
+ if (this.inputs.focusTarget()) {
887
+ return -1;
888
+ }
889
+ return this.inputs.cell().widgetTabIndex();
890
+ });
881
891
  active = computed(() => this.inputs.cell().active() && this.inputs.cell().widget() === this);
882
892
  isActivated = signal(false);
883
893
  lastActivateEvent = signal(undefined);
884
894
  lastDeactivateEvent = signal(undefined);
885
895
  keydown = computed(() => {
886
896
  const manager = new KeyboardEventManager();
887
- if (this.isActivated()) {
888
- manager.on('Escape', e => {
889
- this.deactivate(e);
890
- this.focus();
897
+ if (this.inputs.widgetType() === 'simple') {
898
+ return manager.on('Enter', e => this.inputs.onActivate?.(e), {
899
+ preventDefault: false,
900
+ stopPropagation: false
901
+ }).on(' ', e => this.inputs.onActivate?.(e), {
902
+ preventDefault: false,
903
+ stopPropagation: false
891
904
  });
905
+ }
906
+ if (this.isActivated()) {
907
+ manager.on('Escape', e => this.deactivate(e));
892
908
  if (this.inputs.widgetType() === 'editable') {
893
- manager.on('Enter', e => {
894
- this.deactivate(e);
895
- this.focus();
896
- });
909
+ manager.on('Enter', e => this.deactivate(e));
897
910
  }
898
911
  return manager;
899
912
  }
@@ -927,6 +940,24 @@ class GridCellWidgetPattern {
927
940
  focus() {
928
941
  this.widgetHost().focus();
929
942
  }
943
+ activationEffect() {
944
+ if (this.isActivated()) {
945
+ const event = this.lastActivateEvent();
946
+ this.inputs.onActivate?.(event);
947
+ if (this.inputs.focusTarget()) {
948
+ this.focus();
949
+ }
950
+ }
951
+ }
952
+ deactivationEffect() {
953
+ const event = this.lastDeactivateEvent();
954
+ if (event) {
955
+ this.inputs.onDeactivate?.(event);
956
+ if (event instanceof KeyboardEvent) {
957
+ this.focus();
958
+ }
959
+ }
960
+ }
930
961
  activate(event) {
931
962
  if (this.isActivated()) return;
932
963
  if (this.inputs.widgetType() === 'simple') return;