@radix-ng/primitives 0.5.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 (180) 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 +9 -16
  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/src/toggle-group-button.directive.mjs +4 -4
  59. package/esm2022/toggle-group/src/toggle-group-multi.directive.mjs +4 -4
  60. package/esm2022/toggle-group/src/toggle-group.directive.mjs +4 -4
  61. package/fesm2022/radix-ng-primitives-alert-dialog.mjs +150 -0
  62. package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -0
  63. package/fesm2022/radix-ng-primitives-avatar.mjs +79 -90
  64. package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
  65. package/fesm2022/radix-ng-primitives-checkbox.mjs +6 -6
  66. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  67. package/fesm2022/radix-ng-primitives-collapsible.mjs +190 -0
  68. package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -0
  69. package/fesm2022/radix-ng-primitives-label.mjs +20 -32
  70. package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
  71. package/fesm2022/radix-ng-primitives-progress.mjs +55 -49
  72. package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
  73. package/fesm2022/radix-ng-primitives-radio.mjs +70 -100
  74. package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
  75. package/fesm2022/radix-ng-primitives-roving-focus.mjs +19 -42
  76. package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
  77. package/fesm2022/radix-ng-primitives-separator.mjs +12 -17
  78. package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
  79. package/fesm2022/radix-ng-primitives-switch.mjs +49 -106
  80. package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
  81. package/fesm2022/radix-ng-primitives-toggle-group.mjs +9 -9
  82. package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
  83. package/fesm2022/radix-ng-primitives-toggle.mjs +15 -29
  84. package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
  85. package/label/index.d.ts +1 -1
  86. package/label/src/label-root.directive.d.ts +13 -0
  87. package/package.json +12 -19
  88. package/progress/index.d.ts +2 -1
  89. package/progress/src/progress-indicator.directive.d.ts +2 -2
  90. package/progress/src/progress-root.directive.d.ts +29 -0
  91. package/radio/index.d.ts +1 -3
  92. package/radio/src/radio-indicator.directive.d.ts +3 -9
  93. package/radio/src/radio-item.directive.d.ts +9 -28
  94. package/radio/src/{radio-group.directive.d.ts → radio-root.directive.d.ts} +24 -16
  95. package/roving-focus/index.d.ts +0 -2
  96. package/roving-focus/src/roving-focus-group.directive.d.ts +4 -6
  97. package/roving-focus/src/roving-focus-item.directive.d.ts +6 -8
  98. package/separator/src/separator.directive.d.ts +14 -8
  99. package/switch/index.d.ts +2 -2
  100. package/switch/src/switch-root.directive.d.ts +35 -0
  101. package/switch/src/switch-thumb.directive.d.ts +2 -5
  102. package/toggle/index.d.ts +2 -1
  103. package/toggle/src/toggle-root.directive.d.ts +32 -0
  104. package/toggle-group/src/toggle-group-multi.directive.d.ts +1 -1
  105. package/toggle-group/src/toggle-group.directive.d.ts +1 -1
  106. package/accordion/README.md +0 -3
  107. package/accordion/index.d.ts +0 -7
  108. package/accordion/src/accordion/accordion.directive.d.ts +0 -64
  109. package/accordion/src/accordion/accordion.token.d.ts +0 -4
  110. package/accordion/src/accordion-content/accordion-content.directive.d.ts +0 -44
  111. package/accordion/src/accordion-header/accordion-header.directive.d.ts +0 -6
  112. package/accordion/src/accordion-item/accordion-item.directive.d.ts +0 -42
  113. package/accordion/src/accordion-item/accordion-item.token.d.ts +0 -4
  114. package/accordion/src/accordion-state.directive.d.ts +0 -28
  115. package/accordion/src/accordion-trigger/accordion-trigger.directive.d.ts +0 -23
  116. package/accordion/src/accordion.config.d.ts +0 -25
  117. package/avatar/src/avatar.directive.d.ts +0 -22
  118. package/avatar/src/avatar.token.d.ts +0 -4
  119. package/esm2022/accordion/index.mjs +0 -8
  120. package/esm2022/accordion/radix-ng-primitives-accordion.mjs +0 -5
  121. package/esm2022/accordion/src/accordion/accordion.directive.mjs +0 -108
  122. package/esm2022/accordion/src/accordion/accordion.token.mjs +0 -6
  123. package/esm2022/accordion/src/accordion-content/accordion-content.directive.mjs +0 -75
  124. package/esm2022/accordion/src/accordion-header/accordion-header.directive.mjs +0 -17
  125. package/esm2022/accordion/src/accordion-item/accordion-item.directive.mjs +0 -81
  126. package/esm2022/accordion/src/accordion-item/accordion-item.token.mjs +0 -6
  127. package/esm2022/accordion/src/accordion-state.directive.mjs +0 -49
  128. package/esm2022/accordion/src/accordion-trigger/accordion-trigger.directive.mjs +0 -49
  129. package/esm2022/accordion/src/accordion.config.mjs +0 -27
  130. package/esm2022/avatar/src/avatar.directive.mjs +0 -38
  131. package/esm2022/avatar/src/avatar.token.mjs +0 -6
  132. package/esm2022/label/src/label.directive.mjs +0 -60
  133. package/esm2022/overlay/index.mjs +0 -5
  134. package/esm2022/overlay/radix-ng-primitives-overlay.mjs +0 -5
  135. package/esm2022/overlay/src/overlay-arrow.directive.mjs +0 -59
  136. package/esm2022/overlay/src/overlay-arrow.token.mjs +0 -3
  137. package/esm2022/overlay/src/overlay-trigger.directive.mjs +0 -279
  138. package/esm2022/overlay/src/overlay-trigger.token.mjs +0 -9
  139. package/esm2022/overlay/src/overlay.directive.mjs +0 -51
  140. package/esm2022/overlay/src/overlay.token.mjs +0 -3
  141. package/esm2022/progress/src/progress.directive.mjs +0 -62
  142. package/esm2022/progress/src/progress.token.mjs +0 -6
  143. package/esm2022/radio/src/radio-group.directive.mjs +0 -108
  144. package/esm2022/radio/src/radio-group.token.mjs +0 -6
  145. package/esm2022/radio/src/radio-item.token.mjs +0 -6
  146. package/esm2022/roving-focus/src/roving-focus-group.token.mjs +0 -9
  147. package/esm2022/roving-focus/src/roving-focus-item.token.mjs +0 -6
  148. package/esm2022/switch/src/switch.directive.mjs +0 -125
  149. package/esm2022/switch/src/switch.token.mjs +0 -6
  150. package/esm2022/toggle/src/toggle.directive.mjs +0 -65
  151. package/esm2022/visually-hidden/index.mjs +0 -2
  152. package/esm2022/visually-hidden/radix-ng-primitives-visually-hidden.mjs +0 -5
  153. package/esm2022/visually-hidden/src/visually-hidden.directive.mjs +0 -42
  154. package/fesm2022/radix-ng-primitives-accordion.mjs +0 -394
  155. package/fesm2022/radix-ng-primitives-accordion.mjs.map +0 -1
  156. package/fesm2022/radix-ng-primitives-overlay.mjs +0 -399
  157. package/fesm2022/radix-ng-primitives-overlay.mjs.map +0 -1
  158. package/fesm2022/radix-ng-primitives-visually-hidden.mjs +0 -49
  159. package/fesm2022/radix-ng-primitives-visually-hidden.mjs.map +0 -1
  160. package/label/src/label.directive.d.ts +0 -19
  161. package/overlay/README.md +0 -1
  162. package/overlay/index.d.ts +0 -4
  163. package/overlay/src/overlay-arrow.directive.d.ts +0 -29
  164. package/overlay/src/overlay-arrow.token.d.ts +0 -3
  165. package/overlay/src/overlay-trigger.directive.d.ts +0 -163
  166. package/overlay/src/overlay-trigger.token.d.ts +0 -7
  167. package/overlay/src/overlay.directive.d.ts +0 -29
  168. package/overlay/src/overlay.token.d.ts +0 -3
  169. package/progress/src/progress.directive.d.ts +0 -26
  170. package/progress/src/progress.token.d.ts +0 -4
  171. package/radio/src/radio-group.token.d.ts +0 -4
  172. package/radio/src/radio-item.token.d.ts +0 -4
  173. package/roving-focus/src/roving-focus-group.token.d.ts +0 -7
  174. package/roving-focus/src/roving-focus-item.token.d.ts +0 -4
  175. package/switch/src/switch.directive.d.ts +0 -73
  176. package/switch/src/switch.token.d.ts +0 -4
  177. package/toggle/src/toggle.directive.d.ts +0 -30
  178. package/visually-hidden/README.md +0 -3
  179. package/visually-hidden/index.d.ts +0 -1
  180. package/visually-hidden/src/visually-hidden.directive.d.ts +0 -11
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-progress.mjs","sources":["../../../packages/primitives/progress/src/progress.token.ts","../../../packages/primitives/progress/src/progress-indicator.directive.ts","../../../packages/primitives/progress/src/progress.directive.ts","../../../packages/primitives/progress/radix-ng-primitives-progress.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\n\nimport type { RdxProgressDirective } from './progress.directive';\n\nexport const RdxProgressToken = new InjectionToken<RdxProgressDirective>('RdxProgressDirective');\n\nexport function injectProgress(): RdxProgressDirective {\n return inject(RdxProgressToken);\n}\n","import { Directive } from '@angular/core';\n\nimport { injectProgress } from './progress.token';\n\n@Directive({\n selector: '[rdxProgressIndicator]',\n standalone: true,\n host: {\n '[attr.data-state]': 'progress.state',\n '[attr.data-value]': 'progress.value',\n '[attr.data-max]': 'progress.max'\n }\n})\nexport class RdxProgressIndicatorDirective {\n protected readonly progress = injectProgress();\n}\n","import { Directive, Input, numberAttribute } from '@angular/core';\n\nimport { RdxProgressToken } from './progress.token';\n\n@Directive({\n selector: '[rdxProgress]',\n standalone: true,\n providers: [{ provide: RdxProgressToken, useExisting: RdxProgressDirective }],\n host: {\n role: 'progressbar',\n '[attr.aria-valuemax]': 'max',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuenow]': 'value',\n '[attr.aria-valuetext]': 'valueLabel(value, max)',\n '[attr.data-state]': 'state',\n '[attr.data-value]': 'value',\n '[attr.data-max]': 'max'\n }\n})\nexport class RdxProgressDirective {\n /**\n * Define the progress value.\n */\n @Input({ alias: 'rdxProgressValue', transform: numberAttribute }) value = 0;\n\n /**\n * Define the progress max value.\n * @default 100\n */\n @Input({ alias: 'rdxProgressMax', transform: numberAttribute }) max = 100;\n\n /**\n * Define a function that returns the progress value label.\n */\n @Input('rdxProgressValueLabel') valueLabel: (value: number, max: number) => string = (\n value,\n max\n ) => `${Math.round((value / max) * 100)}%`;\n\n /**\n * Get the state of the progress bar.\n * @returns 'indeterminate' | 'loading' | 'complete'\n * @internal\n */\n get state(): 'indeterminate' | 'loading' | 'complete' {\n return this.value == null\n ? 'indeterminate'\n : this.value === this.max\n ? 'complete'\n : 'loading';\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAIO,MAAM,gBAAgB,GAAG,IAAI,cAAc,CAAuB,sBAAsB,CAAC,CAAC;SAEjF,cAAc,GAAA;AAC1B,IAAA,OAAO,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACpC;;MCKa,6BAA6B,CAAA;AAT1C,IAAA,WAAA,GAAA;QAU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KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA,EAAE,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;gBAMA,GAAG,EAAA,CAAA;sBAAlE,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;gBAK9B,UAAU,EAAA,CAAA;sBAAzC,KAAK;uBAAC,uBAAuB,CAAA;;;AClClC;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-progress.mjs","sources":["../../../packages/primitives/progress/src/progress-root.directive.ts","../../../packages/primitives/progress/src/progress-indicator.directive.ts","../../../packages/primitives/progress/radix-ng-primitives-progress.ts"],"sourcesContent":["import { Directive, inject, InjectionToken, Input, numberAttribute } from '@angular/core';\n\nlet idIterator = 0;\n\nconst MIN_PERCENT = 0;\nconst DEFAULT_MAX = 100;\n\nconst RdxProgressToken = new InjectionToken<RdxProgressRootDirective>('RdxProgressDirective');\n\nexport function injectProgress(): RdxProgressRootDirective {\n return inject(RdxProgressToken);\n}\n\nexport type ProgressState = 'indeterminate' | 'loading' | 'complete';\n\nexport interface ProgressProps {\n value?: number | null | undefined;\n max?: number;\n getValueLabel?: string;\n}\n\n@Directive({\n selector: 'div[ProgressRoot]',\n exportAs: 'ProgressRoot',\n standalone: true,\n providers: [{ provide: RdxProgressToken, useExisting: RdxProgressRootDirective }],\n host: {\n role: 'progressbar',\n '[attr.id]': 'id',\n '[attr.aria-valuemax]': 'max',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuenow]': 'value',\n '[attr.aria-valuetext]': 'valueLabel(value, max)',\n '[attr.data-state]': 'state',\n '[attr.data-value]': 'value',\n '[attr.data-max]': 'max',\n // set tab index to -1 so screen readers will read the aria-label\n // Note: there is a known issue with JAWS that does not read progressbar aria labels on FireFox\n tabindex: '-1'\n }\n})\nexport class RdxProgressRootDirective implements ProgressProps {\n @Input() id = `rdx-progress-bar-${idIterator++}`;\n\n @Input({ alias: 'rdxValue', transform: numberAttribute }) value = MIN_PERCENT;\n\n /**\n * @default 100\n */\n @Input({ alias: 'rdxMax', transform: numberAttribute }) max = DEFAULT_MAX;\n\n @Input('rdxValueLabel') valueLabel: (value: number, max: number) => string = (value, max) =>\n this.defaultGetValueLabel(value, max);\n\n /**\n * Get the state of the progress bar.\n * @returns 'indeterminate' | 'loading' | 'complete'\n * @internal\n */\n get state(): ProgressState {\n return this.getProgressState(this.value, this.max);\n }\n\n private getProgressState(value: number | undefined | null, maxValue: number): ProgressState {\n return value == null ? 'indeterminate' : value === maxValue ? 'complete' : 'loading';\n }\n\n private defaultGetValueLabel(value: number, max: number) {\n return `${Math.round((value / max) * 100)}%`;\n }\n}\n","import { Directive } from '@angular/core';\n\nimport { injectProgress } from './progress-root.directive';\n\n@Directive({\n selector: 'div[ProgressIndicator]',\n exportAs: 'ProgressIndicator',\n standalone: true,\n host: {\n '[attr.data-state]': '_progress.state',\n '[attr.data-value]': '_progress.value',\n '[attr.data-max]': '_progress.max'\n }\n})\nexport class RdxProgressIndicatorDirective {\n readonly _progress = injectProgress();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,gBAAgB,GAAG,IAAI,cAAc,CAA2B,sBAAsB,CAAC,CAAC;SAE9E,cAAc,GAAA;AAC1B,IAAA,OAAO,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACpC,CAAC;MA8BY,wBAAwB,CAAA;AApBrC,IAAA,WAAA,GAAA;AAqBa,QAAA,IAAA,CAAA,EAAE,GAAG,CAAA,iBAAA,EAAoB,UAAU,EAAE,EAAE,CAAC;QAES,IAAK,CAAA,KAAA,GAAG,WAAW,CAAC;AAE9E;;AAEG;QACqD,IAAG,CAAA,G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AA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;mGAA7B,6BAA6B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,wBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,eAAA,EAAA,eAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAA7B,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAVzC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,wBAAwB;AAClC,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,iBAAiB;AACtC,wBAAA,mBAAmB,EAAE,iBAAiB;AACtC,wBAAA,iBAAiB,EAAE,eAAe;AACrC,qBAAA;AACJ,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, EventEmitter, booleanAttribute, Directive, 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
  import * as i1 from '@radix-ng/primitives/roving-focus';
5
5
  import { RdxRovingFocusGroupDirective, RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';
@@ -8,22 +8,22 @@ const RdxRadioGroupToken = new InjectionToken('RdxRadioGroupToken');
8
8
  function injectRadioGroup() {
9
9
  return inject(RdxRadioGroupToken);
10
10
  }
11
-
12
11
  class RdxRadioGroupDirective {
13
- constructor() {
14
- /**
15
- * Whether the radio group is disabled.
16
- */
12
+ constructor(changeDetector) {
13
+ this.changeDetector = changeDetector;
17
14
  this.disabled = false;
18
15
  /**
19
- * The orientation of the radio group.
20
- * @default 'horizontal'
16
+ * The orientation of the radio group only vertical.
17
+ * Horizontal radio buttons can sometimes be challenging to scan and localize.
18
+ * The horizontal arrangement of radio buttons may also lead to difficulties in determining which
19
+ * label corresponds to which button: whether the label is above or below the button.
20
+ * @default 'vertical'
21
21
  */
22
- this.orientation = 'horizontal';
22
+ this._orientation = 'vertical';
23
23
  /**
24
24
  * Event emitted when the value of the radio group changes.
25
25
  */
26
- this.valueChange = new EventEmitter();
26
+ this.onValueChange = new EventEmitter();
27
27
  }
28
28
  /**
29
29
  * Select a radio item.
@@ -31,7 +31,7 @@ class RdxRadioGroupDirective {
31
31
  */
32
32
  select(value) {
33
33
  this.value = value;
34
- this.valueChange.emit(value);
34
+ this.onValueChange.emit(value);
35
35
  this.onChange?.(value);
36
36
  }
37
37
  /**
@@ -41,6 +41,7 @@ class RdxRadioGroupDirective {
41
41
  */
42
42
  writeValue(value) {
43
43
  this.value = value;
44
+ this.changeDetector.markForCheck();
44
45
  }
45
46
  /**
46
47
  * Register a callback function to call when the value of the radio group changes.
@@ -60,24 +61,25 @@ class RdxRadioGroupDirective {
60
61
  */
61
62
  setDisabledState(isDisabled) {
62
63
  this.disabled = isDisabled;
64
+ this.changeDetector.markForCheck();
63
65
  }
64
66
  /**
65
- * When focus leaves the radio group, mark it as touched.
66
- * @internal
67
+ * When focus leaves the radio group.
67
68
  */
68
- onFocusout() {
69
+ _onFocusout() {
69
70
  this.onTouched?.();
70
71
  }
71
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxRadioGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
72
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.3", type: RdxRadioGroupDirective, isStandalone: true, selector: "[rdxRadioGroup]", inputs: { value: ["rdxRadioGroupValue", "value"], disabled: ["rdxRadioGroupDisabled", "disabled", booleanAttribute], orientation: ["rdxRadioGroupOrientation", "orientation"] }, outputs: { valueChange: "rdxRadioGroupValueChange" }, host: { attributes: { "role": "radiogroup" }, listeners: { "focusout": "onFocusout()" }, properties: { "attr.aria-orientation": "orientation", "attr.data-disabled": "disabled ? \"\" : null" } }, providers: [
72
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxRadioGroupDirective, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
73
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.11", type: RdxRadioGroupDirective, isStandalone: true, selector: "div[RadioRoot]", inputs: { value: ["rdxValue", "value"], disabled: ["rdxDisabled", "disabled", booleanAttribute] }, outputs: { onValueChange: "rdxOnValueChange" }, host: { attributes: { "role": "radiogroup" }, listeners: { "focusout": "_onFocusout()" }, properties: { "attr.aria-orientation": "_orientation", "attr.data-disabled": "disabled ? \"\" : null" } }, providers: [
73
74
  { provide: RdxRadioGroupToken, useExisting: RdxRadioGroupDirective },
74
75
  { provide: NG_VALUE_ACCESSOR, useExisting: RdxRadioGroupDirective, multi: true }
75
- ], hostDirectives: [{ directive: i1.RdxRovingFocusGroupDirective }], ngImport: i0 }); }
76
+ ], exportAs: ["RadioRoot"], hostDirectives: [{ directive: i1.RdxRovingFocusGroupDirective }], ngImport: i0 }); }
76
77
  }
77
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxRadioGroupDirective, decorators: [{
78
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxRadioGroupDirective, decorators: [{
78
79
  type: Directive,
79
80
  args: [{
80
- selector: '[rdxRadioGroup]',
81
+ selector: 'div[RadioRoot]',
82
+ exportAs: 'RadioRoot',
81
83
  standalone: true,
82
84
  providers: [
83
85
  { provide: RdxRadioGroupToken, useExisting: RdxRadioGroupDirective },
@@ -86,133 +88,101 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
86
88
  hostDirectives: [RdxRovingFocusGroupDirective],
87
89
  host: {
88
90
  role: 'radiogroup',
89
- '[attr.aria-orientation]': 'orientation',
90
- '[attr.data-disabled]': 'disabled ? "" : null'
91
+ '[attr.aria-orientation]': '_orientation',
92
+ '[attr.data-disabled]': 'disabled ? "" : null',
93
+ '(focusout)': '_onFocusout()'
91
94
  }
92
95
  }]
93
- }], propDecorators: { value: [{
96
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { value: [{
94
97
  type: Input,
95
- args: ['rdxRadioGroupValue']
98
+ args: ['rdxValue']
96
99
  }], disabled: [{
97
100
  type: Input,
98
- args: [{
99
- alias: 'rdxRadioGroupDisabled',
100
- transform: booleanAttribute
101
- }]
102
- }], orientation: [{
103
- type: Input,
104
- args: ['rdxRadioGroupOrientation']
105
- }], valueChange: [{
101
+ args: [{ alias: 'rdxDisabled', transform: booleanAttribute }]
102
+ }], onValueChange: [{
106
103
  type: Output,
107
- args: ['rdxRadioGroupValueChange']
108
- }], onFocusout: [{
109
- type: HostListener,
110
- args: ['focusout']
104
+ args: ['rdxOnValueChange']
111
105
  }] } });
112
106
 
113
107
  const RdxRadioItemToken = new InjectionToken('RadioItemToken');
114
108
  function injectRadioItem() {
115
109
  return inject(RdxRadioItemToken);
116
110
  }
117
-
118
- class RdxRadioIndicatorDirective {
119
- constructor() {
120
- /**
121
- * Access the radio group.
122
- */
123
- this.radioGroup = injectRadioGroup();
124
- /**
125
- * Access the radio group item.
126
- */
127
- this.radioItem = injectRadioItem();
128
- }
129
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxRadioIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
130
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.3", type: RdxRadioIndicatorDirective, isStandalone: true, selector: "[rdxRadioIndicator]", host: { properties: { "attr.data-state": "radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"", "attr.data-disabled": "radioItem.disabled ? \"\" : null" } }, ngImport: i0 }); }
131
- }
132
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxRadioIndicatorDirective, decorators: [{
133
- type: Directive,
134
- args: [{
135
- selector: '[rdxRadioIndicator]',
136
- standalone: true,
137
- host: {
138
- '[attr.data-state]': 'radioGroup.value === this.radioItem.value ? "checked" : "unchecked"',
139
- '[attr.data-disabled]': 'radioItem.disabled ? "" : null'
140
- }
141
- }]
142
- }] });
143
-
111
+ // Increasing integer for generating unique ids for radio components.
112
+ let nextUniqueId = 0;
144
113
  class RdxRadioItemDirective {
145
114
  constructor() {
146
- /**
147
- * Access the radio group.
148
- */
149
115
  this.radioGroup = injectRadioGroup();
150
- /**
151
- * Whether the radio item is disabled.
152
- * @default false
153
- */
116
+ this.id = `rdx-radio-${++nextUniqueId}`;
154
117
  this.disabled = false;
155
118
  }
156
- /**
157
- * Handle keydown events.
158
- * @param event The keydown event.
159
- * @internal
160
- */
161
- onKeydown(event) {
119
+ _onKeydown(event) {
162
120
  // According to WAI ARIA, radio groups don't activate items on enter keypress
163
121
  if (event.key === 'Enter') {
164
122
  event.preventDefault();
165
123
  }
166
124
  }
167
- /**
168
- * When the item receives focus, select it.
169
- * @internal
170
- */
171
- onFocus() {
125
+ _onFocus() {
172
126
  this.radioGroup.select(this.value);
173
127
  }
174
- /**
175
- * When the item receives a click, select it.
176
- * @internal
177
- */
178
- onClick() {
128
+ _onClick() {
129
+ console.log('click');
179
130
  this.radioGroup.select(this.value);
180
131
  }
181
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxRadioItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
182
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.3", type: RdxRadioItemDirective, isStandalone: true, selector: "button[rdxRadioItem]", inputs: { value: "value", disabled: ["disabled", "disabled", booleanAttribute] }, host: { attributes: { "type": "button", "role": "radio" }, listeners: { "keydown": "onKeydown($event)", "focus": "onFocus()", "click": "onClick()" }, properties: { "attr.aria-checked": "radioGroup.value === value ? \"true\" : \"false\"", "attr.data-disabled": "disabled ? \"\" : null", "attr.data-state": "radioGroup.value === value ? \"checked\" : \"unchecked\"" } }, providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }], hostDirectives: [{ directive: i1.RdxRovingFocusItemDirective }], ngImport: i0 }); }
132
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxRadioItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
133
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.11", type: RdxRadioItemDirective, isStandalone: true, selector: "[RadioItem]", inputs: { id: "id", value: "value", disabled: ["disabled", "disabled", booleanAttribute] }, host: { attributes: { "type": "button", "role": "radio" }, listeners: { "focus": "_onFocus()", "click": "_onClick()", "keydown": "_onKeydown($event)" }, properties: { "attr.id": "id", "attr.aria-checked": "radioGroup.value === value ? \"true\" : \"false\"", "attr.data-disabled": "disabled ? \"\" : null", "attr.data-state": "radioGroup.value === value ? \"checked\" : \"unchecked\"" } }, providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }], exportAs: ["RadioItem"], hostDirectives: [{ directive: i1.RdxRovingFocusItemDirective }], ngImport: i0 }); }
183
134
  }
184
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxRadioItemDirective, decorators: [{
135
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxRadioItemDirective, decorators: [{
185
136
  type: Directive,
186
137
  args: [{
187
- selector: 'button[rdxRadioItem]',
138
+ selector: '[RadioItem]',
139
+ exportAs: 'RadioItem',
188
140
  standalone: true,
189
141
  hostDirectives: [RdxRovingFocusItemDirective],
190
142
  providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }],
191
143
  host: {
192
144
  type: 'button',
193
145
  role: 'radio',
146
+ '[attr.id]': 'id',
194
147
  '[attr.aria-checked]': 'radioGroup.value === value ? "true" : "false"',
195
148
  '[attr.data-disabled]': 'disabled ? "" : null',
196
- '[attr.data-state]': 'radioGroup.value === value ? "checked" : "unchecked"'
149
+ '[attr.data-state]': 'radioGroup.value === value ? "checked" : "unchecked"',
150
+ '(focus)': '_onFocus()',
151
+ '(click)': '_onClick()',
152
+ '(keydown)': '_onKeydown($event)'
197
153
  }
198
154
  }]
199
- }], propDecorators: { value: [{
155
+ }], propDecorators: { id: [{
156
+ type: Input
157
+ }], value: [{
200
158
  type: Input,
201
159
  args: [{ required: true }]
202
160
  }], disabled: [{
203
161
  type: Input,
204
162
  args: [{ transform: booleanAttribute }]
205
- }], onKeydown: [{
206
- type: HostListener,
207
- args: ['keydown', ['$event']]
208
- }], onFocus: [{
209
- type: HostListener,
210
- args: ['focus']
211
- }], onClick: [{
212
- type: HostListener,
213
- args: ['click']
214
163
  }] } });
215
164
 
165
+ class RdxRadioIndicatorDirective {
166
+ constructor() {
167
+ this.radioGroup = injectRadioGroup();
168
+ this.radioItem = injectRadioItem();
169
+ }
170
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxRadioIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
171
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.11", type: RdxRadioIndicatorDirective, isStandalone: true, selector: "[RadioIndicator]", host: { properties: { "attr.data-state": "radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"", "attr.data-disabled": "radioItem.disabled ? \"\" : null" } }, exportAs: ["RadioIndicator"], ngImport: i0 }); }
172
+ }
173
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdxRadioIndicatorDirective, decorators: [{
174
+ type: Directive,
175
+ args: [{
176
+ selector: '[RadioIndicator]',
177
+ exportAs: 'RadioIndicator',
178
+ standalone: true,
179
+ host: {
180
+ '[attr.data-state]': 'radioGroup.value === this.radioItem.value ? "checked" : "unchecked"',
181
+ '[attr.data-disabled]': 'radioItem.disabled ? "" : null'
182
+ }
183
+ }]
184
+ }] });
185
+
216
186
  /**
217
187
  * Generated bundle index. Do not edit.
218
188
  */
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-group.token.ts","../../../packages/primitives/radio/src/radio-group.directive.ts","../../../packages/primitives/radio/src/radio-item.token.ts","../../../packages/primitives/radio/src/radio-indicator.directive.ts","../../../packages/primitives/radio/src/radio-item.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\n\nimport type { RdxRadioGroupDirective } from './radio-group.directive';\n\nexport const RdxRadioGroupToken = new InjectionToken<RdxRadioGroupDirective>('RdxRadioGroupToken');\n\nexport function injectRadioGroup(): RdxRadioGroupDirective {\n return inject(RdxRadioGroupToken);\n}\n","import {\n booleanAttribute,\n Directive,\n EventEmitter,\n HostListener,\n Input,\n Output\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\n\nimport { RdxRadioGroupToken } from './radio-group.token';\n\n@Directive({\n selector: '[rdxRadioGroup]',\n standalone: true,\n providers: [\n { provide: RdxRadioGroupToken, useExisting: RdxRadioGroupDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RdxRadioGroupDirective, multi: true }\n ],\n hostDirectives: [RdxRovingFocusGroupDirective],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': 'orientation',\n '[attr.data-disabled]': 'disabled ? \"\" : null'\n }\n})\nexport class RdxRadioGroupDirective implements ControlValueAccessor {\n /**\n * The value of the radio group.\n */\n @Input('rdxRadioGroupValue') value?: string;\n\n /**\n * Whether the radio group is disabled.\n */\n @Input({\n alias: 'rdxRadioGroupDisabled',\n transform: booleanAttribute\n })\n disabled = false;\n\n /**\n * The orientation of the radio group.\n * @default 'horizontal'\n */\n @Input('rdxRadioGroupOrientation') orientation: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Event emitted when the value of the radio group changes.\n */\n @Output('rdxRadioGroupValueChange') readonly valueChange = new EventEmitter<string>();\n\n /**\n * The callback function to call when the value of the radio group changes.\n * @internal\n */\n private onChange?: (value: string) => void;\n\n /**\n * The callback function to call when the radio group is touched.\n * @internal\n */\n private onTouched?: () => void;\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n */\n select(value: string): void {\n this.value = value;\n this.valueChange.emit(value);\n this.onChange?.(value);\n }\n\n /**\n * Update the value of the radio group.\n * @param value The new value of the radio group.\n * @internal\n */\n writeValue(value: string): void {\n this.value = value;\n }\n\n /**\n * Register a callback function to call when the value of the radio group changes.\n * @param fn The callback function to call when the value of the radio group changes.\n * @internal\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Set the disabled state of the radio group.\n * @param isDisabled Whether the radio group is disabled.\n * @internal\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n /**\n * When focus leaves the radio group, mark it as touched.\n * @internal\n */\n @HostListener('focusout')\n protected onFocusout(): void {\n this.onTouched?.();\n }\n}\n","import { inject, InjectionToken } from '@angular/core';\n\nimport type { RdxRadioItemDirective } from './radio-item.directive';\n\nexport const RdxRadioItemToken = new InjectionToken<RdxRadioItemDirective>('RadioItemToken');\n\nexport function injectRadioItem(): RdxRadioItemDirective {\n return inject(RdxRadioItemToken);\n}\n","import { Directive } from '@angular/core';\n\nimport { injectRadioGroup } from './radio-group.token';\nimport { injectRadioItem } from './radio-item.token';\n\n@Directive({\n selector: '[rdxRadioIndicator]',\n standalone: true,\n host: {\n '[attr.data-state]': 'radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'radioItem.disabled ? \"\" : null'\n }\n})\nexport class RdxRadioIndicatorDirective {\n /**\n * Access the radio group.\n */\n protected readonly radioGroup = injectRadioGroup();\n\n /**\n * Access the radio group item.\n */\n protected readonly radioItem = injectRadioItem();\n}\n","import { booleanAttribute, Directive, HostListener, Input } from '@angular/core';\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\n\nimport { injectRadioGroup } from './radio-group.token';\nimport { RdxRadioItemToken } from './radio-item.token';\n\n@Directive({\n selector: 'button[rdxRadioItem]',\n standalone: true,\n hostDirectives: [RdxRovingFocusItemDirective],\n providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }],\n host: {\n type: 'button',\n role: 'radio',\n '[attr.aria-checked]': 'radioGroup.value === value ? \"true\" : \"false\"',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.data-state]': 'radioGroup.value === value ? \"checked\" : \"unchecked\"'\n }\n})\nexport class RdxRadioItemDirective {\n /**\n * Access the radio group.\n */\n protected readonly radioGroup = injectRadioGroup();\n\n /**\n * The value of the radio item.\n */\n @Input({ required: true }) value!: string;\n\n /**\n * Whether the radio item is disabled.\n * @default false\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n /**\n * Handle keydown events.\n * @param event The keydown event.\n * @internal\n */\n @HostListener('keydown', ['$event'])\n protected onKeydown(event: KeyboardEvent): void {\n // According to WAI ARIA, radio groups don't activate items on enter keypress\n if (event.key === 'Enter') {\n event.preventDefault();\n }\n }\n\n /**\n * When the item receives focus, select it.\n * @internal\n */\n @HostListener('focus')\n protected onFocus(): void {\n this.radioGroup.select(this.value);\n }\n\n /**\n * When the item receives a click, select it.\n * @internal\n */\n @HostListener('click')\n protected onClick(): void {\n this.radioGroup.select(this.value);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAIa,kBAAkB,GAAG,IAAI,cAAc,CAAyB,oBAAoB,EAAE;SAEnF,gBAAgB,GAAA;AAC5B,IAAA,OAAO,MAAM,CAAC,kBAAkB,CAAC,CAAC;AACtC;;MCqBa,sBAAsB,CAAA;AAdnC,IAAA,WAAA,GAAA;AAoBI;;AAEG;QAKH,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAEjB;;;AAGG;QACgC,IAAW,CAAA,WAAA,GAA8B,YAAY,CAAC;AAEzF;;AAEG;AAC0C,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,YAAY,EAAU,CAAC;AA+DzF,KAAA;AAjDG;;;AAGG;AACH,IAAA,MAAM,CAAC,KAAa,EAAA;AAChB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7B,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC;KAC1B;AAED;;;;AAIG;AACH,IAAA,UAAU,CAAC,KAAa,EAAA;AACpB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;KACtB;AAED;;;;AAIG;AACH,IAAA,gBAAgB,CAAC,EAA2B,EAAA;AACxC,QAAA,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;KACtB;AAED,IAAA,iBAAiB,CAAC,EAAc,EAAA;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;KACvB;AAED;;;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mB,EAAE,sDAAsD;AAC9E,qBAAA;AACJ,iBAAA,CAAA;8BAU8B,KAAK,EAAA,CAAA;sBAA/B,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;gBAMe,QAAQ,EAAA,CAAA;sBAA/C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;gBAQ5B,SAAS,EAAA,CAAA;sBADlB,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAA;gBAazB,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO,CAAA;gBAUX,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO,CAAA;;;AChEzB;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-root.directive.ts","../../../packages/primitives/radio/src/radio-item.directive.ts","../../../packages/primitives/radio/src/radio-indicator.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import {\n booleanAttribute,\n ChangeDetectorRef,\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\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\n\nexport const RdxRadioGroupToken = new InjectionToken<RdxRadioGroupDirective>('RdxRadioGroupToken');\n\nexport function injectRadioGroup(): RdxRadioGroupDirective {\n return inject(RdxRadioGroupToken);\n}\n\ninterface RadioGroupProps {\n name?: string;\n disabled?: boolean;\n // TODO: dir?: string;\n // TODO: loop?: string;\n defaultValue?: string;\n value?: string;\n onValueChange?: EventEmitter<string>;\n}\n\n@Directive({\n selector: 'div[RadioRoot]',\n exportAs: 'RadioRoot',\n standalone: true,\n providers: [\n { provide: RdxRadioGroupToken, useExisting: RdxRadioGroupDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RdxRadioGroupDirective, multi: true }\n ],\n hostDirectives: [RdxRovingFocusGroupDirective],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': '_orientation',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n\n '(focusout)': '_onFocusout()'\n }\n})\nexport class RdxRadioGroupDirective implements RadioGroupProps, ControlValueAccessor {\n @Input('rdxValue') value?: string;\n\n @Input({ alias: 'rdxDisabled', transform: booleanAttribute }) disabled = false;\n\n /**\n * The orientation of the radio group only vertical.\n * Horizontal radio buttons can sometimes be challenging to scan and localize.\n * The horizontal arrangement of radio buttons may also lead to difficulties in determining which\n * label corresponds to which button: whether the label is above or below the button.\n * @default 'vertical'\n */\n readonly _orientation = 'vertical';\n\n /**\n * Event emitted when the value of the radio group changes.\n */\n @Output('rdxOnValueChange') readonly onValueChange = new EventEmitter<string>();\n\n /**\n * The callback function to call when the value of the radio group changes.\n * @internal\n */\n private onChange?: (value: string) => void;\n\n /**\n * The callback function to call when the radio group is touched.\n * @internal\n */\n private onTouched?: () => void;\n\n constructor(private readonly changeDetector: ChangeDetectorRef) {}\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n */\n select(value: string): void {\n this.value = value;\n this.onValueChange.emit(value);\n this.onChange?.(value);\n }\n\n /**\n * Update the value of the radio group.\n * @param value The new value of the radio group.\n * @internal\n */\n writeValue(value: string): void {\n this.value = value;\n this.changeDetector.markForCheck();\n }\n\n /**\n * Register a callback function to call when the value of the radio group changes.\n * @param fn The callback function to call when the value of the radio group changes.\n * @internal\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Set the disabled state of the radio group.\n * @param isDisabled Whether the radio group is disabled.\n * @internal\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.changeDetector.markForCheck();\n }\n\n /**\n * When focus leaves the radio group.\n */\n _onFocusout(): void {\n this.onTouched?.();\n }\n}\n","import { booleanAttribute, Directive, inject, InjectionToken, Input } from '@angular/core';\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\n\nimport { injectRadioGroup } from './radio-root.directive';\n\nexport const RdxRadioItemToken = new InjectionToken<RdxRadioItemDirective>('RadioItemToken');\n\nexport function injectRadioItem(): RdxRadioItemDirective {\n return inject(RdxRadioItemToken);\n}\n\n// Increasing integer for generating unique ids for radio components.\nlet nextUniqueId = 0;\n\n@Directive({\n selector: '[RadioItem]',\n exportAs: 'RadioItem',\n standalone: true,\n hostDirectives: [RdxRovingFocusItemDirective],\n providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }],\n host: {\n type: 'button',\n role: 'radio',\n '[attr.id]': 'id',\n '[attr.aria-checked]': 'radioGroup.value === value ? \"true\" : \"false\"',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.data-state]': 'radioGroup.value === value ? \"checked\" : \"unchecked\"',\n\n '(focus)': '_onFocus()',\n '(click)': '_onClick()',\n '(keydown)': '_onKeydown($event)'\n }\n})\nexport class RdxRadioItemDirective {\n protected readonly radioGroup = injectRadioGroup();\n\n @Input() id = `rdx-radio-${++nextUniqueId}`;\n\n @Input({ required: true }) value!: string;\n\n @Input({ transform: booleanAttribute }) disabled = false;\n\n _onKeydown(event: KeyboardEvent): void {\n // According to WAI ARIA, radio groups don't activate items on enter keypress\n if (event.key === 'Enter') {\n event.preventDefault();\n }\n }\n\n _onFocus(): void {\n this.radioGroup.select(this.value);\n }\n\n _onClick(): void {\n console.log('click');\n this.radioGroup.select(this.value);\n }\n}\n","import { Directive } from '@angular/core';\n\nimport { injectRadioItem } from './radio-item.directive';\nimport { injectRadioGroup } from './radio-root.directive';\n\n@Directive({\n selector: '[RadioIndicator]',\n exportAs: 'RadioIndicator',\n standalone: true,\n host: {\n '[attr.data-state]': 'radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'radioItem.disabled ? \"\" : null'\n }\n})\nexport class RdxRadioIndicatorDirective {\n protected readonly radioGroup = injectRadioGroup();\n\n protected readonly radioItem = injectRadioItem();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAea,kBAAkB,GAAG,IAAI,cAAc,CAAyB,oBAAoB,EAAE;SAEnF,gBAAgB,GAAA;AAC5B,IAAA,OAAO,MAAM,CAAC,kBAAkB,CAAC,CAAC;AACtC,CAAC;MA6BY,sBAAsB,CAAA;AA+B/B,IAAA,WAAA,CAA6B,cAAiC,EAAA;QAAjC,IAAc,CAAA,cAAA,GAAd,cAAc,CAAmB;QA5BA,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAE/E;;;;;;AAMG;QACM,IAAY,CAAA,YAAA,GAAG,UAAU,CAAC;AAEnC;;AAEG;AACkC,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,YAAY,EAAU,CAAC;KAcd;AAElE;;;AAGG;AACH,IAAA,MAAM,CAAC,KAAa,EAAA;AAChB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/B,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC;KAC1B;AAED;;;;AAIG;AACH,IAAA,UAAU,CAAC,KAAa,EAAA;AACpB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;KACtC;AAED;;;;AAIG;AACH,IAAA,gBAAgB,CAAC,EAA2B,EAAA;AACxC,QAAA,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;KACtB;AAED,IAAA,iBAAiB,CAAC,EAAc,EAAA;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;KACvB;AAED;;;;AAIG;AACH,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,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;mGAA1B,0BAA0B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,yEAAA,EAAA,oBAAA,EAAA,kCAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBATtC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,qEAAqE;AAC1F,wBAAA,sBAAsB,EAAE,gCAAgC;AAC3D,qBAAA;AACJ,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
@@ -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: ["rdxRovingFocusGroupOrientation", "orientation"], wrap: ["rdxRovingFocusGroupWrap", "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]',
@@ -126,7 +112,6 @@ const RdxRovingFocusItemToken = new InjectionToken('RdxRovingFocusItemToken');
126
112
  function injectRovingFocusItem() {
127
113
  return inject(RdxRovingFocusItemToken);
128
114
  }
129
-
130
115
  class RdxRovingFocusItemDirective {
131
116
  constructor() {
132
117
  /**
@@ -154,49 +139,47 @@ class RdxRovingFocusItemDirective {
154
139
  */
155
140
  this.disabled = false;
156
141
  }
157
- /**
158
- * Derive the tabindex of the roving focus item.
159
- * @internal
160
- */
161
- get tabindex() {
162
- return this.group.keyManager.activeItem === this ? 0 : -1;
163
- }
164
142
  ngOnInit() {
165
- // register the roving focus item with the group
166
143
  this.group.register(this);
167
- // listen for changes to the active item and run change detection
168
144
  this.group.keyManager.change
169
145
  .pipe(takeUntilDestroyed(this.destroyRef))
170
146
  .subscribe(() => this.changeDetectorRef.markForCheck());
171
147
  }
172
148
  ngOnDestroy() {
173
- // unregister the roving focus item with the group
174
149
  this.group.unregister(this);
175
150
  }
176
151
  /**
177
152
  * Handle key events on the roving focus item.
178
153
  * @param event The key event.
179
- * @internal
180
154
  */
181
- onKeydown(event) {
155
+ _onKeydown(event) {
182
156
  this.group.onKeydown(event);
183
157
  }
158
+ /**
159
+ * Derive the tabindex of the roving focus item.
160
+ */
161
+ _tabindex() {
162
+ return this.group.keyManager.activeItem === this ? 0 : -1;
163
+ }
184
164
  /**
185
165
  * Focus the roving focus item.
186
- * @param origin The origin of the focus request.
187
166
  * @internal
188
167
  */
189
168
  focus() {
190
169
  this.elementRef?.nativeElement.focus();
191
170
  }
192
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RdxRovingFocusItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
193
- 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 }); }
194
173
  }
195
- 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: [{
196
175
  type: Directive,
197
176
  args: [{
198
177
  selector: '[rdxRovingFocusItem]',
199
178
  standalone: true,
179
+ host: {
180
+ '(onKeydown)': '_onKeydown($event)',
181
+ '[attr.tabindex]': '_tabindex()'
182
+ },
200
183
  providers: [{ provide: RdxRovingFocusItemToken, useExisting: RdxRovingFocusItemDirective }]
201
184
  }]
202
185
  }], propDecorators: { order: [{
@@ -205,17 +188,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
205
188
  }], disabled: [{
206
189
  type: Input,
207
190
  args: [{ transform: booleanAttribute }]
208
- }], tabindex: [{
209
- type: HostBinding,
210
- args: ['attr.tabindex']
211
- }], onKeydown: [{
212
- type: HostListener,
213
- args: ['keydown', ['$event']]
214
191
  }] } });
215
192
 
216
193
  /**
217
194
  * Generated bundle index. Do not edit.
218
195
  */
219
196
 
220
- export { RdxRovingFocusGroupDirective, RdxRovingFocusGroupToken, RdxRovingFocusItemDirective, RdxRovingFocusItemToken, injectRovingFocusGroup, injectRovingFocusItem };
197
+ export { RdxRovingFocusGroupDirective, RdxRovingFocusItemDirective, injectRovingFocusGroup, injectRovingFocusItem };
221
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({ alias: 'rdxRovingFocusGroupOrientation' }) orientation: 'horizontal' | 'vertical' =\n '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 // 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;;;AAGG;AACc,QAAA,IAAA,CAAA,KAAK,GAAG,IAAI,SAAS,EAA+B,CAAC;AAEtE;;;AAGG;QACM,IAAU,CAAA,UAAA,GAAG,IAAI,eAAe,CAA8B,IAAI,CAAC,KAAK,CAAC,CAAC;AAEnF;;;AAGG;QACiD,IAAW,CAAA,WAAA,GAC3D,UAAU,CAAC;AAEf;;;AAGG;QACuE,IAAI,CAAA,IAAA,GAAG,IAAI,CAAC;AAmFzF,KAAA;IAjFG,QAAQ,GAAA;QACJ,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEpC,QAAA,IAAI,CAAC,cAAc,CAAC,IAAI,CAA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A,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,UAAA,GAAG,IAAI,eAAe,CAA8B,IAAI,CAAC,KAAK,CAAC,CAAC;AAEnF;;;AAGG;QACiD,IAAW,CAAA,WAAA,GAAgB,UAAU,CAAC;AAE1F;;;AAGG;QACuE,IAAI,CAAA,IAAA,GAAG,IAAI,CAAC;AA6EzF,KAAA;IA3EG,QAAQ,GAAA;QACJ,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEpC,QAAA,IAAI,C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