@radix-ng/primitives 0.4.0 → 0.6.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 (181) hide show
  1. package/alert-dialog/README.md +1 -0
  2. package/alert-dialog/index.d.ts +6 -0
  3. package/alert-dialog/src/alert-dialog-cancel.directive.d.ts +7 -0
  4. package/alert-dialog/src/alert-dialog-content.directive.d.ts +8 -0
  5. package/alert-dialog/src/alert-dialog-root.directive.d.ts +9 -0
  6. package/alert-dialog/src/alert-dialog-title.directive.d.ts +5 -0
  7. package/alert-dialog/src/alert-dialog-trigger.directive.d.ts +7 -0
  8. package/alert-dialog/src/alert-dialog.service.d.ts +14 -0
  9. package/avatar/index.d.ts +3 -1
  10. package/avatar/src/avatar-fallback.directive.d.ts +10 -17
  11. package/avatar/src/avatar-image.directive.d.ts +10 -11
  12. package/avatar/src/avatar-root.directive.d.ts +21 -0
  13. package/avatar/src/avatar.config.d.ts +3 -2
  14. package/checkbox/src/checkbox.directive.d.ts +2 -1
  15. package/collapsible/README.md +1 -0
  16. package/collapsible/index.d.ts +3 -0
  17. package/collapsible/src/collapsible-content.directive.d.ts +11 -0
  18. package/collapsible/src/collapsible-root.directive.d.ts +52 -0
  19. package/collapsible/src/collapsible-trigger.directive.d.ts +26 -0
  20. package/esm2022/alert-dialog/index.mjs +7 -0
  21. package/esm2022/alert-dialog/radix-ng-primitives-alert-dialog.mjs +5 -0
  22. package/esm2022/alert-dialog/src/alert-dialog-cancel.directive.mjs +24 -0
  23. package/esm2022/alert-dialog/src/alert-dialog-content.directive.mjs +26 -0
  24. package/esm2022/alert-dialog/src/alert-dialog-root.directive.mjs +24 -0
  25. package/esm2022/alert-dialog/src/alert-dialog-title.directive.mjs +14 -0
  26. package/esm2022/alert-dialog/src/alert-dialog-trigger.directive.mjs +24 -0
  27. package/esm2022/alert-dialog/src/alert-dialog.service.mjs +45 -0
  28. package/esm2022/avatar/index.mjs +2 -2
  29. package/esm2022/avatar/src/avatar-fallback.directive.mjs +23 -30
  30. package/esm2022/avatar/src/avatar-image.directive.mjs +29 -31
  31. package/esm2022/avatar/src/avatar-root.directive.mjs +38 -0
  32. package/esm2022/avatar/src/avatar.config.mjs +2 -2
  33. package/esm2022/checkbox/src/checkbox-indicator.directive.mjs +4 -4
  34. package/esm2022/checkbox/src/checkbox.directive.mjs +4 -4
  35. package/esm2022/collapsible/index.mjs +4 -0
  36. package/esm2022/collapsible/radix-ng-primitives-collapsible.mjs +5 -0
  37. package/esm2022/collapsible/src/collapsible-content.directive.mjs +26 -0
  38. package/esm2022/collapsible/src/collapsible-root.directive.mjs +114 -0
  39. package/esm2022/collapsible/src/collapsible-trigger.directive.mjs +49 -0
  40. package/esm2022/label/index.mjs +2 -2
  41. package/esm2022/label/src/label-root.directive.mjs +48 -0
  42. package/esm2022/progress/index.mjs +2 -2
  43. package/esm2022/progress/src/progress-indicator.directive.mjs +11 -10
  44. package/esm2022/progress/src/progress-root.directive.mjs +71 -0
  45. package/esm2022/radio/index.mjs +2 -4
  46. package/esm2022/radio/src/radio-indicator.directive.mjs +8 -13
  47. package/esm2022/radio/src/radio-item.directive.mjs +27 -42
  48. package/esm2022/radio/src/radio-root.directive.mjs +106 -0
  49. package/esm2022/roving-focus/index.mjs +1 -3
  50. package/esm2022/roving-focus/src/roving-focus-group.directive.mjs +12 -18
  51. package/esm2022/roving-focus/src/roving-focus-item.directive.mjs +21 -26
  52. package/esm2022/separator/src/separator.directive.mjs +12 -17
  53. package/esm2022/switch/index.mjs +2 -3
  54. package/esm2022/switch/src/switch-root.directive.mjs +74 -0
  55. package/esm2022/switch/src/switch-thumb.directive.mjs +10 -12
  56. package/esm2022/toggle/index.mjs +2 -2
  57. package/esm2022/toggle/src/toggle-root.directive.mjs +51 -0
  58. package/esm2022/toggle-group/index.mjs +6 -0
  59. package/esm2022/toggle-group/radix-ng-primitives-toggle-group.mjs +5 -0
  60. package/esm2022/toggle-group/src/toggle-group-button.directive.mjs +79 -0
  61. package/esm2022/toggle-group/src/toggle-group-button.token.mjs +6 -0
  62. package/esm2022/toggle-group/src/toggle-group-multi.directive.mjs +159 -0
  63. package/esm2022/toggle-group/src/toggle-group.directive.mjs +157 -0
  64. package/esm2022/toggle-group/src/toggle-group.token.mjs +6 -0
  65. package/fesm2022/radix-ng-primitives-alert-dialog.mjs +150 -0
  66. package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -0
  67. package/fesm2022/radix-ng-primitives-avatar.mjs +79 -90
  68. package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
  69. package/fesm2022/radix-ng-primitives-checkbox.mjs +6 -6
  70. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  71. package/fesm2022/radix-ng-primitives-collapsible.mjs +190 -0
  72. package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -0
  73. package/fesm2022/radix-ng-primitives-label.mjs +20 -18
  74. package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
  75. package/fesm2022/radix-ng-primitives-progress.mjs +55 -49
  76. package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
  77. package/fesm2022/radix-ng-primitives-radio.mjs +70 -100
  78. package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
  79. package/fesm2022/radix-ng-primitives-roving-focus.mjs +22 -44
  80. package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
  81. package/fesm2022/radix-ng-primitives-separator.mjs +12 -17
  82. package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
  83. package/fesm2022/radix-ng-primitives-switch.mjs +49 -106
  84. package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
  85. package/fesm2022/radix-ng-primitives-toggle-group.mjs +397 -0
  86. package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -0
  87. package/fesm2022/radix-ng-primitives-toggle.mjs +15 -29
  88. package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
  89. package/label/index.d.ts +1 -1
  90. package/label/src/label-root.directive.d.ts +13 -0
  91. package/package.json +18 -19
  92. package/progress/index.d.ts +2 -1
  93. package/progress/src/progress-indicator.directive.d.ts +2 -2
  94. package/progress/src/progress-root.directive.d.ts +29 -0
  95. package/radio/index.d.ts +1 -3
  96. package/radio/src/radio-indicator.directive.d.ts +3 -9
  97. package/radio/src/radio-item.directive.d.ts +9 -28
  98. package/radio/src/{radio-group.directive.d.ts → radio-root.directive.d.ts} +24 -16
  99. package/roving-focus/index.d.ts +0 -2
  100. package/roving-focus/src/roving-focus-group.directive.d.ts +5 -7
  101. package/roving-focus/src/roving-focus-item.directive.d.ts +6 -8
  102. package/separator/src/separator.directive.d.ts +14 -8
  103. package/switch/index.d.ts +2 -2
  104. package/switch/src/switch-root.directive.d.ts +35 -0
  105. package/switch/src/switch-thumb.directive.d.ts +2 -5
  106. package/toggle/index.d.ts +2 -1
  107. package/toggle/src/toggle-root.directive.d.ts +32 -0
  108. package/toggle-group/README.md +3 -0
  109. package/toggle-group/index.d.ts +5 -0
  110. package/toggle-group/src/toggle-group-button.directive.d.ts +39 -0
  111. package/toggle-group/src/toggle-group-button.token.d.ts +4 -0
  112. package/toggle-group/src/toggle-group-multi.directive.d.ts +90 -0
  113. package/toggle-group/src/toggle-group.directive.d.ts +90 -0
  114. package/toggle-group/src/toggle-group.token.d.ts +5 -0
  115. package/avatar/src/avatar.directive.d.ts +0 -22
  116. package/avatar/src/avatar.token.d.ts +0 -4
  117. package/esm2022/avatar/src/avatar.directive.mjs +0 -38
  118. package/esm2022/avatar/src/avatar.token.mjs +0 -6
  119. package/esm2022/label/src/label.directive.mjs +0 -46
  120. package/esm2022/overlay/index.mjs +0 -5
  121. package/esm2022/overlay/radix-ng-primitives-overlay.mjs +0 -5
  122. package/esm2022/overlay/src/overlay-arrow.directive.mjs +0 -59
  123. package/esm2022/overlay/src/overlay-arrow.token.mjs +0 -3
  124. package/esm2022/overlay/src/overlay-trigger.directive.mjs +0 -279
  125. package/esm2022/overlay/src/overlay-trigger.token.mjs +0 -9
  126. package/esm2022/overlay/src/overlay.directive.mjs +0 -51
  127. package/esm2022/overlay/src/overlay.token.mjs +0 -3
  128. package/esm2022/progress/src/progress.directive.mjs +0 -62
  129. package/esm2022/progress/src/progress.token.mjs +0 -6
  130. package/esm2022/radio/src/radio-group.directive.mjs +0 -108
  131. package/esm2022/radio/src/radio-group.token.mjs +0 -6
  132. package/esm2022/radio/src/radio-item.token.mjs +0 -6
  133. package/esm2022/roving-focus/src/roving-focus-group.token.mjs +0 -9
  134. package/esm2022/roving-focus/src/roving-focus-item.token.mjs +0 -6
  135. package/esm2022/switch/src/switch.directive.mjs +0 -125
  136. package/esm2022/switch/src/switch.token.mjs +0 -6
  137. package/esm2022/toggle/src/toggle.directive.mjs +0 -65
  138. package/esm2022/tooltip/index.mjs +0 -5
  139. package/esm2022/tooltip/radix-ng-primitives-tooltip.mjs +0 -5
  140. package/esm2022/tooltip/src/tooltip-arrow.directive.mjs +0 -17
  141. package/esm2022/tooltip/src/tooltip-trigger.directive.mjs +0 -148
  142. package/esm2022/tooltip/src/tooltip-trigger.token.mjs +0 -6
  143. package/esm2022/tooltip/src/tooltip.config.mjs +0 -31
  144. package/esm2022/tooltip/src/tooltip.directive.mjs +0 -46
  145. package/esm2022/visually-hidden/index.mjs +0 -2
  146. package/esm2022/visually-hidden/radix-ng-primitives-visually-hidden.mjs +0 -5
  147. package/esm2022/visually-hidden/src/visually-hidden.directive.mjs +0 -42
  148. package/fesm2022/radix-ng-primitives-overlay.mjs +0 -399
  149. package/fesm2022/radix-ng-primitives-overlay.mjs.map +0 -1
  150. package/fesm2022/radix-ng-primitives-tooltip.mjs +0 -242
  151. package/fesm2022/radix-ng-primitives-tooltip.mjs.map +0 -1
  152. package/fesm2022/radix-ng-primitives-visually-hidden.mjs +0 -49
  153. package/fesm2022/radix-ng-primitives-visually-hidden.mjs.map +0 -1
  154. package/label/src/label.directive.d.ts +0 -14
  155. package/overlay/README.md +0 -1
  156. package/overlay/index.d.ts +0 -4
  157. package/overlay/src/overlay-arrow.directive.d.ts +0 -29
  158. package/overlay/src/overlay-arrow.token.d.ts +0 -3
  159. package/overlay/src/overlay-trigger.directive.d.ts +0 -163
  160. package/overlay/src/overlay-trigger.token.d.ts +0 -7
  161. package/overlay/src/overlay.directive.d.ts +0 -29
  162. package/overlay/src/overlay.token.d.ts +0 -3
  163. package/progress/src/progress.directive.d.ts +0 -26
  164. package/progress/src/progress.token.d.ts +0 -4
  165. package/radio/src/radio-group.token.d.ts +0 -4
  166. package/radio/src/radio-item.token.d.ts +0 -4
  167. package/roving-focus/src/roving-focus-group.token.d.ts +0 -7
  168. package/roving-focus/src/roving-focus-item.token.d.ts +0 -4
  169. package/switch/src/switch.directive.d.ts +0 -73
  170. package/switch/src/switch.token.d.ts +0 -4
  171. package/toggle/src/toggle.directive.d.ts +0 -30
  172. package/tooltip/README.md +0 -1
  173. package/tooltip/index.d.ts +0 -4
  174. package/tooltip/src/tooltip-arrow.directive.d.ts +0 -6
  175. package/tooltip/src/tooltip-trigger.directive.d.ts +0 -79
  176. package/tooltip/src/tooltip-trigger.token.d.ts +0 -4
  177. package/tooltip/src/tooltip.config.d.ts +0 -46
  178. package/tooltip/src/tooltip.directive.d.ts +0 -17
  179. package/visually-hidden/README.md +0 -3
  180. package/visually-hidden/index.d.ts +0 -1
  181. package/visually-hidden/src/visually-hidden.directive.d.ts +0 -11
@@ -1,18 +1,14 @@
1
1
  import { FocusKeyManager } from '@angular/cdk/a11y';
2
2
  import { Directionality } from '@angular/cdk/bidi';
3
3
  import * as i0 from '@angular/core';
4
- import { InjectionToken, inject, DestroyRef, QueryList, booleanAttribute, Directive, Input, ElementRef, ChangeDetectorRef, numberAttribute, HostBinding, HostListener } from '@angular/core';
4
+ import { InjectionToken, inject, DestroyRef, QueryList, booleanAttribute, Directive, Input, ElementRef, ChangeDetectorRef, numberAttribute } from '@angular/core';
5
5
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
6
  import { filter } from 'rxjs';
7
7
 
8
8
  const RdxRovingFocusGroupToken = new InjectionToken('RdxRovingFocusToken');
9
- /**
10
- * Inject the roving focus directive instance.
11
- */
12
9
  function injectRovingFocusGroup() {
13
10
  return inject(RdxRovingFocusGroupToken);
14
11
  }
15
-
16
12
  class RdxRovingFocusGroupDirective {
17
13
  constructor() {
18
14
  this.directionality = inject(Directionality);
@@ -22,10 +18,6 @@ class RdxRovingFocusGroupDirective {
22
18
  * We don't use ContentChildren as dynamically added items may not be in the correct order.
23
19
  */
24
20
  this.items = new QueryList();
25
- /**
26
- * Create the focus key manager instance.
27
- * @internal
28
- */
29
21
  this.keyManager = new FocusKeyManager(this.items);
30
22
  /**
31
23
  * Determine the orientation of the roving focus group.
@@ -41,7 +33,6 @@ class RdxRovingFocusGroupDirective {
41
33
  ngOnInit() {
42
34
  this.keyManager.withWrap(this.wrap);
43
35
  this.setOrientation(this.orientation);
44
- // update the key manager orientation if the document direction changes
45
36
  this.directionality.change
46
37
  .pipe(filter(() => this.orientation === 'horizontal'), takeUntilDestroyed(this.destroyRef))
47
38
  .subscribe((direction) => this.keyManager.withHorizontalOrientation(direction));
@@ -62,9 +53,7 @@ class RdxRovingFocusGroupDirective {
62
53
  * @param item The roving focus item to register.
63
54
  */
64
55
  register(item) {
65
- // add the item to the query list by sort the items based on their order
66
56
  this.items.reset([...this.items.toArray(), item].sort((a, b) => a.order - b.order));
67
- // if this is the first item, make it the active item
68
57
  if (this.items.length === 1) {
69
58
  this.keyManager.updateActiveItem(item);
70
59
  }
@@ -74,11 +63,8 @@ class RdxRovingFocusGroupDirective {
74
63
  * @param item The roving focus item to unregister.
75
64
  */
76
65
  unregister(item) {
77
- // determine if the item being removed is the active item
78
66
  const isActive = this.keyManager.activeItem === item;
79
- // remove the item from the query list
80
67
  this.items.reset(this.items.toArray().filter((i) => i !== item));
81
- // if the item being removed is the active item, make the first item the active item
82
68
  if (isActive) {
83
69
  this.keyManager.updateActiveItem(0);
84
70
  }
@@ -104,10 +90,10 @@ class RdxRovingFocusGroupDirective {
104
90
  this.keyManager.withVerticalOrientation();
105
91
  }
106
92
  }
107
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxRovingFocusGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
108
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.3", type: RdxRovingFocusGroupDirective, isStandalone: true, selector: "[rdxRovingFocusGroup]", inputs: { orientation: "orientation", wrap: ["wrap", "wrap", booleanAttribute] }, providers: [{ provide: RdxRovingFocusGroupToken, useExisting: RdxRovingFocusGroupDirective }], usesOnChanges: true, ngImport: i0 }); }
93
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxRovingFocusGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
94
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.11", type: RdxRovingFocusGroupDirective, isStandalone: true, selector: "[rdxRovingFocusGroup]", inputs: { orientation: ["rdxRovingFocusGroupOrientation", "orientation"], wrap: ["rdxRovingFocusGroupWrap", "wrap", booleanAttribute] }, providers: [{ provide: RdxRovingFocusGroupToken, useExisting: RdxRovingFocusGroupDirective }], usesOnChanges: true, ngImport: i0 }); }
109
95
  }
110
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxRovingFocusGroupDirective, decorators: [{
96
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxRovingFocusGroupDirective, decorators: [{
111
97
  type: Directive,
112
98
  args: [{
113
99
  selector: '[rdxRovingFocusGroup]',
@@ -115,17 +101,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
115
101
  providers: [{ provide: RdxRovingFocusGroupToken, useExisting: RdxRovingFocusGroupDirective }]
116
102
  }]
117
103
  }], propDecorators: { orientation: [{
118
- type: Input
104
+ type: Input,
105
+ args: [{ alias: 'rdxRovingFocusGroupOrientation' }]
119
106
  }], wrap: [{
120
107
  type: Input,
121
- args: [{ transform: booleanAttribute }]
108
+ args: [{ alias: 'rdxRovingFocusGroupWrap', transform: booleanAttribute }]
122
109
  }] } });
123
110
 
124
111
  const RdxRovingFocusItemToken = new InjectionToken('RdxRovingFocusItemToken');
125
112
  function injectRovingFocusItem() {
126
113
  return inject(RdxRovingFocusItemToken);
127
114
  }
128
-
129
115
  class RdxRovingFocusItemDirective {
130
116
  constructor() {
131
117
  /**
@@ -153,49 +139,47 @@ class RdxRovingFocusItemDirective {
153
139
  */
154
140
  this.disabled = false;
155
141
  }
156
- /**
157
- * Derive the tabindex of the roving focus item.
158
- * @internal
159
- */
160
- get tabindex() {
161
- return this.group.keyManager.activeItem === this ? 0 : -1;
162
- }
163
142
  ngOnInit() {
164
- // register the roving focus item with the group
165
143
  this.group.register(this);
166
- // listen for changes to the active item and run change detection
167
144
  this.group.keyManager.change
168
145
  .pipe(takeUntilDestroyed(this.destroyRef))
169
146
  .subscribe(() => this.changeDetectorRef.markForCheck());
170
147
  }
171
148
  ngOnDestroy() {
172
- // unregister the roving focus item with the group
173
149
  this.group.unregister(this);
174
150
  }
175
151
  /**
176
152
  * Handle key events on the roving focus item.
177
153
  * @param event The key event.
178
- * @internal
179
154
  */
180
- onKeydown(event) {
155
+ _onKeydown(event) {
181
156
  this.group.onKeydown(event);
182
157
  }
158
+ /**
159
+ * Derive the tabindex of the roving focus item.
160
+ */
161
+ _tabindex() {
162
+ return this.group.keyManager.activeItem === this ? 0 : -1;
163
+ }
183
164
  /**
184
165
  * Focus the roving focus item.
185
- * @param origin The origin of the focus request.
186
166
  * @internal
187
167
  */
188
168
  focus() {
189
169
  this.elementRef?.nativeElement.focus();
190
170
  }
191
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxRovingFocusItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
192
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.3", type: RdxRovingFocusItemDirective, isStandalone: true, selector: "[rdxRovingFocusItem]", inputs: { order: ["order", "order", numberAttribute], disabled: ["disabled", "disabled", booleanAttribute] }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "attr.tabindex": "this.tabindex" } }, providers: [{ provide: RdxRovingFocusItemToken, useExisting: RdxRovingFocusItemDirective }], ngImport: i0 }); }
171
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxRovingFocusItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
172
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.11", type: RdxRovingFocusItemDirective, isStandalone: true, selector: "[rdxRovingFocusItem]", inputs: { order: ["order", "order", numberAttribute], disabled: ["disabled", "disabled", booleanAttribute] }, host: { listeners: { "onKeydown": "_onKeydown($event)" }, properties: { "attr.tabindex": "_tabindex()" } }, providers: [{ provide: RdxRovingFocusItemToken, useExisting: RdxRovingFocusItemDirective }], ngImport: i0 }); }
193
173
  }
194
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxRovingFocusItemDirective, decorators: [{
174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxRovingFocusItemDirective, decorators: [{
195
175
  type: Directive,
196
176
  args: [{
197
177
  selector: '[rdxRovingFocusItem]',
198
178
  standalone: true,
179
+ host: {
180
+ '(onKeydown)': '_onKeydown($event)',
181
+ '[attr.tabindex]': '_tabindex()'
182
+ },
199
183
  providers: [{ provide: RdxRovingFocusItemToken, useExisting: RdxRovingFocusItemDirective }]
200
184
  }]
201
185
  }], propDecorators: { order: [{
@@ -204,17 +188,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
204
188
  }], disabled: [{
205
189
  type: Input,
206
190
  args: [{ transform: booleanAttribute }]
207
- }], tabindex: [{
208
- type: HostBinding,
209
- args: ['attr.tabindex']
210
- }], onKeydown: [{
211
- type: HostListener,
212
- args: ['keydown', ['$event']]
213
191
  }] } });
214
192
 
215
193
  /**
216
194
  * Generated bundle index. Do not edit.
217
195
  */
218
196
 
219
- export { RdxRovingFocusGroupDirective, RdxRovingFocusGroupToken, RdxRovingFocusItemDirective, RdxRovingFocusItemToken, injectRovingFocusGroup, injectRovingFocusItem };
197
+ export { RdxRovingFocusGroupDirective, RdxRovingFocusItemDirective, injectRovingFocusGroup, injectRovingFocusItem };
220
198
  //# sourceMappingURL=radix-ng-primitives-roving-focus.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-roving-focus.mjs","sources":["../../../packages/primitives/roving-focus/src/roving-focus-group.token.ts","../../../packages/primitives/roving-focus/src/roving-focus-group.directive.ts","../../../packages/primitives/roving-focus/src/roving-focus-item.token.ts","../../../packages/primitives/roving-focus/src/roving-focus-item.directive.ts","../../../packages/primitives/roving-focus/radix-ng-primitives-roving-focus.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\n\nimport type { RdxRovingFocusGroupDirective } from './roving-focus-group.directive';\n\nexport const RdxRovingFocusGroupToken = new InjectionToken<RdxRovingFocusGroupDirective>(\n 'RdxRovingFocusToken'\n);\n\n/**\n * Inject the roving focus directive instance.\n */\nexport function injectRovingFocusGroup(): RdxRovingFocusGroupDirective {\n return inject(RdxRovingFocusGroupToken);\n}\n","import { FocusKeyManager } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport {\n booleanAttribute,\n DestroyRef,\n Directive,\n inject,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n QueryList,\n SimpleChanges\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { filter } from 'rxjs';\n\nimport { RdxRovingFocusGroupToken } from './roving-focus-group.token';\nimport type { RdxRovingFocusItemDirective } from './roving-focus-item.directive';\n\n@Directive({\n selector: '[rdxRovingFocusGroup]',\n standalone: true,\n providers: [{ provide: RdxRovingFocusGroupToken, useExisting: RdxRovingFocusGroupDirective }]\n})\nexport class RdxRovingFocusGroupDirective implements OnInit, OnChanges, OnDestroy {\n private readonly directionality = inject(Directionality);\n\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Create a query list of all the roving focus items.\n * We don't use ContentChildren as dynamically added items may not be in the correct order.\n */\n private readonly items = new QueryList<RdxRovingFocusItemDirective>();\n\n /**\n * Create the focus key manager instance.\n * @internal\n */\n readonly keyManager = new FocusKeyManager<RdxRovingFocusItemDirective>(this.items);\n\n /**\n * Determine the orientation of the roving focus group.\n * @default vertical\n */\n @Input() orientation: 'horizontal' | 'vertical' = 'vertical';\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n * @default true\n */\n @Input({ transform: booleanAttribute }) wrap = true;\n\n ngOnInit(): void {\n this.keyManager.withWrap(this.wrap);\n\n this.setOrientation(this.orientation);\n\n // update the key manager orientation if the document direction changes\n this.directionality.change\n .pipe(\n filter(() => this.orientation === 'horizontal'),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe((direction) => this.keyManager.withHorizontalOrientation(direction));\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('orientation' in changes) {\n this.setOrientation(this.orientation);\n }\n\n if ('wrap' in changes) {\n this.keyManager.withWrap(this.wrap);\n }\n }\n\n ngOnDestroy(): void {\n this.keyManager.destroy();\n }\n\n /**\n * Register a roving focus item.\n * @param item The roving focus item to register.\n */\n register(item: RdxRovingFocusItemDirective): void {\n // add the item to the query list by sort the items based on their order\n this.items.reset([...this.items.toArray(), item].sort((a, b) => a.order - b.order));\n\n // if this is the first item, make it the active item\n if (this.items.length === 1) {\n this.keyManager.updateActiveItem(item);\n }\n }\n\n /**\n * Unregister a roving focus item.\n * @param item The roving focus item to unregister.\n */\n unregister(item: RdxRovingFocusItemDirective): void {\n // determine if the item being removed is the active item\n const isActive = this.keyManager.activeItem === item;\n\n // remove the item from the query list\n this.items.reset(this.items.toArray().filter((i) => i !== item));\n\n // if the item being removed is the active item, make the first item the active item\n if (isActive) {\n this.keyManager.updateActiveItem(0);\n }\n }\n\n /**\n * Handle key events on the roving focus items.\n * @param event The key event.\n * @internal\n */\n onKeydown(event: KeyboardEvent): void {\n this.keyManager.onKeydown(event);\n }\n\n /**\n * Set the orientation of the roving focus group.\n * @param orientation The orientation of the roving focus group.\n */\n setOrientation(orientation: 'horizontal' | 'vertical'): void {\n this.orientation = orientation;\n\n if (orientation === 'horizontal') {\n this.keyManager.withHorizontalOrientation(this.directionality.value);\n } else {\n this.keyManager.withVerticalOrientation();\n }\n }\n}\n","import { inject, InjectionToken } from '@angular/core';\n\nimport type { RdxRovingFocusItemDirective } from './roving-focus-item.directive';\n\nexport const RdxRovingFocusItemToken = new InjectionToken<RdxRovingFocusItemDirective>(\n 'RdxRovingFocusItemToken'\n);\n\nexport function injectRovingFocusItem(): RdxRovingFocusItemDirective {\n return inject(RdxRovingFocusItemToken);\n}\n","import { FocusableOption } from '@angular/cdk/a11y';\nimport {\n booleanAttribute,\n ChangeDetectorRef,\n DestroyRef,\n Directive,\n ElementRef,\n HostBinding,\n HostListener,\n inject,\n Input,\n numberAttribute,\n OnDestroy,\n OnInit\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { injectRovingFocusGroup } from './roving-focus-group.token';\nimport { RdxRovingFocusItemToken } from './roving-focus-item.token';\n\n@Directive({\n selector: '[rdxRovingFocusItem]',\n standalone: true,\n providers: [{ provide: RdxRovingFocusItemToken, useExisting: RdxRovingFocusItemDirective }]\n})\nexport class RdxRovingFocusItemDirective implements OnInit, OnDestroy, FocusableOption {\n /**\n * Access the group the roving focus item belongs to.\n */\n private readonly group = injectRovingFocusGroup();\n\n /**\n * Access the element reference of the roving focus item.\n */\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the destroyRef\n */\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Access the change detector ref\n */\n private readonly changeDetectorRef = inject(ChangeDetectorRef);\n\n /**\n * Define the order of the roving focus item in the group.\n */\n @Input({ transform: numberAttribute }) order = 0;\n\n /**\n * Define if the item is disabled.\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n /**\n * Derive the tabindex of the roving focus item.\n * @internal\n */\n @HostBinding('attr.tabindex')\n get tabindex(): number {\n return this.group.keyManager.activeItem === this ? 0 : -1;\n }\n\n ngOnInit(): void {\n // register the roving focus item with the group\n this.group.register(this);\n\n // listen for changes to the active item and run change detection\n this.group.keyManager.change\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.changeDetectorRef.markForCheck());\n }\n\n ngOnDestroy(): void {\n // unregister the roving focus item with the group\n this.group.unregister(this);\n }\n\n /**\n * Handle key events on the roving focus item.\n * @param event The key event.\n * @internal\n */\n @HostListener('keydown', ['$event'])\n onKeydown(event: KeyboardEvent): void {\n this.group.onKeydown(event);\n }\n\n /**\n * Focus the roving focus item.\n * @param origin The origin of the focus request.\n * @internal\n */\n focus(): void {\n this.elementRef?.nativeElement.focus();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAIa,wBAAwB,GAAG,IAAI,cAAc,CACtD,qBAAqB,EACvB;AAEF;;AAEG;SACa,sBAAsB,GAAA;AAClC,IAAA,OAAO,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAC5C;;MCYa,4BAA4B,CAAA;AALzC,IAAA,WAAA,GAAA;AAMqB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAExC,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAEjD;;;AA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2BAA2B,EAwBhB,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,eAAe,CAKf,EAAA,QAAA,EAAA,CAAA,UAAA,EAAA,UAAA,EAAA,gBAAgB,2HA/BzB,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAElF,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBALvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,UAAU,EAAE,IAAI;oBAChB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAA6B,2BAAA,EAAE,CAAC;AAC9F,iBAAA,CAAA;8BAyB0C,KAAK,EAAA,CAAA;sBAA3C,KAAK;uBAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;gBAKG,QAAQ,EAAA,CAAA;sBAA/C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;gBAOlC,QAAQ,EAAA,CAAA;sBADX,WAAW;uBAAC,eAAe,CAAA;gBA0B5B,SAAS,EAAA,CAAA;sBADR,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAA;;;ACrFvC;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-roving-focus.mjs","sources":["../../../packages/primitives/roving-focus/src/roving-focus-group.directive.ts","../../../packages/primitives/roving-focus/src/roving-focus-item.directive.ts","../../../packages/primitives/roving-focus/radix-ng-primitives-roving-focus.ts"],"sourcesContent":["import { FocusKeyManager } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport {\n booleanAttribute,\n DestroyRef,\n Directive,\n inject,\n InjectionToken,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n QueryList,\n SimpleChanges\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { filter } from 'rxjs';\n\nimport type { RdxRovingFocusItemDirective } from './roving-focus-item.directive';\n\nexport type Orientation = 'horizontal' | 'vertical';\n\nconst RdxRovingFocusGroupToken = new InjectionToken<RdxRovingFocusGroupDirective>(\n 'RdxRovingFocusToken'\n);\n\nexport function injectRovingFocusGroup(): RdxRovingFocusGroupDirective {\n return inject(RdxRovingFocusGroupToken);\n}\n\n@Directive({\n selector: '[rdxRovingFocusGroup]',\n standalone: true,\n providers: [{ provide: RdxRovingFocusGroupToken, useExisting: RdxRovingFocusGroupDirective }]\n})\nexport class RdxRovingFocusGroupDirective implements OnInit, OnChanges, OnDestroy {\n private readonly directionality = inject(Directionality);\n\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Create a query list of all the roving focus items.\n * We don't use ContentChildren as dynamically added items may not be in the correct order.\n */\n private readonly items = new QueryList<RdxRovingFocusItemDirective>();\n\n readonly keyManager = new FocusKeyManager<RdxRovingFocusItemDirective>(this.items);\n\n /**\n * Determine the orientation of the roving focus group.\n * @default vertical\n */\n @Input({ alias: 'rdxRovingFocusGroupOrientation' }) orientation: Orientation = 'vertical';\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n * @default true\n */\n @Input({ alias: 'rdxRovingFocusGroupWrap', transform: booleanAttribute }) wrap = true;\n\n ngOnInit(): void {\n this.keyManager.withWrap(this.wrap);\n\n this.setOrientation(this.orientation);\n\n this.directionality.change\n .pipe(\n filter(() => this.orientation === 'horizontal'),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe((direction) => this.keyManager.withHorizontalOrientation(direction));\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('orientation' in changes) {\n this.setOrientation(this.orientation);\n }\n\n if ('wrap' in changes) {\n this.keyManager.withWrap(this.wrap);\n }\n }\n\n ngOnDestroy(): void {\n this.keyManager.destroy();\n }\n\n /**\n * Register a roving focus item.\n * @param item The roving focus item to register.\n */\n register(item: RdxRovingFocusItemDirective): void {\n this.items.reset([...this.items.toArray(), item].sort((a, b) => a.order - b.order));\n\n if (this.items.length === 1) {\n this.keyManager.updateActiveItem(item);\n }\n }\n\n /**\n * Unregister a roving focus item.\n * @param item The roving focus item to unregister.\n */\n unregister(item: RdxRovingFocusItemDirective): void {\n const isActive = this.keyManager.activeItem === item;\n\n this.items.reset(this.items.toArray().filter((i) => i !== item));\n\n if (isActive) {\n this.keyManager.updateActiveItem(0);\n }\n }\n\n /**\n * Handle key events on the roving focus items.\n * @param event The key event.\n * @internal\n */\n onKeydown(event: KeyboardEvent): void {\n this.keyManager.onKeydown(event);\n }\n\n /**\n * Set the orientation of the roving focus group.\n * @param orientation The orientation of the roving focus group.\n */\n setOrientation(orientation: Orientation): void {\n this.orientation = orientation;\n\n if (orientation === 'horizontal') {\n this.keyManager.withHorizontalOrientation(this.directionality.value);\n } else {\n this.keyManager.withVerticalOrientation();\n }\n }\n}\n","import { FocusableOption } from '@angular/cdk/a11y';\nimport {\n booleanAttribute,\n ChangeDetectorRef,\n DestroyRef,\n Directive,\n ElementRef,\n inject,\n InjectionToken,\n Input,\n numberAttribute,\n OnDestroy,\n OnInit\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { injectRovingFocusGroup } from './roving-focus-group.directive';\n\nconst RdxRovingFocusItemToken = new InjectionToken<RdxRovingFocusItemDirective>(\n 'RdxRovingFocusItemToken'\n);\n\nexport function injectRovingFocusItem(): RdxRovingFocusItemDirective {\n return inject(RdxRovingFocusItemToken);\n}\n\n@Directive({\n selector: '[rdxRovingFocusItem]',\n standalone: true,\n host: {\n '(onKeydown)': '_onKeydown($event)',\n '[attr.tabindex]': '_tabindex()'\n },\n providers: [{ provide: RdxRovingFocusItemToken, useExisting: RdxRovingFocusItemDirective }]\n})\nexport class RdxRovingFocusItemDirective implements OnInit, OnDestroy, FocusableOption {\n /**\n * Access the group the roving focus item belongs to.\n */\n private readonly group = injectRovingFocusGroup();\n\n /**\n * Access the element reference of the roving focus item.\n */\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the destroyRef\n */\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Access the change detector ref\n */\n private readonly changeDetectorRef = inject(ChangeDetectorRef);\n\n /**\n * Define the order of the roving focus item in the group.\n */\n @Input({ transform: numberAttribute }) order = 0;\n\n /**\n * Define if the item is disabled.\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n ngOnInit(): void {\n this.group.register(this);\n\n this.group.keyManager.change\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.changeDetectorRef.markForCheck());\n }\n\n ngOnDestroy(): void {\n this.group.unregister(this);\n }\n\n /**\n * Handle key events on the roving focus item.\n * @param event The key event.\n */\n _onKeydown(event: KeyboardEvent): void {\n this.group.onKeydown(event);\n }\n\n /**\n * Derive the tabindex of the roving focus item.\n */\n _tabindex(): number {\n return this.group.keyManager.activeItem === this ? 0 : -1;\n }\n\n /**\n * Focus the roving focus item.\n * @internal\n */\n focus(): void {\n this.elementRef?.nativeElement.focus();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAsBA,MAAM,wBAAwB,GAAG,IAAI,cAAc,CAC/C,qBAAqB,CACxB,CAAC;SAEc,sBAAsB,GAAA;AAClC,IAAA,OAAO,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAC5C,CAAC;MAOY,4BAA4B,CAAA;AALzC,IAAA,WAAA,GAAA;AAMqB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAExC,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAEjD;;;AAGG;AACc,QAAA,IAAA,CAAA,KAAK,GAAG,IAAI,SAAS,EAA+B,CAAC;QAE7D,IAAU,CAAA,UAA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,IAAA,EAAA,2BAA2B,EAwBhB,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,eAAe,CAKf,EAAA,QAAA,EAAA,CAAA,UAAA,EAAA,UAAA,EAAA,gBAAgB,4HA/BzB,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAElF,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBATvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,aAAa,EAAE,oBAAoB;AACnC,wBAAA,iBAAiB,EAAE,aAAa;AACnC,qBAAA;oBACD,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAA6B,2BAAA,EAAE,CAAC;AAC9F,iBAAA,CAAA;8BAyB0C,KAAK,EAAA,CAAA;sBAA3C,KAAK;uBAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;gBAKG,QAAQ,EAAA,CAAA;sBAA/C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;;;AChE1C;;AAEG;;;;"}
@@ -1,44 +1,39 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { booleanAttribute, Directive, Input } from '@angular/core';
3
3
 
4
- class RdxSeparatorDirective {
4
+ const DEFAULT_ORIENTATION = 'horizontal';
5
+ const ORIENTATIONS = ['horizontal', 'vertical'];
6
+ class RdxSeparatorRootDirective {
5
7
  constructor() {
6
- /**
7
- * The orientation of the separator.
8
- * @default 'horizontal'
9
- */
10
- this.orientation = 'horizontal';
11
- /**
12
- * Whether the separator is for decoration purposes. If true, the separator will not be included in the accessibility tree.
13
- * @default false
14
- */
8
+ this.orientation = DEFAULT_ORIENTATION;
15
9
  this.decorative = false;
16
10
  }
17
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxSeparatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
18
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.3", type: RdxSeparatorDirective, isStandalone: true, selector: "[rdxSeparator]", inputs: { orientation: ["rdxSeparatorOrientation", "orientation"], decorative: ["rdxSeparatorDecorative", "decorative", booleanAttribute] }, host: { properties: { "attr.role": "decorative ? \"none\" : \"separator\"", "attr.aria-orientation": "!decorative && orientation === \"vertical\" ? \"vertical\" : null", "attr.data-orientation": "orientation" } }, ngImport: i0 }); }
11
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxSeparatorRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
12
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.11", type: RdxSeparatorRootDirective, isStandalone: true, selector: "div[SeparatorRoot]", inputs: { orientation: ["rdxOrientation", "orientation"], decorative: ["rdxDecorative", "decorative", booleanAttribute] }, host: { properties: { "attr.role": "decorative ? \"none\" : \"separator\"", "attr.aria-orientation": "!decorative && orientation === \"vertical\" ? \"vertical\" : null", "attr.data-orientation": "orientation" } }, ngImport: i0 }); }
19
13
  }
20
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxSeparatorDirective, decorators: [{
14
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxSeparatorRootDirective, decorators: [{
21
15
  type: Directive,
22
16
  args: [{
23
- selector: '[rdxSeparator]',
17
+ selector: 'div[SeparatorRoot]',
24
18
  standalone: true,
25
19
  host: {
26
20
  '[attr.role]': 'decorative ? "none" : "separator"',
21
+ // `aria-orientation` defaults to `horizontal` so we only need it if `orientation` is vertical
27
22
  '[attr.aria-orientation]': '!decorative && orientation === "vertical" ? "vertical" : null',
28
23
  '[attr.data-orientation]': 'orientation'
29
24
  }
30
25
  }]
31
26
  }], propDecorators: { orientation: [{
32
27
  type: Input,
33
- args: ['rdxSeparatorOrientation']
28
+ args: ['rdxOrientation']
34
29
  }], decorative: [{
35
30
  type: Input,
36
- args: [{ alias: 'rdxSeparatorDecorative', transform: booleanAttribute }]
31
+ args: [{ alias: 'rdxDecorative', transform: booleanAttribute }]
37
32
  }] } });
38
33
 
39
34
  /**
40
35
  * Generated bundle index. Do not edit.
41
36
  */
42
37
 
43
- export { RdxSeparatorDirective };
38
+ export { RdxSeparatorRootDirective };
44
39
  //# sourceMappingURL=radix-ng-primitives-separator.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-separator.mjs","sources":["../../../packages/primitives/separator/src/separator.directive.ts","../../../packages/primitives/separator/radix-ng-primitives-separator.ts"],"sourcesContent":["import { booleanAttribute, Directive, Input } from '@angular/core';\n\n@Directive({\n selector: '[rdxSeparator]',\n standalone: true,\n host: {\n '[attr.role]': 'decorative ? \"none\" : \"separator\"',\n '[attr.aria-orientation]': '!decorative && orientation === \"vertical\" ? \"vertical\" : null',\n '[attr.data-orientation]': 'orientation'\n }\n})\nexport class RdxSeparatorDirective {\n /**\n * The orientation of the separator.\n * @default 'horizontal'\n */\n @Input('rdxSeparatorOrientation') orientation: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Whether the separator is for decoration purposes. If true, the separator will not be included in the accessibility tree.\n * @default false\n */\n @Input({ alias: 'rdxSeparatorDecorative', transform: booleanAttribute }) decorative = false;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAWa,qBAAqB,CAAA;AATlC,IAAA,WAAA,GAAA;AAUI;;;AAGG;QAC+B,IAAW,CAAA,WAAA,GAA8B,YAAY,CAAC;AAExF;;;AAGG;QACsE,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;AAC/F,KAAA;8GAZY,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAArB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,qBAAqB,0KAWuB,gBAAgB,CAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,WAAA,EAAA,uCAAA,EAAA,uBAAA,EAAA,mEAAA,EAAA,uBAAA,EAAA,aAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAX5D,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBATjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,aAAa,EAAE,mCAAmC;AAClD,wBAAA,yBAAyB,EAAE,+DAA+D;AAC1F,wBAAA,yBAAyB,EAAE,aAAa;AAC3C,qBAAA;AACJ,iBAAA,CAAA;8BAMqC,WAAW,EAAA,CAAA;sBAA5C,KAAK;uBAAC,yBAAyB,CAAA;gBAMyC,UAAU,EAAA,CAAA;sBAAlF,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA,EAAE,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;;;ACtB3E;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-separator.mjs","sources":["../../../packages/primitives/separator/src/separator.directive.ts","../../../packages/primitives/separator/radix-ng-primitives-separator.ts"],"sourcesContent":["import { booleanAttribute, Directive, Input } from '@angular/core';\n\nconst DEFAULT_ORIENTATION = 'horizontal';\nconst ORIENTATIONS = ['horizontal', 'vertical'] as const;\n\nexport type Orientation = (typeof ORIENTATIONS)[number];\n\nexport interface SeparatorProps {\n /**\n * Either `vertical` or `horizontal`. Defaults to `horizontal`.\n */\n orientation?: Orientation;\n /**\n * Whether the component is purely decorative. When true, accessibility-related attributes\n * are updated so that the rendered element is removed from the accessibility tree.\n */\n decorative?: boolean;\n}\n\n@Directive({\n selector: 'div[SeparatorRoot]',\n standalone: true,\n host: {\n '[attr.role]': 'decorative ? \"none\" : \"separator\"',\n // `aria-orientation` defaults to `horizontal` so we only need it if `orientation` is vertical\n '[attr.aria-orientation]': '!decorative && orientation === \"vertical\" ? \"vertical\" : null',\n '[attr.data-orientation]': 'orientation'\n }\n})\nexport class RdxSeparatorRootDirective implements SeparatorProps {\n @Input('rdxOrientation') orientation: Orientation = DEFAULT_ORIENTATION;\n\n @Input({ alias: 'rdxDecorative', transform: booleanAttribute }) decorative = false;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA,MAAM,mBAAmB,GAAG,YAAY,CAAC;AACzC,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,UAAU,CAAU,CAAC;MA0B5C,yBAAyB,CAAA;AAVtC,IAAA,WAAA,GAAA;QAW6B,IAAW,CAAA,WAAA,GAAgB,mBAAmB,CAAC;QAER,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;AACtF,KAAA;+GAJY,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAAzB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,yBAAyB,4JAGU,gBAAgB,CAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,WAAA,EAAA,uCAAA,EAAA,uBAAA,EAAA,mEAAA,EAAA,uBAAA,EAAA,aAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAHnD,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAVrC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,aAAa,EAAE,mCAAmC;;AAElD,wBAAA,yBAAyB,EAAE,+DAA+D;AAC1F,wBAAA,yBAAyB,EAAE,aAAa;AAC3C,qBAAA;AACJ,iBAAA,CAAA;8BAE4B,WAAW,EAAA,CAAA;sBAAnC,KAAK;uBAAC,gBAAgB,CAAA;gBAEyC,UAAU,EAAA,CAAA;sBAAzE,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;;;AChClE;;AAEG;;;;"}
@@ -1,158 +1,101 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, Directive, ElementRef, EventEmitter, booleanAttribute, Input, Output, HostListener } from '@angular/core';
2
+ import { InjectionToken, inject, EventEmitter, booleanAttribute, Directive, Input, Output } from '@angular/core';
3
3
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
4
 
5
5
  const RdxSwitchToken = new InjectionToken('RdxSwitchToken');
6
6
  function injectSwitch() {
7
7
  return inject(RdxSwitchToken);
8
8
  }
9
-
10
- class RdxSwitchThumbDirective {
9
+ class RdxSwitchRootDirective {
11
10
  constructor() {
12
- /**
13
- * Access the switch directive.
14
- */
15
- this.switch = injectSwitch();
16
- }
17
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxSwitchThumbDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
18
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.3", type: RdxSwitchThumbDirective, isStandalone: true, selector: "[rdxSwitchThumb]", host: { properties: { "attr.data-state": "switch.checked ? \"checked\" : \"unchecked\"", "attr.data-disabled": "switch.disabled ? \"true\" : null" } }, ngImport: i0 }); }
19
- }
20
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxSwitchThumbDirective, decorators: [{
21
- type: Directive,
22
- args: [{
23
- selector: '[rdxSwitchThumb]',
24
- standalone: true,
25
- host: {
26
- '[attr.data-state]': 'switch.checked ? "checked" : "unchecked"',
27
- '[attr.data-disabled]': 'switch.disabled ? "true" : null'
28
- }
29
- }]
30
- }] });
31
-
32
- class RdxSwitchDirective {
33
- constructor() {
34
- /**
35
- * Access the element ref.
36
- */
37
- this.elementRef = inject(ElementRef);
38
- /**
39
- * Determine if the switch is a button
40
- */
41
- this.isButton = this.elementRef.nativeElement.tagName === 'BUTTON';
42
- /**
43
- * Determine if the switch is checked.
44
- * The controlled state of the switch.
45
- * @default false
46
- */
11
+ this.required = false;
47
12
  this.checked = false;
48
- /**
49
- * Determine if the switch is disabled.
50
- * When true, prevents the user from interacting with the switch.
51
- * @default false
52
- */
53
13
  this.disabled = false;
54
- /**
55
- * Event emitted when the checked state changes.
56
- */
57
- this.checkedChange = new EventEmitter();
14
+ this.onCheckedChange = new EventEmitter();
58
15
  }
59
- /**
60
- * Register the onChange callback.
61
- * @param fn The onChange callback.
62
- * @internal
63
- */
64
16
  registerOnChange(fn) {
65
- this.onChange = fn;
17
+ this._onChange = fn;
66
18
  }
67
- /**
68
- * Register the onTouched callback.
69
- * @param fn The onTouched callback.
70
- * @internal
71
- */
72
19
  registerOnTouched(fn) {
73
- this.onTouched = fn;
20
+ this._onTouched = fn;
74
21
  }
75
- /**
76
- * Write the value to the checked state.
77
- * @param checked The checked state.
78
- * @internal
79
- */
80
22
  writeValue(checked) {
81
23
  this.checked = checked;
82
24
  }
83
- /**
84
- * Set the disabled state.
85
- * @param isDisabled The disabled state.
86
- * @internal
87
- */
88
25
  setDisabledState(isDisabled) {
89
26
  this.disabled = isDisabled;
90
27
  }
91
- /**
92
- * Toggle the checked state.
93
- */
94
- toggle() {
28
+ _toggle() {
95
29
  if (this.disabled) {
96
30
  return;
97
31
  }
98
32
  this.checked = !this.checked;
99
- this.checkedChange.emit(this.checked);
100
- this.onChange?.(this.checked);
101
- }
102
- /**
103
- * Handle the keydown event.
104
- */
105
- onKeyDown() {
106
- // If the switch is not a button then the space key will not toggle the checked state automatically,
107
- // so we need to do it manually.
108
- if (!this.isButton) {
109
- this.toggle();
110
- }
33
+ this._onChange?.(this.checked);
111
34
  }
112
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxSwitchDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
113
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.3", type: RdxSwitchDirective, isStandalone: true, selector: "[rdxSwitch]", inputs: { checked: ["checked", "checked", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute] }, outputs: { checkedChange: "checkedChange" }, host: { attributes: { "role": "switch" }, listeners: { "focus": "onTouched?.()", "click": "toggle()", "keydown.space": "onKeyDown()" }, properties: { "attr.type": "isButton ? \"button\" : null", "attr.aria-checked": "checked", "attr.data-state": "checked ? \"checked\" : \"unchecked\"", "attr.data-disabled": "disabled ? \"true\" : null", "attr.disabled": "isButton && disabled ? disabled : null" } }, providers: [
114
- { provide: RdxSwitchToken, useExisting: RdxSwitchDirective },
115
- { provide: NG_VALUE_ACCESSOR, useExisting: RdxSwitchDirective, multi: true }
116
- ], ngImport: i0 }); }
35
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxSwitchRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
36
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.11", type: RdxSwitchRootDirective, isStandalone: true, selector: "button[SwitchRoot]", inputs: { required: ["required", "required", booleanAttribute], checked: ["checked", "checked", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute] }, outputs: { onCheckedChange: "onCheckedChange" }, host: { attributes: { "role": "switch" }, listeners: { "focus": "_onTouched?.()", "click": "_toggle()" }, properties: { "attr.aria-checked": "checked", "attr.aria-required": "required", "attr.data-state": "checked ? \"checked\" : \"unchecked\"", "attr.data-disabled": "disabled ? \"true\" : null", "attr.disabled": "disabled ? disabled : null" } }, providers: [
37
+ { provide: RdxSwitchToken, useExisting: RdxSwitchRootDirective },
38
+ { provide: NG_VALUE_ACCESSOR, useExisting: RdxSwitchRootDirective, multi: true }
39
+ ], exportAs: ["SwitchRoot"], ngImport: i0 }); }
117
40
  }
118
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxSwitchDirective, decorators: [{
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxSwitchRootDirective, decorators: [{
119
42
  type: Directive,
120
43
  args: [{
121
- selector: '[rdxSwitch]',
44
+ // TODO: added Forms input
45
+ selector: 'button[SwitchRoot]',
46
+ exportAs: 'SwitchRoot',
122
47
  standalone: true,
123
48
  providers: [
124
- { provide: RdxSwitchToken, useExisting: RdxSwitchDirective },
125
- { provide: NG_VALUE_ACCESSOR, useExisting: RdxSwitchDirective, multi: true }
49
+ { provide: RdxSwitchToken, useExisting: RdxSwitchRootDirective },
50
+ { provide: NG_VALUE_ACCESSOR, useExisting: RdxSwitchRootDirective, multi: true }
126
51
  ],
127
52
  host: {
128
53
  role: 'switch',
129
- '[attr.type]': 'isButton ? "button" : null',
130
54
  '[attr.aria-checked]': 'checked',
55
+ '[attr.aria-required]': 'required',
131
56
  '[attr.data-state]': 'checked ? "checked" : "unchecked"',
132
57
  '[attr.data-disabled]': 'disabled ? "true" : null',
133
- '[attr.disabled]': 'isButton && disabled ? disabled : null',
134
- '(focus)': 'onTouched?.()'
58
+ '[attr.disabled]': 'disabled ? disabled : null',
59
+ '(focus)': '_onTouched?.()',
60
+ '(click)': '_toggle()'
135
61
  }
136
62
  }]
137
- }], propDecorators: { checked: [{
63
+ }], propDecorators: { required: [{
64
+ type: Input,
65
+ args: [{ transform: booleanAttribute }]
66
+ }], checked: [{
138
67
  type: Input,
139
68
  args: [{ transform: booleanAttribute }]
140
69
  }], disabled: [{
141
70
  type: Input,
142
71
  args: [{ transform: booleanAttribute }]
143
- }], checkedChange: [{
72
+ }], onCheckedChange: [{
144
73
  type: Output
145
- }], toggle: [{
146
- type: HostListener,
147
- args: ['click']
148
- }], onKeyDown: [{
149
- type: HostListener,
150
- args: ['keydown.space']
151
74
  }] } });
152
75
 
76
+ class RdxSwitchThumbDirective {
77
+ constructor() {
78
+ this.switchRoot = injectSwitch();
79
+ }
80
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxSwitchThumbDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
81
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.11", type: RdxSwitchThumbDirective, isStandalone: true, selector: "span[SwitchThumb]", host: { properties: { "attr.data-disabled": "switchRoot.disabled ? \"true\" : null", "attr.data-state": "switchRoot.checked ? \"checked\" : \"unchecked\"" } }, exportAs: ["SwitchThumb"], ngImport: i0 }); }
82
+ }
83
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxSwitchThumbDirective, decorators: [{
84
+ type: Directive,
85
+ args: [{
86
+ selector: 'span[SwitchThumb]',
87
+ exportAs: 'SwitchThumb',
88
+ standalone: true,
89
+ host: {
90
+ '[attr.data-disabled]': 'switchRoot.disabled ? "true" : null',
91
+ '[attr.data-state]': 'switchRoot.checked ? "checked" : "unchecked"'
92
+ }
93
+ }]
94
+ }] });
95
+
153
96
  /**
154
97
  * Generated bundle index. Do not edit.
155
98
  */
156
99
 
157
- export { RdxSwitchDirective, RdxSwitchThumbDirective, RdxSwitchToken, injectSwitch };
100
+ export { RdxSwitchRootDirective, RdxSwitchThumbDirective, RdxSwitchToken, injectSwitch };
158
101
  //# sourceMappingURL=radix-ng-primitives-switch.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-switch.mjs","sources":["../../../packages/primitives/switch/src/switch.token.ts","../../../packages/primitives/switch/src/switch-thumb.directive.ts","../../../packages/primitives/switch/src/switch.directive.ts","../../../packages/primitives/switch/radix-ng-primitives-switch.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\n\nimport type { RdxSwitchDirective } from './switch.directive';\n\nexport const RdxSwitchToken = new InjectionToken<RdxSwitchDirective>('RdxSwitchToken');\n\nexport function injectSwitch(): RdxSwitchDirective {\n return inject(RdxSwitchToken);\n}\n","import { Directive } from '@angular/core';\n\nimport { injectSwitch } from './switch.token';\n\n@Directive({\n selector: '[rdxSwitchThumb]',\n standalone: true,\n host: {\n '[attr.data-state]': 'switch.checked ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'switch.disabled ? \"true\" : null'\n }\n})\nexport class RdxSwitchThumbDirective {\n /**\n * Access the switch directive.\n */\n protected readonly switch = injectSwitch();\n}\n","import {\n booleanAttribute,\n Directive,\n ElementRef,\n EventEmitter,\n HostListener,\n inject,\n Input,\n Output\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport { RdxSwitchToken } from './switch.token';\n\n@Directive({\n selector: '[rdxSwitch]',\n standalone: true,\n providers: [\n { provide: RdxSwitchToken, useExisting: RdxSwitchDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RdxSwitchDirective, multi: true }\n ],\n host: {\n role: 'switch',\n '[attr.type]': 'isButton ? \"button\" : null',\n '[attr.aria-checked]': 'checked',\n '[attr.data-state]': 'checked ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'disabled ? \"true\" : null',\n '[attr.disabled]': 'isButton && disabled ? disabled : null',\n '(focus)': 'onTouched?.()'\n }\n})\nexport class RdxSwitchDirective implements ControlValueAccessor {\n /**\n * Access the element ref.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Determine if the switch is a button\n */\n protected isButton = this.elementRef.nativeElement.tagName === 'BUTTON';\n\n /**\n * Determine if the switch is checked.\n * The controlled state of the switch.\n * @default false\n */\n @Input({ transform: booleanAttribute }) checked = false;\n\n /**\n * Determine if the switch is disabled.\n * When true, prevents the user from interacting with the switch.\n * @default false\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n /**\n * Event emitted when the checked state changes.\n */\n @Output() readonly checkedChange = new EventEmitter<boolean>();\n\n /**\n * Store the onChange callback.\n */\n private onChange?: (checked: boolean) => void;\n\n /**\n * Store the onTouched callback.\n */\n protected onTouched?: () => void;\n\n /**\n * Register the onChange callback.\n * @param fn The onChange callback.\n * @internal\n */\n registerOnChange(fn: (checked: boolean) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Register the onTouched callback.\n * @param fn The onTouched callback.\n * @internal\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Write the value to the checked state.\n * @param checked The checked state.\n * @internal\n */\n writeValue(checked: boolean): void {\n this.checked = checked;\n }\n\n /**\n * Set the disabled state.\n * @param isDisabled The disabled state.\n * @internal\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n /**\n * Toggle the checked state.\n */\n @HostListener('click')\n toggle(): void {\n if (this.disabled) {\n return;\n }\n\n this.checked = !this.checked;\n this.checkedChange.emit(this.checked);\n this.onChange?.(this.checked);\n }\n\n /**\n * Handle the keydown event.\n */\n @HostListener('keydown.space')\n protected onKeyDown(): void {\n // If the switch is not a button then the space key will not toggle the checked state automatically,\n // so we need to do it manually.\n if (!this.isButton) {\n this.toggle();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAIa,cAAc,GAAG,IAAI,cAAc,CAAqB,gBAAgB,EAAE;SAEvE,YAAY,GAAA;AACxB,IAAA,OAAO,MAAM,CAAC,cAAc,CAAC,CAAC;AAClC;;MCIa,uBAAuB,CAAA;AARpC,IAAA,WAAA,GAAA;AASI;;AAEG;QACgB,IAAM,CAAA,MAAA,GAAG,YAAY,EAAE,CAAC;AAC9C,KAAA;8GALY,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;kGAAvB,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,8CAAA,EAAA,oBAAA,EAAA,mCAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBARnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,0CAA0C;AAC/D,wBAAA,sBAAsB,EAAE,iCAAiC;AAC5D,qBAAA;AACJ,iBAAA,CAAA;;;MCoBY,kBAAkB,CAAA;AAjB/B,IAAA,WAAA,GAAA;AAkBI;;AAEG;AACc,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAA0B,UAAU,CAAC,CAAC;AAE1E;;AAEG;QACO,IAAQ,CAAA,QAAA,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,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AAI,EAAE;AAC/E,qBAAA;AACD,oBAAA,IAAI,EAAE;AACF,wBAAA,IAAI,EAAE,QAAQ;AACd,wBAAA,aAAa,EAAE,4BAA4B;AAC3C,wBAAA,qBAAqB,EAAE,SAAS;AAChC,wBAAA,mBAAmB,EAAE,mCAAmC;AACxD,wBAAA,sBAAsB,EAAE,0BAA0B;AAClD,wBAAA,iBAAiB,EAAE,wCAAwC;AAC3D,wBAAA,SAAS,EAAE,eAAe;AAC7B,qBAAA;AACJ,iBAAA,CAAA;8BAiB2C,OAAO,EAAA,CAAA;sBAA9C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;gBAOE,QAAQ,EAAA,CAAA;sBAA/C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;gBAKnB,aAAa,EAAA,CAAA;sBAA/B,MAAM;gBAoDP,MAAM,EAAA,CAAA;sBADL,YAAY;uBAAC,OAAO,CAAA;gBAeX,SAAS,EAAA,CAAA;sBADlB,YAAY;uBAAC,eAAe,CAAA;;;AC5HjC;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-switch.mjs","sources":["../../../packages/primitives/switch/src/switch-root.directive.ts","../../../packages/primitives/switch/src/switch-thumb.directive.ts","../../../packages/primitives/switch/radix-ng-primitives-switch.ts"],"sourcesContent":["import {\n booleanAttribute,\n Directive,\n EventEmitter,\n inject,\n InjectionToken,\n Input,\n Output\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nexport const RdxSwitchToken = new InjectionToken<RdxSwitchRootDirective>('RdxSwitchToken');\n\nexport function injectSwitch(): RdxSwitchRootDirective {\n return inject(RdxSwitchToken);\n}\n\nexport interface SwitchProps {\n checked?: boolean;\n defaultChecked?: boolean;\n required?: boolean;\n onCheckedChange?: EventEmitter<boolean>;\n}\n\n@Directive({\n // TODO: added Forms input\n selector: 'button[SwitchRoot]',\n exportAs: 'SwitchRoot',\n standalone: true,\n providers: [\n { provide: RdxSwitchToken, useExisting: RdxSwitchRootDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RdxSwitchRootDirective, multi: true }\n ],\n host: {\n role: 'switch',\n\n '[attr.aria-checked]': 'checked',\n '[attr.aria-required]': 'required',\n '[attr.data-state]': 'checked ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'disabled ? \"true\" : null',\n '[attr.disabled]': 'disabled ? disabled : null',\n\n '(focus)': '_onTouched?.()',\n '(click)': '_toggle()'\n }\n})\nexport class RdxSwitchRootDirective implements SwitchProps, ControlValueAccessor {\n @Input({ transform: booleanAttribute }) required = false;\n\n @Input({ transform: booleanAttribute }) checked = false;\n\n @Input({ transform: booleanAttribute }) disabled = false;\n\n @Output() readonly onCheckedChange = new EventEmitter<boolean>();\n\n /**\n * The method to be called in order to update ngModel.\n */\n _onChange?: (checked: boolean) => void;\n\n /**\n * onTouch function registered via registerOnTouch (ControlValueAccessor).\n */\n _onTouched?: () => void;\n\n registerOnChange(fn: (checked: boolean) => void): void {\n this._onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this._onTouched = fn;\n }\n\n writeValue(checked: boolean): void {\n this.checked = checked;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n _toggle(): void {\n if (this.disabled) {\n return;\n }\n\n this.checked = !this.checked;\n this._onChange?.(this.checked);\n }\n}\n","import { Directive } from '@angular/core';\n\nimport { injectSwitch } from './switch-root.directive';\n\n@Directive({\n selector: 'span[SwitchThumb]',\n exportAs: 'SwitchThumb',\n standalone: true,\n host: {\n '[attr.data-disabled]': 'switchRoot.disabled ? \"true\" : null',\n '[attr.data-state]': 'switchRoot.checked ? \"checked\" : \"unchecked\"'\n }\n})\nexport class RdxSwitchThumbDirective {\n protected readonly switchRoot = injectSwitch();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAWa,cAAc,GAAG,IAAI,cAA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