@radix-ng/primitives 0.50.0 → 1.0.0-beta.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 (207) hide show
  1. package/collection/README.md +1 -0
  2. package/fesm2022/radix-ng-primitives-accordion.mjs +134 -66
  3. package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
  4. package/fesm2022/radix-ng-primitives-alert-dialog.mjs +224 -132
  5. package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -1
  6. package/fesm2022/radix-ng-primitives-arrow.mjs +26 -10
  7. package/fesm2022/radix-ng-primitives-arrow.mjs.map +1 -1
  8. package/fesm2022/radix-ng-primitives-aspect-ratio.mjs +6 -6
  9. package/fesm2022/radix-ng-primitives-aspect-ratio.mjs.map +1 -1
  10. package/fesm2022/radix-ng-primitives-avatar.mjs +68 -75
  11. package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
  12. package/fesm2022/radix-ng-primitives-button.mjs +123 -0
  13. package/fesm2022/radix-ng-primitives-button.mjs.map +1 -0
  14. package/fesm2022/radix-ng-primitives-calendar.mjs +104 -103
  15. package/fesm2022/radix-ng-primitives-calendar.mjs.map +1 -1
  16. package/fesm2022/radix-ng-primitives-checkbox.mjs +414 -80
  17. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  18. package/fesm2022/radix-ng-primitives-collapsible.mjs +193 -92
  19. package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
  20. package/fesm2022/radix-ng-primitives-collection.mjs +72 -0
  21. package/fesm2022/radix-ng-primitives-collection.mjs.map +1 -0
  22. package/fesm2022/radix-ng-primitives-config.mjs +5 -5
  23. package/fesm2022/radix-ng-primitives-config.mjs.map +1 -1
  24. package/fesm2022/radix-ng-primitives-context-menu.mjs +143 -427
  25. package/fesm2022/radix-ng-primitives-context-menu.mjs.map +1 -1
  26. package/fesm2022/radix-ng-primitives-core.mjs +757 -757
  27. package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
  28. package/fesm2022/radix-ng-primitives-cropper.mjs +55 -53
  29. package/fesm2022/radix-ng-primitives-cropper.mjs.map +1 -1
  30. package/fesm2022/radix-ng-primitives-date-field.mjs +93 -86
  31. package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
  32. package/fesm2022/radix-ng-primitives-dialog.mjs +658 -330
  33. package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
  34. package/fesm2022/radix-ng-primitives-dismissable-layer.mjs +98 -76
  35. package/fesm2022/radix-ng-primitives-dismissable-layer.mjs.map +1 -1
  36. package/fesm2022/radix-ng-primitives-drawer.mjs +1059 -0
  37. package/fesm2022/radix-ng-primitives-drawer.mjs.map +1 -0
  38. package/fesm2022/radix-ng-primitives-editable.mjs +20 -20
  39. package/fesm2022/radix-ng-primitives-editable.mjs.map +1 -1
  40. package/fesm2022/radix-ng-primitives-field.mjs +363 -0
  41. package/fesm2022/radix-ng-primitives-field.mjs.map +1 -0
  42. package/fesm2022/radix-ng-primitives-fieldset.mjs +79 -0
  43. package/fesm2022/radix-ng-primitives-fieldset.mjs.map +1 -0
  44. package/fesm2022/radix-ng-primitives-focus-guards.mjs +3 -3
  45. package/fesm2022/radix-ng-primitives-focus-guards.mjs.map +1 -1
  46. package/fesm2022/radix-ng-primitives-focus-scope.mjs +29 -14
  47. package/fesm2022/radix-ng-primitives-focus-scope.mjs.map +1 -1
  48. package/fesm2022/radix-ng-primitives-input.mjs +172 -0
  49. package/fesm2022/radix-ng-primitives-input.mjs.map +1 -0
  50. package/fesm2022/radix-ng-primitives-label.mjs +11 -11
  51. package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
  52. package/fesm2022/radix-ng-primitives-menu.mjs +1484 -353
  53. package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
  54. package/fesm2022/radix-ng-primitives-menubar.mjs +290 -162
  55. package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
  56. package/fesm2022/radix-ng-primitives-meter.mjs +271 -0
  57. package/fesm2022/radix-ng-primitives-meter.mjs.map +1 -0
  58. package/fesm2022/radix-ng-primitives-navigation-menu.mjs +1060 -1553
  59. package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
  60. package/fesm2022/radix-ng-primitives-number-field.mjs +1102 -366
  61. package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
  62. package/fesm2022/radix-ng-primitives-pagination.mjs +51 -51
  63. package/fesm2022/radix-ng-primitives-pagination.mjs.map +1 -1
  64. package/fesm2022/radix-ng-primitives-popover.mjs +980 -995
  65. package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
  66. package/fesm2022/radix-ng-primitives-popper.mjs +137 -82
  67. package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
  68. package/fesm2022/radix-ng-primitives-portal.mjs +40 -16
  69. package/fesm2022/radix-ng-primitives-portal.mjs.map +1 -1
  70. package/fesm2022/radix-ng-primitives-presence.mjs +134 -246
  71. package/fesm2022/radix-ng-primitives-presence.mjs.map +1 -1
  72. package/fesm2022/radix-ng-primitives-preview-card.mjs +997 -0
  73. package/fesm2022/radix-ng-primitives-preview-card.mjs.map +1 -0
  74. package/fesm2022/radix-ng-primitives-progress.mjs +231 -92
  75. package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
  76. package/fesm2022/radix-ng-primitives-radio.mjs +211 -70
  77. package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
  78. package/fesm2022/radix-ng-primitives-roving-focus.mjs +127 -77
  79. package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
  80. package/fesm2022/radix-ng-primitives-select.mjs +791 -511
  81. package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
  82. package/fesm2022/radix-ng-primitives-separator.mjs +16 -45
  83. package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
  84. package/fesm2022/radix-ng-primitives-slider.mjs +976 -720
  85. package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
  86. package/fesm2022/radix-ng-primitives-stepper.mjs +69 -71
  87. package/fesm2022/radix-ng-primitives-stepper.mjs.map +1 -1
  88. package/fesm2022/radix-ng-primitives-switch.mjs +128 -124
  89. package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
  90. package/fesm2022/radix-ng-primitives-tabs.mjs +388 -115
  91. package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
  92. package/fesm2022/radix-ng-primitives-time-field.mjs +111 -117
  93. package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
  94. package/fesm2022/radix-ng-primitives-toggle-group.mjs +122 -248
  95. package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
  96. package/fesm2022/radix-ng-primitives-toggle.mjs +99 -62
  97. package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
  98. package/fesm2022/radix-ng-primitives-toolbar.mjs +307 -94
  99. package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
  100. package/fesm2022/radix-ng-primitives-tooltip.mjs +690 -1079
  101. package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
  102. package/fesm2022/radix-ng-primitives-visually-hidden.mjs +46 -87
  103. package/fesm2022/radix-ng-primitives-visually-hidden.mjs.map +1 -1
  104. package/fesm2022/radix-ng-primitives.mjs.map +1 -1
  105. package/meter/README.md +3 -0
  106. package/navigation-menu/README.md +2 -1
  107. package/package.json +85 -63
  108. package/portal/README.md +2 -0
  109. package/preview-card/README.md +3 -0
  110. package/schematics/collection.json +1 -0
  111. package/schematics/ng-add/index.d.ts +3 -2
  112. package/schematics/ng-add/index.js +62 -31
  113. package/schematics/ng-add/index.js.map +1 -1
  114. package/schematics/ng-add/package-config.d.ts +4 -2
  115. package/schematics/ng-add/package-config.js +10 -2
  116. package/schematics/ng-add/package-config.js.map +1 -1
  117. package/schematics/ng-add/schema.d.ts +3 -0
  118. package/schematics/ng-add/schema.js +3 -0
  119. package/schematics/ng-add/schema.js.map +1 -0
  120. package/schematics/ng-add/schema.json +14 -0
  121. package/select/README.md +2 -0
  122. package/{accordion/index.d.ts → types/radix-ng-primitives-accordion.d.ts} +102 -67
  123. package/types/radix-ng-primitives-alert-dialog.d.ts +114 -0
  124. package/{arrow/index.d.ts → types/radix-ng-primitives-arrow.d.ts} +1 -1
  125. package/{aspect-ratio/index.d.ts → types/radix-ng-primitives-aspect-ratio.d.ts} +1 -1
  126. package/{avatar/index.d.ts → types/radix-ng-primitives-avatar.d.ts} +7 -11
  127. package/types/radix-ng-primitives-button.d.ts +73 -0
  128. package/{calendar/index.d.ts → types/radix-ng-primitives-calendar.d.ts} +2 -3
  129. package/types/radix-ng-primitives-checkbox.d.ts +337 -0
  130. package/types/radix-ng-primitives-collapsible.d.ts +159 -0
  131. package/types/radix-ng-primitives-collection.d.ts +44 -0
  132. package/{config/index.d.ts → types/radix-ng-primitives-config.d.ts} +1 -1
  133. package/types/radix-ng-primitives-context-menu.d.ts +73 -0
  134. package/{core/index.d.ts → types/radix-ng-primitives-core.d.ts} +311 -236
  135. package/{cropper/index.d.ts → types/radix-ng-primitives-cropper.d.ts} +6 -5
  136. package/{date-field/index.d.ts → types/radix-ng-primitives-date-field.d.ts} +42 -27
  137. package/types/radix-ng-primitives-dialog.d.ts +323 -0
  138. package/{dismissable-layer/index.d.ts → types/radix-ng-primitives-dismissable-layer.d.ts} +15 -7
  139. package/types/radix-ng-primitives-drawer.d.ts +448 -0
  140. package/{editable/index.d.ts → types/radix-ng-primitives-editable.d.ts} +1 -1
  141. package/types/radix-ng-primitives-field.d.ts +373 -0
  142. package/types/radix-ng-primitives-fieldset.d.ts +48 -0
  143. package/{focus-scope/index.d.ts → types/radix-ng-primitives-focus-scope.d.ts} +13 -5
  144. package/types/radix-ng-primitives-input.d.ts +87 -0
  145. package/{label/index.d.ts → types/radix-ng-primitives-label.d.ts} +0 -1
  146. package/types/radix-ng-primitives-menu.d.ts +612 -0
  147. package/types/radix-ng-primitives-menubar.d.ts +66 -0
  148. package/types/radix-ng-primitives-meter.d.ts +193 -0
  149. package/types/radix-ng-primitives-navigation-menu.d.ts +488 -0
  150. package/types/radix-ng-primitives-number-field.d.ts +464 -0
  151. package/{pagination/index.d.ts → types/radix-ng-primitives-pagination.d.ts} +2 -2
  152. package/types/radix-ng-primitives-popover.d.ts +416 -0
  153. package/{popper/index.d.ts → types/radix-ng-primitives-popper.d.ts} +50 -9
  154. package/types/radix-ng-primitives-portal.d.ts +30 -0
  155. package/types/radix-ng-primitives-presence.d.ts +55 -0
  156. package/types/radix-ng-primitives-preview-card.d.ts +359 -0
  157. package/types/radix-ng-primitives-progress.d.ts +206 -0
  158. package/{radio/index.d.ts → types/radix-ng-primitives-radio.d.ts} +56 -26
  159. package/{roving-focus/index.d.ts → types/radix-ng-primitives-roving-focus.d.ts} +38 -27
  160. package/types/radix-ng-primitives-select.d.ts +512 -0
  161. package/types/radix-ng-primitives-separator.d.ts +38 -0
  162. package/types/radix-ng-primitives-slider.d.ts +377 -0
  163. package/{stepper/index.d.ts → types/radix-ng-primitives-stepper.d.ts} +21 -22
  164. package/types/radix-ng-primitives-switch.d.ts +121 -0
  165. package/types/radix-ng-primitives-tabs.d.ts +247 -0
  166. package/{time-field/index.d.ts → types/radix-ng-primitives-time-field.d.ts} +46 -31
  167. package/types/radix-ng-primitives-toggle-group.d.ts +116 -0
  168. package/types/radix-ng-primitives-toggle.d.ts +65 -0
  169. package/types/radix-ng-primitives-toolbar.d.ts +180 -0
  170. package/types/radix-ng-primitives-tooltip.d.ts +395 -0
  171. package/{visually-hidden/index.d.ts → types/radix-ng-primitives-visually-hidden.d.ts} +19 -19
  172. package/alert-dialog/index.d.ts +0 -57
  173. package/checkbox/index.d.ts +0 -164
  174. package/collapsible/index.d.ts +0 -85
  175. package/context-menu/index.d.ts +0 -129
  176. package/dialog/index.d.ts +0 -205
  177. package/dropdown-menu/README.md +0 -1
  178. package/dropdown-menu/index.d.ts +0 -171
  179. package/fesm2022/radix-ng-primitives-dropdown-menu.mjs +0 -583
  180. package/fesm2022/radix-ng-primitives-dropdown-menu.mjs.map +0 -1
  181. package/fesm2022/radix-ng-primitives-hover-card.mjs +0 -1246
  182. package/fesm2022/radix-ng-primitives-hover-card.mjs.map +0 -1
  183. package/fesm2022/radix-ng-primitives-tooltip2.mjs +0 -740
  184. package/fesm2022/radix-ng-primitives-tooltip2.mjs.map +0 -1
  185. package/hover-card/README.md +0 -3
  186. package/hover-card/index.d.ts +0 -472
  187. package/menu/index.d.ts +0 -139
  188. package/menubar/index.d.ts +0 -56
  189. package/navigation-menu/index.d.ts +0 -405
  190. package/number-field/index.d.ts +0 -203
  191. package/popover/index.d.ts +0 -403
  192. package/portal/index.d.ts +0 -22
  193. package/presence/index.d.ts +0 -103
  194. package/progress/index.d.ts +0 -79
  195. package/select/index.d.ts +0 -214
  196. package/separator/index.d.ts +0 -63
  197. package/slider/index.d.ts +0 -263
  198. package/switch/index.d.ts +0 -105
  199. package/tabs/index.d.ts +0 -112
  200. package/toggle/index.d.ts +0 -75
  201. package/toggle-group/index.d.ts +0 -194
  202. package/toolbar/index.d.ts +0 -55
  203. package/tooltip/index.d.ts +0 -433
  204. package/tooltip2/README.md +0 -3
  205. package/tooltip2/index.d.ts +0 -325
  206. /package/{focus-guards/index.d.ts → types/radix-ng-primitives-focus-guards.d.ts} +0 -0
  207. /package/{index.d.ts → types/radix-ng-primitives.d.ts} +0 -0
@@ -1,176 +1,304 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, NgModule } from '@angular/core';
3
- import * as i1 from '@radix-ng/primitives/menu';
4
- import { RdxMenuContentDirective, RdxMenuItemCheckboxDirective, RdxMenuItemIndicatorDirective, RdxMenuItemRadioDirective, RdxMenuItemDirective, RdxMenuSeparatorDirective, RdxMenuTriggerDirective } from '@radix-ng/primitives/menu';
5
- import * as i1$1 from '@angular/cdk/menu';
6
- import { CdkMenuGroup, CdkMenuBar } from '@angular/cdk/menu';
2
+ import { inject, contentChildren, input, booleanAttribute, signal, computed, effect, Directive, NgModule } from '@angular/core';
3
+ import { createContext } from '@radix-ng/primitives/core';
4
+ import { RdxMenuRoot } from '@radix-ng/primitives/menu';
7
5
 
8
- class RdxMenuBarContentDirective {
9
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenuBarContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
10
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: RdxMenuBarContentDirective, isStandalone: true, selector: "[RdxMenuBarContent]", hostDirectives: [{ directive: i1.RdxMenuContentDirective }], ngImport: i0 }); }
6
+ const [injectRdxMenubarContext, provideRdxMenubarContext] = createContext('RdxMenubarContext');
7
+ const contextFactory = () => buildContext(inject(RdxMenubarRoot));
8
+ function buildContext(root) {
9
+ return {
10
+ activeId: root.activeId.asReadonly(),
11
+ isAnyOpen: root.isAnyOpen,
12
+ disabled: root.disabled,
13
+ orientation: root.orientation,
14
+ registerItem: (id, el, open, close, disabled) => root.registerItem(id, el, open, close, disabled),
15
+ activateItem: (id) => root.activateItem(id),
16
+ deactivateAll: () => root.deactivateAll(),
17
+ focusAdjacent: (id, offset, open) => root.focusAdjacent(id, offset, open),
18
+ focusBoundary: (boundary, open) => root.focusBoundary(boundary, open)
19
+ };
11
20
  }
12
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenuBarContentDirective, decorators: [{
13
- type: Directive,
14
- args: [{
15
- selector: '[RdxMenuBarContent]',
16
- hostDirectives: [RdxMenuContentDirective]
17
- }]
18
- }] });
19
-
20
- class RdxMenubarItemCheckboxDirective {
21
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenubarItemCheckboxDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
22
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: RdxMenubarItemCheckboxDirective, isStandalone: true, selector: "[RdxMenuBarCheckboxItem]", hostDirectives: [{ directive: i1.RdxMenuItemCheckboxDirective, inputs: ["checked", "checked", "disabled", "disabled"] }], ngImport: i0 }); }
23
- }
24
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenubarItemCheckboxDirective, decorators: [{
25
- type: Directive,
26
- args: [{
27
- selector: '[RdxMenuBarCheckboxItem]',
28
- hostDirectives: [
29
- {
30
- directive: RdxMenuItemCheckboxDirective,
31
- inputs: ['checked', 'disabled']
32
- }
33
- ]
34
- }]
35
- }] });
36
-
37
- class RdxMenubarItemIndicatorDirective {
38
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenubarItemIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
39
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: RdxMenubarItemIndicatorDirective, isStandalone: true, selector: "[RdxMenuBarItemIndicator]", hostDirectives: [{ directive: i1.RdxMenuItemIndicatorDirective }], ngImport: i0 }); }
40
- }
41
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenubarItemIndicatorDirective, decorators: [{
42
- type: Directive,
43
- args: [{
44
- selector: '[RdxMenuBarItemIndicator]',
45
- hostDirectives: [RdxMenuItemIndicatorDirective]
46
- }]
47
- }] });
48
-
49
- class RdxMenubarItemRadioDirective {
50
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenubarItemRadioDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
51
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: RdxMenubarItemRadioDirective, isStandalone: true, selector: "[RdxMenuBarItemRadio]", hostDirectives: [{ directive: i1.RdxMenuItemRadioDirective, inputs: ["disabled", "disabled", "checked", "checked"] }], ngImport: i0 }); }
52
- }
53
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenubarItemRadioDirective, decorators: [{
54
- type: Directive,
55
- args: [{
56
- selector: '[RdxMenuBarItemRadio]',
57
- hostDirectives: [
58
- {
59
- directive: RdxMenuItemRadioDirective,
60
- inputs: ['disabled', 'checked']
61
- }
62
- ]
63
- }]
64
- }] });
65
-
66
- class RdxMenuBarItemDirective {
67
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenuBarItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
68
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: RdxMenuBarItemDirective, isStandalone: true, selector: "[RdxMenuBarItem]", hostDirectives: [{ directive: i1.RdxMenuItemDirective, inputs: ["disabled", "disabled"], outputs: ["onSelect", "onSelect"] }], ngImport: i0 }); }
69
- }
70
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenuBarItemDirective, decorators: [{
71
- type: Directive,
72
- args: [{
73
- selector: '[RdxMenuBarItem]',
74
- hostDirectives: [
75
- {
76
- directive: RdxMenuItemDirective,
77
- inputs: ['disabled'],
78
- outputs: ['onSelect']
79
- }
80
- ]
81
- }]
82
- }] });
83
-
84
- class RdxMenubarRadioGroupDirective {
85
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenubarRadioGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
86
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: RdxMenubarRadioGroupDirective, isStandalone: true, selector: "[RdxMenuBarRadioGroup]", hostDirectives: [{ directive: i1$1.CdkMenuGroup }], ngImport: i0 }); }
87
- }
88
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenubarRadioGroupDirective, decorators: [{
89
- type: Directive,
90
- args: [{
91
- selector: '[RdxMenuBarRadioGroup]',
92
- hostDirectives: [CdkMenuGroup]
93
- }]
94
- }] });
95
-
96
- class RdxMenuBarRootDirective {
97
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenuBarRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
98
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: RdxMenuBarRootDirective, isStandalone: true, selector: "[RdxMenuBarRoot]", host: { attributes: { "tabindex": "0" }, properties: { "attr.data-orientation": "\"horizontal\"" } }, hostDirectives: [{ directive: i1$1.CdkMenuBar }], ngImport: i0 }); }
21
+ let nextMenubarItemId = 0;
22
+ /**
23
+ * Container for a horizontal application menu bar.
24
+ * Coordinates open/close state across multiple menus and provides arrow-key navigation.
25
+ */
26
+ class RdxMenubarRoot {
27
+ constructor() {
28
+ this.menuRoots = contentChildren(RdxMenuRoot, ...(ngDevMode ? [{ debugName: "menuRoots" }] : /* istanbul ignore next */ []));
29
+ this.ids = new WeakMap();
30
+ this.items = [];
31
+ /** Whether every menubar trigger is disabled. */
32
+ this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
33
+ /** Whether arrow-key navigation wraps at the first/last trigger. */
34
+ this.loopFocus = input(true, { ...(ngDevMode ? { debugName: "loopFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
35
+ /** The menubar orientation. */
36
+ this.orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
37
+ this.activeId = signal(null, ...(ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []));
38
+ this.isAnyOpen = computed(() => this.activeId() !== null, ...(ngDevMode ? [{ debugName: "isAnyOpen" }] : /* istanbul ignore next */ []));
39
+ effect((onCleanup) => {
40
+ const roots = this.menuRoots();
41
+ const registered = [];
42
+ roots.forEach((root) => {
43
+ const trigger = root.trigger();
44
+ if (!trigger || trigger.closest('[rdxMenuPopup]')) {
45
+ return;
46
+ }
47
+ registered.push(this.registerMenuRoot(root, trigger));
48
+ });
49
+ onCleanup(() => {
50
+ registered.forEach((cleanup) => cleanup());
51
+ });
52
+ });
53
+ effect(() => {
54
+ const activeId = this.activeId();
55
+ if (!activeId) {
56
+ return;
57
+ }
58
+ this.menuRoots().forEach((root) => {
59
+ const trigger = root.trigger();
60
+ if (!trigger || trigger.closest('[rdxMenuPopup]')) {
61
+ return;
62
+ }
63
+ if (this.idFor(root) === activeId && !root.open()) {
64
+ this.deactivateAll();
65
+ }
66
+ });
67
+ });
68
+ }
69
+ registerItem(id, el, open, close, disabled) {
70
+ this.items.push({ id, el, root: undefined, open, close, disabled });
71
+ // Keep items in DOM order
72
+ this.items.sort((a, b) => (a.el.compareDocumentPosition(b.el) & 4 ? -1 : 1));
73
+ return () => {
74
+ this.items = this.items.filter((item) => item.id !== id);
75
+ if (this.activeId() === id)
76
+ this.activeId.set(null);
77
+ };
78
+ }
79
+ activateItem(id) {
80
+ if (this.disabled()) {
81
+ return;
82
+ }
83
+ // Close every other open menu
84
+ this.items.forEach((item) => {
85
+ if (item.id !== id)
86
+ item.close();
87
+ });
88
+ this.activeId.set(id);
89
+ }
90
+ deactivateAll() {
91
+ this.activeId.set(null);
92
+ }
93
+ focusBoundary(boundary, openOnMove) {
94
+ const enabled = this.enabledItems();
95
+ this.focusItem(boundary === 'first' ? enabled[0] : enabled[enabled.length - 1], openOnMove);
96
+ }
97
+ generateId() {
98
+ return `rdx-menubar-item-${nextMenubarItemId++}`;
99
+ }
100
+ idFor(root) {
101
+ let id = this.ids.get(root);
102
+ if (!id) {
103
+ id = this.generateId();
104
+ this.ids.set(root, id);
105
+ }
106
+ return id;
107
+ }
108
+ registerMenuRoot(root, trigger) {
109
+ const id = this.idFor(root);
110
+ const unregisterPopupArrowNavigation = root.registerPopupArrowNavigationHandler((offset) => {
111
+ if (this.disabled()) {
112
+ return false;
113
+ }
114
+ this.focusAdjacent(id, offset, true);
115
+ return true;
116
+ });
117
+ const unregisterTriggerInteraction = root.registerTriggerInteractionHandler((interaction) => this.handleTriggerInteraction(id, root, trigger, interaction));
118
+ const unregisterItem = this.registerResolvedItem(id, trigger, root);
119
+ return () => {
120
+ unregisterItem();
121
+ unregisterTriggerInteraction();
122
+ unregisterPopupArrowNavigation();
123
+ };
124
+ }
125
+ registerResolvedItem(id, el, root) {
126
+ this.items.push({
127
+ id,
128
+ el,
129
+ root,
130
+ open: () => root.show(false),
131
+ close: () => root.close(),
132
+ disabled: () => this.disabled() || root.disabled() || el.hasAttribute('disabled')
133
+ });
134
+ this.items.sort((a, b) => (a.el.compareDocumentPosition(b.el) & 4 ? -1 : 1));
135
+ this.updateTriggerTabStops();
136
+ return () => {
137
+ this.items = this.items.filter((item) => item.id !== id);
138
+ if (this.activeId() === id)
139
+ this.activeId.set(null);
140
+ this.updateTriggerTabStops();
141
+ };
142
+ }
143
+ handleTriggerInteraction(id, root, trigger, interaction) {
144
+ if (this.disabled()) {
145
+ return false;
146
+ }
147
+ switch (interaction.type) {
148
+ case 'click': {
149
+ if (root.open()) {
150
+ root.close();
151
+ this.deactivateAll();
152
+ }
153
+ else {
154
+ root.show();
155
+ this.activateItem(id);
156
+ }
157
+ return true;
158
+ }
159
+ case 'pointerenter': {
160
+ if (interaction.event.pointerType === 'touch' || !this.hasOpenMenu()) {
161
+ return false;
162
+ }
163
+ if (root.open()) {
164
+ return true;
165
+ }
166
+ trigger.focus({ preventScroll: true });
167
+ root.show(false);
168
+ this.activateItem(id);
169
+ return true;
170
+ }
171
+ case 'arrowdown': {
172
+ interaction.event.preventDefault();
173
+ root.show('first');
174
+ this.activateItem(id);
175
+ return true;
176
+ }
177
+ case 'arrowup': {
178
+ interaction.event.preventDefault();
179
+ root.show('last');
180
+ this.activateItem(id);
181
+ return true;
182
+ }
183
+ case 'arrowleft': {
184
+ this.handleTriggerArrow(interaction.event, id, -1, root.open());
185
+ return true;
186
+ }
187
+ case 'arrowright': {
188
+ this.handleTriggerArrow(interaction.event, id, 1, root.open());
189
+ return true;
190
+ }
191
+ case 'home': {
192
+ this.handleTriggerBoundary(interaction.event, 'first', root.open());
193
+ return true;
194
+ }
195
+ case 'end': {
196
+ this.handleTriggerBoundary(interaction.event, 'last', root.open());
197
+ return true;
198
+ }
199
+ case 'escape': {
200
+ interaction.event.preventDefault();
201
+ interaction.event.stopPropagation();
202
+ root.close();
203
+ this.deactivateAll();
204
+ trigger.focus({ preventScroll: true });
205
+ return true;
206
+ }
207
+ }
208
+ }
209
+ handleTriggerArrow(event, id, offset, openOnMove) {
210
+ event.preventDefault();
211
+ event.stopPropagation();
212
+ event.stopImmediatePropagation();
213
+ this.focusAdjacent(id, offset, openOnMove);
214
+ }
215
+ handleTriggerBoundary(event, boundary, openOnMove) {
216
+ event.preventDefault();
217
+ event.stopPropagation();
218
+ event.stopImmediatePropagation();
219
+ this.focusBoundary(boundary, openOnMove);
220
+ }
221
+ focusAdjacent(currentId, offset, openOnMove) {
222
+ const enabled = this.enabledItems();
223
+ const currentIndex = enabled.findIndex((item) => item.id === currentId);
224
+ if (currentIndex === -1 || enabled.length === 0)
225
+ return;
226
+ const nextIndex = currentIndex + offset;
227
+ if (!this.loopFocus() && (nextIndex < 0 || nextIndex >= enabled.length)) {
228
+ return;
229
+ }
230
+ const next = enabled[(nextIndex + enabled.length) % enabled.length];
231
+ this.focusItem(next, openOnMove);
232
+ }
233
+ handleArrowLeft(event) {
234
+ this.handleOpenMenuNavigation(event, -1);
235
+ }
236
+ handleArrowRight(event) {
237
+ this.handleOpenMenuNavigation(event, 1);
238
+ }
239
+ handleOpenMenuNavigation(event, offset) {
240
+ const activeId = this.activeId();
241
+ if (!activeId || this.disabled() || !this.hasOpenMenu()) {
242
+ return;
243
+ }
244
+ event.preventDefault();
245
+ event.stopPropagation();
246
+ event.stopImmediatePropagation();
247
+ this.focusAdjacent(activeId, offset, true);
248
+ }
249
+ focusItem(item, openOnMove) {
250
+ if (!item || this.disabled())
251
+ return;
252
+ item.el.focus();
253
+ if (openOnMove) {
254
+ item.open();
255
+ this.activateItem(item.id);
256
+ }
257
+ }
258
+ updateTriggerTabStops() {
259
+ this.items.forEach((item) => item.el.setAttribute('tabindex', '-1'));
260
+ }
261
+ enabledItems() {
262
+ return this.items.filter((item) => !item.disabled());
263
+ }
264
+ hasOpenMenu() {
265
+ return this.items.some((item) => item.root?.open());
266
+ }
267
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxMenubarRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
268
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.9", type: RdxMenubarRoot, isStandalone: true, selector: "[rdxMenubarRoot]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, loopFocus: { classPropertyName: "loopFocus", publicName: "loopFocus", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "menubar", "tabindex": "0" }, listeners: { "keydown.arrowleft": "handleArrowLeft($event)", "keydown.arrowright": "handleArrowRight($event)" }, properties: { "attr.aria-orientation": "orientation()", "attr.data-orientation": "orientation()", "attr.data-disabled": "disabled() ? \"\" : undefined", "attr.data-has-submenu-open": "isAnyOpen() ? \"\" : undefined" } }, providers: [provideRdxMenubarContext(contextFactory)], queries: [{ propertyName: "menuRoots", predicate: RdxMenuRoot, isSignal: true }], exportAs: ["rdxMenubarRoot"], ngImport: i0 }); }
99
269
  }
100
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenuBarRootDirective, decorators: [{
270
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxMenubarRoot, decorators: [{
101
271
  type: Directive,
102
272
  args: [{
103
- selector: '[RdxMenuBarRoot]',
104
- hostDirectives: [CdkMenuBar],
273
+ selector: '[rdxMenubarRoot]',
274
+ exportAs: 'rdxMenubarRoot',
275
+ providers: [provideRdxMenubarContext(contextFactory)],
105
276
  host: {
277
+ role: 'menubar',
106
278
  tabindex: '0',
107
- '[attr.data-orientation]': '"horizontal"'
279
+ '[attr.aria-orientation]': 'orientation()',
280
+ '[attr.data-orientation]': 'orientation()',
281
+ '[attr.data-disabled]': 'disabled() ? "" : undefined',
282
+ '[attr.data-has-submenu-open]': 'isAnyOpen() ? "" : undefined',
283
+ '(keydown.arrowleft)': 'handleArrowLeft($event)',
284
+ '(keydown.arrowright)': 'handleArrowRight($event)'
108
285
  }
109
286
  }]
110
- }] });
111
-
112
- class RdxMenubarSeparatorDirective {
113
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenubarSeparatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
114
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: RdxMenubarSeparatorDirective, isStandalone: true, selector: "[RdxMenuBarSeparator]", hostDirectives: [{ directive: i1.RdxMenuSeparatorDirective }], ngImport: i0 }); }
115
- }
116
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenubarSeparatorDirective, decorators: [{
117
- type: Directive,
118
- args: [{
119
- selector: '[RdxMenuBarSeparator]',
120
- hostDirectives: [RdxMenuSeparatorDirective]
121
- }]
122
- }] });
287
+ }], ctorParameters: () => [], propDecorators: { menuRoots: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => RdxMenuRoot), { isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], loopFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "loopFocus", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }] } });
123
288
 
124
- class RdxMenuBarTriggerDirective {
125
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenuBarTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
126
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: RdxMenuBarTriggerDirective, isStandalone: true, selector: "[RdxMenuBarTrigger]", hostDirectives: [{ directive: i1.RdxMenuTriggerDirective, inputs: ["disabled", "disabled", "menuTriggerFor", "menuTriggerFor", "sideOffset", "sideOffset", "side", "side", "align", "align", "alignOffset", "alignOffset"] }], ngImport: i0 }); }
127
- }
128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxMenuBarTriggerDirective, decorators: [{
129
- type: Directive,
130
- args: [{
131
- selector: '[RdxMenuBarTrigger]',
132
- hostDirectives: [
133
- {
134
- directive: RdxMenuTriggerDirective,
135
- inputs: ['disabled', 'menuTriggerFor', 'sideOffset', 'side', 'align', 'alignOffset']
136
- }
137
- ]
138
- }]
139
- }] });
140
-
141
- const menubarImports = [
142
- RdxMenuBarContentDirective,
143
- RdxMenuBarTriggerDirective,
144
- RdxMenubarSeparatorDirective,
145
- RdxMenubarItemCheckboxDirective,
146
- RdxMenuBarRootDirective,
147
- RdxMenuBarItemDirective,
148
- RdxMenubarItemIndicatorDirective,
149
- RdxMenubarItemRadioDirective,
150
- RdxMenubarRadioGroupDirective
151
- ];
152
- class MenubarModule {
153
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: MenubarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
154
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.3", ngImport: i0, type: MenubarModule, imports: [RdxMenuBarContentDirective,
155
- RdxMenuBarTriggerDirective,
156
- RdxMenubarSeparatorDirective,
157
- RdxMenubarItemCheckboxDirective,
158
- RdxMenuBarRootDirective,
159
- RdxMenuBarItemDirective,
160
- RdxMenubarItemIndicatorDirective,
161
- RdxMenubarItemRadioDirective,
162
- RdxMenubarRadioGroupDirective], exports: [RdxMenuBarContentDirective,
163
- RdxMenuBarTriggerDirective,
164
- RdxMenubarSeparatorDirective,
165
- RdxMenubarItemCheckboxDirective,
166
- RdxMenuBarRootDirective,
167
- RdxMenuBarItemDirective,
168
- RdxMenubarItemIndicatorDirective,
169
- RdxMenubarItemRadioDirective,
170
- RdxMenubarRadioGroupDirective] }); }
171
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: MenubarModule }); }
289
+ /**
290
+ * Menubar-specific parts. Triggers use the standard `rdxMenuTrigger` from
291
+ * `@radix-ng/primitives/menu`; the menubar root wires them for roving focus,
292
+ * hover switching, and ArrowLeft / ArrowRight navigation. The menu popup, items,
293
+ * checkbox/radio, submenu, separator, etc. also come from `RdxMenuModule`.
294
+ */
295
+ const menubarImports = [RdxMenubarRoot];
296
+ class RdxMenubarModule {
297
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxMenubarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
298
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: RdxMenubarModule, imports: [RdxMenubarRoot], exports: [RdxMenubarRoot] }); }
299
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxMenubarModule }); }
172
300
  }
173
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: MenubarModule, decorators: [{
301
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxMenubarModule, decorators: [{
174
302
  type: NgModule,
175
303
  args: [{
176
304
  imports: [...menubarImports],
@@ -182,5 +310,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
182
310
  * Generated bundle index. Do not edit.
183
311
  */
184
312
 
185
- export { MenubarModule, RdxMenuBarContentDirective, RdxMenuBarItemDirective, RdxMenuBarRootDirective, RdxMenuBarTriggerDirective, RdxMenubarItemCheckboxDirective, RdxMenubarItemIndicatorDirective, RdxMenubarItemRadioDirective, RdxMenubarRadioGroupDirective, RdxMenubarSeparatorDirective };
313
+ export { RdxMenubarModule, RdxMenubarRoot, injectRdxMenubarContext, provideRdxMenubarContext };
186
314
  //# sourceMappingURL=radix-ng-primitives-menubar.mjs.map