@radix-ng/primitives 0.18.2 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/avatar/index.d.ts +1 -2
  2. package/avatar/src/avatar-fallback.directive.d.ts +11 -23
  3. package/avatar/src/avatar-image.directive.d.ts +10 -14
  4. package/avatar/src/avatar-root.directive.d.ts +5 -15
  5. package/checkbox/index.d.ts +11 -0
  6. package/checkbox/src/checkbox-button.directive.d.ts +1 -1
  7. package/checkbox/src/checkbox-indicator.directive.d.ts +1 -1
  8. package/checkbox/src/checkbox-input.directive.d.ts +1 -1
  9. package/checkbox/src/checkbox.directive.d.ts +1 -1
  10. package/compodoc/documentation.json +9385 -4858
  11. package/core/index.d.ts +2 -0
  12. package/core/src/control-value-accessor/index.d.ts +75 -0
  13. package/core/src/create-inject-context/assert-injector.d.ts +51 -0
  14. package/core/src/create-inject-context/index.d.ts +68 -0
  15. package/core/src/types.d.ts +23 -0
  16. package/esm2022/avatar/index.mjs +1 -1
  17. package/esm2022/avatar/src/avatar-fallback.directive.mjs +38 -40
  18. package/esm2022/avatar/src/avatar-image.directive.mjs +25 -26
  19. package/esm2022/avatar/src/avatar-root.directive.mjs +13 -25
  20. package/esm2022/checkbox/index.mjs +31 -1
  21. package/esm2022/checkbox/src/checkbox-button.directive.mjs +3 -3
  22. package/esm2022/checkbox/src/checkbox-indicator.directive.mjs +3 -3
  23. package/esm2022/checkbox/src/checkbox-input.directive.mjs +3 -3
  24. package/esm2022/checkbox/src/checkbox.directive.mjs +3 -3
  25. package/esm2022/core/index.mjs +3 -1
  26. package/esm2022/core/src/control-value-accessor/index.mjs +103 -0
  27. package/esm2022/core/src/create-inject-context/assert-injector.mjs +15 -0
  28. package/esm2022/core/src/create-inject-context/index.mjs +116 -0
  29. package/esm2022/core/src/types.mjs +2 -0
  30. package/esm2022/popover/index.mjs +41 -0
  31. package/esm2022/popover/radix-ng-primitives-popover.mjs +5 -0
  32. package/esm2022/popover/src/popover-arrow.directive.mjs +112 -0
  33. package/esm2022/popover/src/popover-arrow.token.mjs +3 -0
  34. package/esm2022/popover/src/popover-close.directive.mjs +37 -0
  35. package/esm2022/popover/src/popover-content.directive.mjs +227 -0
  36. package/esm2022/popover/src/popover-root.directive.mjs +142 -0
  37. package/esm2022/popover/src/popover-root.inject.mjs +7 -0
  38. package/esm2022/popover/src/popover-root.token.mjs +3 -0
  39. package/esm2022/popover/src/popover-trigger.directive.mjs +42 -0
  40. package/esm2022/popover/src/popover.constants.mjs +90 -0
  41. package/esm2022/popover/src/popover.types.mjs +14 -0
  42. package/esm2022/popover/src/popover.utils.mjs +115 -0
  43. package/esm2022/radio/index.mjs +2 -1
  44. package/esm2022/radio/src/radio-item-input.directive.mjs +37 -0
  45. package/esm2022/radio/src/radio-item.directive.mjs +55 -39
  46. package/esm2022/radio/src/radio-root.directive.mjs +30 -120
  47. package/esm2022/radio/src/radio-tokens.mjs +1 -1
  48. package/esm2022/roving-focus/index.mjs +3 -0
  49. package/esm2022/roving-focus/radix-ng-primitives-roving-focus.mjs +5 -0
  50. package/esm2022/roving-focus/src/roving-focus-group.directive.mjs +138 -0
  51. package/esm2022/roving-focus/src/roving-focus-item.directive.mjs +133 -0
  52. package/esm2022/roving-focus/src/utils.mjs +47 -0
  53. package/esm2022/select/src/select-item.directive.mjs +8 -2
  54. package/esm2022/toggle/src/toggle-input.directive.mjs +4 -3
  55. package/fesm2022/radix-ng-primitives-avatar.mjs +70 -85
  56. package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
  57. package/fesm2022/radix-ng-primitives-checkbox.mjs +35 -10
  58. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  59. package/fesm2022/radix-ng-primitives-core.mjs +230 -3
  60. package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
  61. package/fesm2022/radix-ng-primitives-popover.mjs +796 -0
  62. package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -0
  63. package/fesm2022/radix-ng-primitives-radio.mjs +145 -186
  64. package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
  65. package/fesm2022/radix-ng-primitives-roving-focus.mjs +320 -0
  66. package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -0
  67. package/fesm2022/radix-ng-primitives-select.mjs +7 -1
  68. package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
  69. package/fesm2022/radix-ng-primitives-toggle.mjs +3 -2
  70. package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
  71. package/package.json +18 -6
  72. package/popover/README.md +3 -0
  73. package/popover/index.d.ts +17 -0
  74. package/popover/src/popover-arrow.directive.d.ts +37 -0
  75. package/popover/src/popover-arrow.token.d.ts +3 -0
  76. package/popover/src/popover-close.directive.d.ts +15 -0
  77. package/popover/src/popover-content.directive.d.ts +84 -0
  78. package/popover/src/popover-root.directive.d.ts +58 -0
  79. package/popover/src/popover-root.inject.d.ts +2 -0
  80. package/popover/src/popover-root.token.d.ts +3 -0
  81. package/popover/src/popover-trigger.directive.d.ts +18 -0
  82. package/popover/src/popover.constants.d.ts +8 -0
  83. package/popover/src/popover.types.d.ts +34 -0
  84. package/popover/src/popover.utils.d.ts +12 -0
  85. package/radio/index.d.ts +1 -0
  86. package/radio/src/radio-item-input.directive.d.ts +12 -0
  87. package/radio/src/radio-item.directive.d.ts +23 -14
  88. package/radio/src/radio-root.directive.d.ts +19 -34
  89. package/radio/src/radio-tokens.d.ts +6 -4
  90. package/roving-focus/README.md +3 -0
  91. package/roving-focus/index.d.ts +3 -0
  92. package/roving-focus/src/roving-focus-group.directive.d.ts +50 -0
  93. package/roving-focus/src/roving-focus-item.directive.d.ts +50 -0
  94. package/roving-focus/src/utils.d.ts +19 -0
  95. package/select/src/select-item.directive.d.ts +7 -1
  96. package/toggle/src/toggle-input.directive.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-tokens.ts","../../../packages/primitives/radio/src/radio-item.directive.ts","../../../packages/primitives/radio/src/radio-root.directive.ts","../../../packages/primitives/radio/src/radio-indicator.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport interface RadioGroupProps {\n name?: string;\n disabled?: boolean;\n defaultValue?: string;\n value?: string;\n}\n\nexport interface RadioGroupDirective extends RadioGroupProps {\n select(value: string): void;\n\n onTouched(): void;\n}\n\nexport const RDX_RADIO_GROUP = new InjectionToken<RadioGroupDirective>('RdxRadioGroup');\n","import { FocusableOption } from '@angular/cdk/a11y';\nimport { booleanAttribute, Directive, ElementRef, inject, InjectionToken, Input, OnInit } from '@angular/core';\nimport { RDX_RADIO_GROUP } from './radio-tokens';\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: '[rdxRadioItem]',\n exportAs: 'rdxRadioItem',\n standalone: true,\n providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }],\n host: {\n type: 'button',\n role: 'radio',\n '[attr.id]': 'id',\n '[attr.aria-checked]': 'checked',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.data-state]': 'checked ? \"checked\" : \"unchecked\"',\n '[attr.tabindex]': 'tabIndex',\n '(click)': '_onClick()',\n '(blur)': '_onBlur()'\n }\n})\nexport class RdxRadioItemDirective implements FocusableOption, OnInit {\n private readonly radioGroup = inject(RDX_RADIO_GROUP);\n readonly element = inject(ElementRef);\n\n @Input() id = `rdx-radio-${++nextUniqueId}`;\n\n @Input({ required: true }) value!: string;\n\n @Input({ transform: booleanAttribute }) disabled = false;\n\n get tabIndex(): number {\n return this.disabled ? -1 : this.radioGroup.value === this.value ? 0 : -1;\n }\n\n get checked(): boolean {\n return this.radioGroup.value === this.value;\n }\n\n ngOnInit() {\n if (this.radioGroup.defaultValue === this.value) {\n this.radioGroup.select(this.value);\n }\n }\n\n focus(): void {\n this.element.nativeElement.focus();\n }\n\n _onClick(): void {\n if (!this.disabled) {\n this.radioGroup.select(this.value);\n }\n }\n\n _onBlur(): void {\n this.radioGroup.onTouched?.();\n }\n}\n","import { FocusKeyManager } from '@angular/cdk/a11y';\nimport { DOWN_ARROW, ENTER, LEFT_ARROW, RIGHT_ARROW, SPACE, TAB, UP_ARROW } from '@angular/cdk/keycodes';\nimport {\n AfterContentInit,\n booleanAttribute,\n ContentChildren,\n Directive,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n QueryList\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { Subject, takeUntil } from 'rxjs';\nimport { RdxRadioItemDirective } from './radio-item.directive';\nimport { RadioGroupDirective, RadioGroupProps, RDX_RADIO_GROUP } from './radio-tokens';\n\n@Directive({\n selector: '[rdxRadioRoot]',\n exportAs: 'rdxRadioRoot',\n standalone: true,\n providers: [\n { provide: RDX_RADIO_GROUP, useExisting: RdxRadioGroupDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RdxRadioGroupDirective, multi: true }\n ],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': '_orientation',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.tabindex]': '-1',\n '[attr.dir]': 'dir',\n '(keydown)': 'onKeydown($event)',\n '(focusin)': 'onFocusin($event)'\n }\n})\nexport class RdxRadioGroupDirective\n implements RadioGroupProps, RadioGroupDirective, ControlValueAccessor, AfterContentInit, OnDestroy\n{\n @ContentChildren(RdxRadioItemDirective, { descendants: true }) radioItems!: QueryList<RdxRadioItemDirective>;\n private focusKeyManager!: FocusKeyManager<RdxRadioItemDirective>;\n private destroy$ = new Subject<void>();\n\n name?: string | undefined;\n @Input() value?: string;\n\n @Input({ transform: booleanAttribute }) disabled = false;\n\n @Input() dir?: string;\n\n @Input() defaultValue?: string;\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 handler called when the value changes.\n */\n @Output() readonly onValueChange = new EventEmitter<string>();\n\n /**\n * The callback function to call when the value of the radio group changes.\n */\n private onChange: (value: string) => void = () => {\n /* Empty */\n };\n\n /**\n * The callback function to call when the radio group is touched.\n */\n onTouched: () => void = () => {\n /* Empty */\n };\n\n ngAfterContentInit() {\n this.focusKeyManager = new FocusKeyManager(this.radioItems).withWrap().withVerticalOrientation();\n\n this.radioItems.changes.pipe(takeUntil(this.destroy$)).subscribe(() => {\n this.updateActiveItem();\n });\n\n this.updateActiveItem(false);\n }\n\n ngOnDestroy() {\n this.destroy$.next();\n this.destroy$.complete();\n }\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 this.updateActiveItem();\n this.onTouched();\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 if (this.radioItems) {\n this.updateActiveItem(false);\n }\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.\n */\n protected onFocusin(event: FocusEvent): void {\n const target = event.target as HTMLElement;\n const radioItem = this.radioItems.find((item) => item.element.nativeElement === target);\n if (radioItem) {\n this.focusKeyManager.setActiveItem(radioItem);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.disabled) return;\n\n switch (event.keyCode) {\n case ENTER:\n case SPACE:\n event.preventDefault();\n this.selectFocusedItem();\n break;\n case DOWN_ARROW:\n case RIGHT_ARROW:\n event.preventDefault();\n this.focusKeyManager.setNextItemActive();\n this.selectFocusedItem();\n break;\n case UP_ARROW:\n case LEFT_ARROW:\n event.preventDefault();\n this.focusKeyManager.setPreviousItemActive();\n this.selectFocusedItem();\n break;\n case TAB:\n this.tabNavigation(event);\n break;\n default:\n this.focusKeyManager.onKeydown(event);\n }\n }\n\n private selectFocusedItem(): void {\n const focusedItem = this.focusKeyManager.activeItem;\n if (focusedItem) {\n this.select(focusedItem.value);\n }\n }\n\n private updateActiveItem(setFocus = true): void {\n const activeItem = this.radioItems.find((item) => item.value === this.value);\n if (activeItem) {\n this.focusKeyManager.setActiveItem(activeItem);\n } else if (this.radioItems.length > 0 && setFocus) {\n this.focusKeyManager.setFirstItemActive();\n }\n }\n\n private tabNavigation(event: KeyboardEvent): void {\n event.preventDefault();\n const checkedItem = this.radioItems.find((item) => item.checked);\n if (checkedItem) {\n checkedItem.focus();\n } else if (this.radioItems.first) {\n this.radioItems.first.focus();\n }\n }\n}\n","import { Directive, inject } from '@angular/core';\nimport { RdxRadioItemDirective } from './radio-item.directive';\nimport { RDX_RADIO_GROUP, RadioGroupDirective } from './radio-tokens';\n\n@Directive({\n selector: '[rdxRadioIndicator]',\n exportAs: 'rdxRadioIndicator',\n standalone: true,\n host: {\n '[attr.data-state]': 'radioItem.checked ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'radioItem.disabled ? \"\" : null'\n }\n})\nexport class RdxRadioIndicatorDirective {\n protected readonly radioGroup: RadioGroupDirective = inject(RDX_RADIO_GROUP);\n protected readonly radioItem: RdxRadioItemDirective = inject(RdxRadioItemDirective);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mapp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AAM,CAAC,eAAe,CAAC;AACzD,QAAA,IAAA,CAAA,SAAS,GAA0B,MAAM,CAAC,qBAAqB,CAAC;AACtF;+GAHY,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAA1B,0BAA0B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,qBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,iDAAA,EAAA,oBAAA,EAAA,kCAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBATtC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,6CAA6C;AAClE,wBAAA,sBAAsB,EAAE;AAC3B;AACJ,iBAAA;;;ACZD;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-tokens.ts","../../../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/src/radio-item-input.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport { InjectionToken, InputSignalWithTransform, ModelSignal, Signal } from '@angular/core';\n\nexport interface RadioGroupProps {\n name?: string;\n disabled?: InputSignalWithTransform<boolean, BooleanInput>;\n defaultValue?: string;\n value: ModelSignal<string | null>;\n disableState: Signal<boolean>;\n}\n\nexport interface RadioGroupDirective extends RadioGroupProps {\n select(value: string | null): void;\n\n onTouched(): void;\n}\n\nexport const RDX_RADIO_GROUP = new InjectionToken<RadioGroupDirective>('RdxRadioGroup');\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, Input, model, output, signal } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { Orientation, RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\nimport { RadioGroupDirective, RadioGroupProps, RDX_RADIO_GROUP } from './radio-tokens';\n\n@Directive({\n selector: '[rdxRadioRoot]',\n exportAs: 'rdxRadioRoot',\n standalone: true,\n providers: [\n { provide: RDX_RADIO_GROUP, useExisting: RdxRadioGroupDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RdxRadioGroupDirective, multi: true }\n ],\n hostDirectives: [{ directive: RdxRovingFocusGroupDirective, inputs: ['dir', 'orientation', 'loop'] }],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': 'orientation()',\n '[attr.aria-required]': 'required()',\n '[attr.data-disabled]': 'disableState() ? \"\" : null',\n '(keydown)': 'onKeydown()'\n }\n})\nexport class RdxRadioGroupDirective implements RadioGroupProps, RadioGroupDirective, ControlValueAccessor {\n readonly value = model<string | null>(null);\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n @Input() defaultValue?: string;\n\n readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly orientation = input<Orientation>();\n\n /**\n * Event handler called when the value changes.\n */\n readonly onValueChange = output<string>();\n\n private readonly disable = signal<boolean>(this.disabled());\n readonly disableState = computed(() => this.disable() || this.disabled());\n\n /**\n * The callback function to call when the value of the radio group changes.\n */\n private onChange: (value: string) => void = () => {\n /* Empty */\n };\n\n /**\n * The callback function to call when the radio group is touched.\n * @ignore\n */\n onTouched: () => void = () => {\n /* Empty */\n };\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n * @ignore\n */\n select(value: string): void {\n this.value.set(value);\n this.onValueChange.emit(value);\n this.onChange?.(value);\n this.onTouched();\n }\n\n /**\n * Update the value of the radio group.\n * @param value The new value of the radio group.\n * @ignore\n */\n writeValue(value: string): void {\n this.value.set(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 * @ignore\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n /** @ignore */\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 * @ignore\n */\n setDisabledState(isDisabled: boolean): void {\n this.disable.set(isDisabled);\n }\n\n protected onKeydown(): void {\n if (this.disableState()) return;\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n InjectionToken,\n input,\n OnInit,\n signal\n} from '@angular/core';\nimport { RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\nimport { RDX_RADIO_GROUP } from './radio-tokens';\n\nexport const RdxRadioItemToken = new InjectionToken<RdxRadioItemDirective>('RadioItemToken');\n\nexport function injectRadioItem(): RdxRadioItemDirective {\n return inject(RdxRadioItemToken);\n}\n\n@Directive({\n selector: '[rdxRadioItem]',\n exportAs: 'rdxRadioItem',\n standalone: true,\n providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }],\n hostDirectives: [\n { directive: RdxRovingFocusItemDirective, inputs: ['tabStopId: id', 'focusable', 'active', 'allowShiftKey'] }],\n\n host: {\n type: 'button',\n role: 'radio',\n '[attr.aria-checked]': 'checkedState()',\n '[attr.data-disabled]': 'disabledState() ? \"\" : null',\n '[attr.data-state]': 'checkedState() ? \"checked\" : \"unchecked\"',\n '[disabled]': 'disabledState()',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n '(keyup)': 'onKeyUp()',\n '(focus)': 'onFocus()'\n }\n})\nexport class RdxRadioItemDirective implements OnInit {\n private readonly radioGroup = inject(RDX_RADIO_GROUP);\n private readonly elementRef = inject(ElementRef);\n\n readonly value = input.required<string>();\n\n readonly id = input<string>();\n\n readonly required = input<boolean>();\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n protected readonly disabledState = computed(() => this.radioGroup.disableState() || this.disabled());\n\n readonly checkedState = computed(() => this.radioGroup.value() === this.value());\n\n private readonly ARROW_KEYS = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];\n private readonly isArrowKeyPressedSignal = signal(false);\n\n /** @ignore */\n ngOnInit() {\n if (this.radioGroup.defaultValue === this.value()) {\n this.radioGroup.select(this.value());\n }\n }\n\n /** @ignore */\n onClick() {\n if (!this.disabledState()) {\n this.radioGroup.select(this.value());\n this.isArrowKeyPressedSignal.set(true);\n }\n }\n\n /** @ignore */\n onKeyDown(event: KeyboardEvent): void {\n if (this.ARROW_KEYS.includes(event.key)) {\n this.isArrowKeyPressedSignal.set(true);\n }\n }\n\n /** @ignore */\n onKeyUp() {\n this.isArrowKeyPressedSignal.set(false);\n }\n\n /** @ignore */\n onFocus() {\n this.radioGroup.select(this.value());\n setTimeout(() => {\n /**\n * When navigating with arrow keys, focus triggers on the radio item.\n * To \"check\" the radio, we programmatically trigger a click event.\n */\n if (this.isArrowKeyPressedSignal()) {\n this.elementRef.nativeElement.click();\n }\n }, 0);\n }\n}\n","import { Directive, inject } from '@angular/core';\nimport { RdxRadioItemDirective } from './radio-item.directive';\nimport { RDX_RADIO_GROUP, RadioGroupDirective } from './radio-tokens';\n\n@Directive({\n selector: '[rdxRadioIndicator]',\n exportAs: 'rdxRadioIndicator',\n standalone: true,\n host: {\n '[attr.data-state]': 'radioItem.checked ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'radioItem.disabled ? \"\" : null'\n }\n})\nexport class RdxRadioIndicatorDirective {\n protected readonly radioGroup: RadioGroupDirective = inject(RDX_RADIO_GROUP);\n protected readonly radioItem: RdxRadioItemDirective = inject(RdxRadioItemDirective);\n}\n","import { computed, Directive, input } from '@angular/core';\nimport { RdxVisuallyHiddenDirective } from '@radix-ng/primitives/visually-hidden';\nimport { injectRadioItem } from './radio-item.directive';\n\n@Directive({\n selector: '[rdxRadioItemInput]',\n exportAs: 'rdxRadioItemInput',\n standalone: true,\n hostDirectives: [\n { directive: RdxVisuallyHiddenDirective, inputs: ['feature'] }],\n host: {\n type: 'radio',\n '[attr.name]': 'name()',\n '[attr.required]': 'required()',\n '[attr.disabled]': 'disabled() ? disabled() : undefined',\n '[attr.checked]': 'checked()',\n '[value]': 'value()'\n }\n})\nexport class RdxRadioItemInputDirective {\n private readonly radioItem = injectRadioItem();\n\n readonly name = input<string>();\n readonly value = computed(() => this.radioItem.value() || undefined);\n readonly checked = computed(() => this.radioItem.checkedState() || undefined);\n readonly required = input<boolean | undefined>(this.radioItem.required());\n readonly disabled = input<boolean | undefined>(this.radioItem.disabled());\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;AAiBO,MAAM,eAAe,GAAG,IAAI,cAAc,CAAsB,eAAe,CAAC;;MCM1E,sBAAsB,CAAA;AAjBnC,IAAA,WAAA,GAAA;AAkBa,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAgB,IAAI,CAAC;QAElC,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;QAI/E,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;QAE/E,IAAW,CAAA,WAAA,GAAG,KAAK,EAAe;AAE3C;;AAEG;QACM,IAAa,CAAA,aAAA,GAAG,MAAM,EAAU;QAExB,IAAO,CAAA,OAAA,GAAG,MAAM,CAAU,IAAI,CAAC,QAAQ,EAAE,CAAC;AAClD,QAAA,IAAA,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AA,EAAA,EAAA,QAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAAA,IAAA,CAAA,0BAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAftC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,cAAc,EAAE;wBACZ,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC;AAAG,qBAAA;AACnE,oBAAA,IAAI,EAAE;AACF,wBAAA,IAAI,EAAE,OAAO;AACb,wBAAA,aAAa,EAAE,QAAQ;AACvB,wBAAA,iBAAiB,EAAE,YAAY;AAC/B,wBAAA,iBAAiB,EAAE,qCAAqC;AACxD,wBAAA,gBAAgB,EAAE,WAAW;AAC7B,wBAAA,SAAS,EAAE;AACd;AACJ,iBAAA;;;AClBD;;AAEG;;;;"}
@@ -0,0 +1,320 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, NgZone, ElementRef, EventEmitter, signal, booleanAttribute, Directive, Input, Output, computed } from '@angular/core';
3
+
4
+ const ENTRY_FOCUS = 'rovingFocusGroup.onEntryFocus';
5
+ const EVENT_OPTIONS = { bubbles: false, cancelable: true };
6
+ const MAP_KEY_TO_FOCUS_INTENT = {
7
+ ArrowLeft: 'prev',
8
+ ArrowUp: 'prev',
9
+ ArrowRight: 'next',
10
+ ArrowDown: 'next',
11
+ PageUp: 'first',
12
+ Home: 'first',
13
+ PageDown: 'last',
14
+ End: 'last'
15
+ };
16
+ function getDirectionAwareKey(key, dir) {
17
+ if (dir !== 'rtl')
18
+ return key;
19
+ return key === 'ArrowLeft' ? 'ArrowRight' : key === 'ArrowRight' ? 'ArrowLeft' : key;
20
+ }
21
+ function getFocusIntent(event, orientation, dir) {
22
+ const key = getDirectionAwareKey(event.key, dir);
23
+ if (orientation === 'vertical' && ['ArrowLeft', 'ArrowRight'].includes(key))
24
+ return undefined;
25
+ if (orientation === 'horizontal' && ['ArrowUp', 'ArrowDown'].includes(key))
26
+ return undefined;
27
+ return MAP_KEY_TO_FOCUS_INTENT[key];
28
+ }
29
+ function focusFirst(candidates, preventScroll = false, rootNode) {
30
+ const PREVIOUSLY_FOCUSED_ELEMENT = rootNode?.activeElement ?? document.activeElement;
31
+ for (const candidate of candidates) {
32
+ // if focus is already where we want to go, we don't want to keep going through the candidates
33
+ if (candidate === PREVIOUSLY_FOCUSED_ELEMENT)
34
+ return;
35
+ candidate.focus({ preventScroll });
36
+ if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT)
37
+ return;
38
+ }
39
+ }
40
+ /**
41
+ * Wraps an array around itself at a given start index
42
+ * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`
43
+ */
44
+ function wrapArray(array, startIndex) {
45
+ return array.map((_, index) => array[(startIndex + index) % array.length]);
46
+ }
47
+ function generateId() {
48
+ return `rf-item-${Math.random().toString(36).slice(2, 11)}`;
49
+ }
50
+
51
+ class RdxRovingFocusGroupDirective {
52
+ constructor() {
53
+ this.ngZone = inject(NgZone);
54
+ this.elementRef = inject(ElementRef);
55
+ this.dir = 'ltr';
56
+ this.loop = true;
57
+ this.preventScrollOnEntryFocus = false;
58
+ this.entryFocus = new EventEmitter();
59
+ this.currentTabStopIdChange = new EventEmitter();
60
+ /** @ignore */
61
+ this.currentTabStopId = signal(null);
62
+ /** @ignore */
63
+ this.focusableItems = signal([]);
64
+ this.isClickFocus = signal(false);
65
+ this.isTabbingBackOut = signal(false);
66
+ this.focusableItemsCount = signal(0);
67
+ }
68
+ /** @ignore */
69
+ get dataOrientation() {
70
+ return this.orientation || 'horizontal';
71
+ }
72
+ /** @ignore */
73
+ get tabIndex() {
74
+ return this.isTabbingBackOut() || this.getFocusableItemsCount() === 0 ? -1 : 0;
75
+ }
76
+ /** @ignore */
77
+ handleBlur() {
78
+ this.isTabbingBackOut.set(false);
79
+ }
80
+ /** @ignore */
81
+ handleMouseUp() {
82
+ // reset `isClickFocus` after 1 tick because handleFocus might not triggered due to focused element
83
+ this.ngZone.runOutsideAngular(() => {
84
+ // eslint-disable-next-line promise/catch-or-return,promise/always-return
85
+ Promise.resolve().then(() => {
86
+ this.ngZone.run(() => {
87
+ this.isClickFocus.set(false);
88
+ });
89
+ });
90
+ });
91
+ }
92
+ /** @ignore */
93
+ handleFocus(event) {
94
+ // We normally wouldn't need this check, because we already check
95
+ // that the focus is on the current target and not bubbling to it.
96
+ // We do this because Safari doesn't focus buttons when clicked, and
97
+ // instead, the wrapper will get focused and not through a bubbling event.
98
+ const isKeyboardFocus = !this.isClickFocus();
99
+ if (event.currentTarget === this.elementRef.nativeElement &&
100
+ event.target === event.currentTarget &&
101
+ isKeyboardFocus &&
102
+ !this.isTabbingBackOut()) {
103
+ const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
104
+ this.elementRef.nativeElement.dispatchEvent(entryFocusEvent);
105
+ this.entryFocus.emit(entryFocusEvent);
106
+ if (!entryFocusEvent.defaultPrevented) {
107
+ const items = this.focusableItems().filter((item) => item.dataset['disabled'] !== '');
108
+ const activeItem = items.find((item) => item.getAttribute('data-active') === 'true');
109
+ const currentItem = items.find((item) => item.id === this.currentTabStopId());
110
+ const candidateItems = [activeItem, currentItem, ...items].filter(Boolean);
111
+ focusFirst(candidateItems, this.preventScrollOnEntryFocus);
112
+ }
113
+ }
114
+ this.isClickFocus.set(false);
115
+ }
116
+ /** @ignore */
117
+ handleMouseDown() {
118
+ this.isClickFocus.set(true);
119
+ }
120
+ /** @ignore */
121
+ onItemFocus(tabStopId) {
122
+ this.currentTabStopId.set(tabStopId);
123
+ this.currentTabStopIdChange.emit(tabStopId);
124
+ }
125
+ /** @ignore */
126
+ onItemShiftTab() {
127
+ this.isTabbingBackOut.set(true);
128
+ }
129
+ /** @ignore */
130
+ onFocusableItemAdd() {
131
+ this.focusableItemsCount.update((count) => count + 1);
132
+ }
133
+ /** @ignore */
134
+ onFocusableItemRemove() {
135
+ this.focusableItemsCount.update((count) => Math.max(0, count - 1));
136
+ }
137
+ /** @ignore */
138
+ registerItem(item) {
139
+ const currentItems = this.focusableItems();
140
+ this.focusableItems.set([...currentItems, item]);
141
+ }
142
+ /** @ignore */
143
+ unregisterItem(item) {
144
+ const currentItems = this.focusableItems();
145
+ this.focusableItems.set(currentItems.filter((el) => el !== item));
146
+ }
147
+ /** @ignore */
148
+ getFocusableItemsCount() {
149
+ return this.focusableItemsCount();
150
+ }
151
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: RdxRovingFocusGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
152
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.2.11", type: RdxRovingFocusGroupDirective, isStandalone: true, selector: "[rdxRovingFocusGroup]", inputs: { orientation: "orientation", dir: "dir", loop: ["loop", "loop", booleanAttribute], preventScrollOnEntryFocus: ["preventScrollOnEntryFocus", "preventScrollOnEntryFocus", booleanAttribute] }, outputs: { entryFocus: "entryFocus", currentTabStopIdChange: "currentTabStopIdChange" }, host: { listeners: { "focus": "handleFocus($event)", "blur": "handleBlur()", "mouseup": "handleMouseUp()", "mousedown": "handleMouseDown()" }, properties: { "attr.data-orientation": "dataOrientation", "attr.tabindex": "tabIndex", "attr.dir": "dir" }, styleAttribute: "outline: none;" }, ngImport: i0 }); }
153
+ }
154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: RdxRovingFocusGroupDirective, decorators: [{
155
+ type: Directive,
156
+ args: [{
157
+ selector: '[rdxRovingFocusGroup]',
158
+ standalone: true,
159
+ host: {
160
+ '[attr.data-orientation]': 'dataOrientation',
161
+ '[attr.tabindex]': 'tabIndex',
162
+ '[attr.dir]': 'dir',
163
+ '(focus)': 'handleFocus($event)',
164
+ '(blur)': 'handleBlur()',
165
+ '(mouseup)': 'handleMouseUp()',
166
+ '(mousedown)': 'handleMouseDown()',
167
+ style: 'outline: none;'
168
+ }
169
+ }]
170
+ }], propDecorators: { orientation: [{
171
+ type: Input
172
+ }], dir: [{
173
+ type: Input
174
+ }], loop: [{
175
+ type: Input,
176
+ args: [{ transform: booleanAttribute }]
177
+ }], preventScrollOnEntryFocus: [{
178
+ type: Input,
179
+ args: [{ transform: booleanAttribute }]
180
+ }], entryFocus: [{
181
+ type: Output
182
+ }], currentTabStopIdChange: [{
183
+ type: Output
184
+ }] } });
185
+
186
+ class RdxRovingFocusItemDirective {
187
+ constructor() {
188
+ this.elementRef = inject(ElementRef);
189
+ this.ngZone = inject(NgZone);
190
+ this.parent = inject(RdxRovingFocusGroupDirective);
191
+ this.focusable = true;
192
+ this.active = true;
193
+ this.allowShiftKey = false;
194
+ this.id = computed(() => this.tabStopId || generateId());
195
+ /** @ignore */
196
+ this.isCurrentTabStop = computed(() => this.parent.currentTabStopId() === this.id());
197
+ }
198
+ /**
199
+ * Lifecycle hook triggered on initialization.
200
+ * Registers the element with the parent roving focus group if it is focusable.
201
+ * @ignore
202
+ */
203
+ ngOnInit() {
204
+ if (this.focusable) {
205
+ this.parent.registerItem(this.elementRef.nativeElement);
206
+ this.parent.onFocusableItemAdd();
207
+ }
208
+ }
209
+ /**
210
+ * Lifecycle hook triggered on destruction.
211
+ * Unregisters the element from the parent roving focus group if it is focusable.
212
+ * @ignore
213
+ */
214
+ ngOnDestroy() {
215
+ if (this.focusable) {
216
+ this.parent.unregisterItem(this.elementRef.nativeElement);
217
+ this.parent.onFocusableItemRemove();
218
+ }
219
+ }
220
+ /**
221
+ * Determines the `tabIndex` of the element.
222
+ * Returns `0` if the element is the current tab stop; otherwise, returns `-1`.
223
+ * @ignore
224
+ */
225
+ get tabIndex() {
226
+ return this.isCurrentTabStop() ? 0 : -1;
227
+ }
228
+ /** @ignore */
229
+ handleMouseDown(event) {
230
+ if (!this.focusable) {
231
+ // We prevent focusing non-focusable items on `mousedown`.
232
+ // Even though the item has tabIndex={-1}, that only means take it out of the tab order.
233
+ event.preventDefault();
234
+ }
235
+ else {
236
+ // Safari doesn't focus a button when clicked so we run our logic on mousedown also
237
+ this.parent.onItemFocus(this.id());
238
+ }
239
+ }
240
+ /** @ignore */
241
+ onFocus() {
242
+ this.parent.onItemFocus(this.id());
243
+ }
244
+ /**
245
+ * Handles the `keydown` event for keyboard navigation within the roving focus group.
246
+ * Supports navigation based on orientation and direction, and focuses appropriate elements.
247
+ *
248
+ * @param event The `KeyboardEvent` object.
249
+ * @ignore
250
+ */
251
+ handleKeydown(event) {
252
+ if (event.key === 'Tab' && event.shiftKey) {
253
+ this.parent.onItemShiftTab();
254
+ return;
255
+ }
256
+ if (event.target !== this.elementRef.nativeElement)
257
+ return;
258
+ const focusIntent = getFocusIntent(event, this.parent.orientation, this.parent.dir);
259
+ if (focusIntent !== undefined) {
260
+ if (event.metaKey || event.ctrlKey || event.altKey || (this.allowShiftKey ? false : event.shiftKey)) {
261
+ return;
262
+ }
263
+ event.preventDefault();
264
+ let candidateNodes = this.parent.focusableItems().filter((item) => item.dataset['disabled'] !== '');
265
+ if (focusIntent === 'last') {
266
+ candidateNodes.reverse();
267
+ }
268
+ else if (focusIntent === 'prev' || focusIntent === 'next') {
269
+ if (focusIntent === 'prev')
270
+ candidateNodes.reverse();
271
+ const currentIndex = candidateNodes.indexOf(this.elementRef.nativeElement);
272
+ candidateNodes = this.parent.loop
273
+ ? wrapArray(candidateNodes, currentIndex + 1)
274
+ : candidateNodes.slice(currentIndex + 1);
275
+ }
276
+ this.ngZone.runOutsideAngular(() => {
277
+ // eslint-disable-next-line promise/always-return,promise/catch-or-return
278
+ Promise.resolve().then(() => {
279
+ focusFirst(candidateNodes, false, this.elementRef.nativeElement);
280
+ });
281
+ });
282
+ }
283
+ }
284
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: RdxRovingFocusItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
285
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.2.11", type: RdxRovingFocusItemDirective, isStandalone: true, selector: "[rdxRovingFocusItem]", inputs: { focusable: ["focusable", "focusable", booleanAttribute], active: ["active", "active", booleanAttribute], tabStopId: "tabStopId", allowShiftKey: ["allowShiftKey", "allowShiftKey", booleanAttribute] }, host: { listeners: { "mousedown": "handleMouseDown($event)", "keydown": "handleKeydown($event)", "focus": "onFocus()" }, properties: { "attr.tabindex": "tabIndex", "attr.data-orientation": "parent.orientation", "attr.data-active": "active", "attr.data-disabled": "!focusable ? \"\" : undefined" } }, ngImport: i0 }); }
286
+ }
287
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: RdxRovingFocusItemDirective, decorators: [{
288
+ type: Directive,
289
+ args: [{
290
+ selector: '[rdxRovingFocusItem]',
291
+ standalone: true,
292
+ host: {
293
+ '[attr.tabindex]': 'tabIndex',
294
+ '[attr.data-orientation]': 'parent.orientation',
295
+ '[attr.data-active]': 'active',
296
+ '[attr.data-disabled]': '!focusable ? "" : undefined',
297
+ '(mousedown)': 'handleMouseDown($event)',
298
+ '(keydown)': 'handleKeydown($event)',
299
+ '(focus)': 'onFocus()'
300
+ }
301
+ }]
302
+ }], propDecorators: { focusable: [{
303
+ type: Input,
304
+ args: [{ transform: booleanAttribute }]
305
+ }], active: [{
306
+ type: Input,
307
+ args: [{ transform: booleanAttribute }]
308
+ }], tabStopId: [{
309
+ type: Input
310
+ }], allowShiftKey: [{
311
+ type: Input,
312
+ args: [{ transform: booleanAttribute }]
313
+ }] } });
314
+
315
+ /**
316
+ * Generated bundle index. Do not edit.
317
+ */
318
+
319
+ export { RdxRovingFocusGroupDirective, RdxRovingFocusItemDirective };
320
+ //# sourceMappingURL=radix-ng-primitives-roving-focus.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radix-ng-primitives-roving-focus.mjs","sources":["../../../packages/primitives/roving-focus/src/utils.ts","../../../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":["export type Orientation = 'horizontal' | 'vertical';\nexport type Direction = 'ltr' | 'rtl';\n\nexport const ENTRY_FOCUS = 'rovingFocusGroup.onEntryFocus';\nexport const EVENT_OPTIONS = { bubbles: false, cancelable: true };\n\ntype FocusIntent = 'first' | 'last' | 'prev' | 'next';\n\nexport const MAP_KEY_TO_FOCUS_INTENT: Record<string, FocusIntent> = {\n ArrowLeft: 'prev',\n ArrowUp: 'prev',\n ArrowRight: 'next',\n ArrowDown: 'next',\n PageUp: 'first',\n Home: 'first',\n PageDown: 'last',\n End: 'last'\n};\n\nexport function getDirectionAwareKey(key: string, dir?: Direction) {\n if (dir !== 'rtl') return key;\n return key === 'ArrowLeft' ? 'ArrowRight' : key === 'ArrowRight' ? 'ArrowLeft' : key;\n}\n\nexport function getFocusIntent(event: KeyboardEvent, orientation?: Orientation, dir?: Direction) {\n const key = getDirectionAwareKey(event.key, dir);\n if (orientation === 'vertical' && ['ArrowLeft', 'ArrowRight'].includes(key)) return undefined;\n if (orientation === 'horizontal' && ['ArrowUp', 'ArrowDown'].includes(key)) return undefined;\n return MAP_KEY_TO_FOCUS_INTENT[key];\n}\n\nexport function focusFirst(candidates: HTMLElement[], preventScroll = false, rootNode?: Document | ShadowRoot) {\n const PREVIOUSLY_FOCUSED_ELEMENT = rootNode?.activeElement ?? document.activeElement;\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus({ preventScroll });\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\n\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */\nexport function wrapArray<T>(array: T[], startIndex: number) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\n\nexport function generateId(): string {\n return `rf-item-${Math.random().toString(36).slice(2, 11)}`;\n}\n","import {\n booleanAttribute,\n Directive,\n ElementRef,\n EventEmitter,\n inject,\n Input,\n NgZone,\n Output,\n signal\n} from '@angular/core';\nimport { Direction, ENTRY_FOCUS, EVENT_OPTIONS, focusFirst, Orientation } from './utils';\n\n@Directive({\n selector: '[rdxRovingFocusGroup]',\n standalone: true,\n host: {\n '[attr.data-orientation]': 'dataOrientation',\n '[attr.tabindex]': 'tabIndex',\n '[attr.dir]': 'dir',\n '(focus)': 'handleFocus($event)',\n '(blur)': 'handleBlur()',\n '(mouseup)': 'handleMouseUp()',\n '(mousedown)': 'handleMouseDown()',\n style: 'outline: none;'\n }\n})\nexport class RdxRovingFocusGroupDirective {\n private readonly ngZone = inject(NgZone);\n private readonly elementRef = inject(ElementRef);\n\n @Input() orientation: Orientation | undefined;\n @Input() dir: Direction = 'ltr';\n @Input({ transform: booleanAttribute }) loop: boolean = true;\n @Input({ transform: booleanAttribute }) preventScrollOnEntryFocus: boolean = false;\n\n @Output() entryFocus = new EventEmitter<Event>();\n @Output() currentTabStopIdChange = new EventEmitter<string | null>();\n\n /** @ignore */\n readonly currentTabStopId = signal<string | null>(null);\n\n /** @ignore */\n readonly focusableItems = signal<HTMLElement[]>([]);\n\n private readonly isClickFocus = signal(false);\n private readonly isTabbingBackOut = signal(false);\n private readonly focusableItemsCount = signal(0);\n\n /** @ignore */\n get dataOrientation() {\n return this.orientation || 'horizontal';\n }\n\n /** @ignore */\n get tabIndex() {\n return this.isTabbingBackOut() || this.getFocusableItemsCount() === 0 ? -1 : 0;\n }\n\n /** @ignore */\n handleBlur() {\n this.isTabbingBackOut.set(false);\n }\n\n /** @ignore */\n handleMouseUp() {\n // reset `isClickFocus` after 1 tick because handleFocus might not triggered due to focused element\n this.ngZone.runOutsideAngular(() => {\n // eslint-disable-next-line promise/catch-or-return,promise/always-return\n Promise.resolve().then(() => {\n this.ngZone.run(() => {\n this.isClickFocus.set(false);\n });\n });\n });\n }\n\n /** @ignore */\n handleFocus(event: FocusEvent) {\n // We normally wouldn't need this check, because we already check\n // that the focus is on the current target and not bubbling to it.\n // We do this because Safari doesn't focus buttons when clicked, and\n // instead, the wrapper will get focused and not through a bubbling event.\n const isKeyboardFocus = !this.isClickFocus();\n\n if (\n event.currentTarget === this.elementRef.nativeElement &&\n event.target === event.currentTarget &&\n isKeyboardFocus &&\n !this.isTabbingBackOut()\n ) {\n const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);\n this.elementRef.nativeElement.dispatchEvent(entryFocusEvent);\n this.entryFocus.emit(entryFocusEvent);\n\n if (!entryFocusEvent.defaultPrevented) {\n const items = this.focusableItems().filter((item) => item.dataset['disabled'] !== '');\n const activeItem = items.find((item) => item.getAttribute('data-active') === 'true');\n const currentItem = items.find((item) => item.id === this.currentTabStopId());\n const candidateItems = [activeItem, currentItem, ...items].filter(Boolean) as HTMLElement[];\n\n focusFirst(candidateItems, this.preventScrollOnEntryFocus);\n }\n }\n this.isClickFocus.set(false);\n }\n\n /** @ignore */\n handleMouseDown() {\n this.isClickFocus.set(true);\n }\n\n /** @ignore */\n onItemFocus(tabStopId: string) {\n this.currentTabStopId.set(tabStopId);\n this.currentTabStopIdChange.emit(tabStopId);\n }\n\n /** @ignore */\n onItemShiftTab() {\n this.isTabbingBackOut.set(true);\n }\n\n /** @ignore */\n onFocusableItemAdd() {\n this.focusableItemsCount.update((count) => count + 1);\n }\n\n /** @ignore */\n onFocusableItemRemove() {\n this.focusableItemsCount.update((count) => Math.max(0, count - 1));\n }\n\n /** @ignore */\n registerItem(item: HTMLElement) {\n const currentItems = this.focusableItems();\n this.focusableItems.set([...currentItems, item]);\n }\n\n /** @ignore */\n unregisterItem(item: HTMLElement) {\n const currentItems = this.focusableItems();\n this.focusableItems.set(currentItems.filter((el) => el !== item));\n }\n\n /** @ignore */\n getFocusableItemsCount() {\n return this.focusableItemsCount();\n }\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n Input,\n NgZone,\n OnDestroy,\n OnInit\n} from '@angular/core';\nimport { RdxRovingFocusGroupDirective } from './roving-focus-group.directive';\nimport { focusFirst, generateId, getFocusIntent, wrapArray } from './utils';\n\n@Directive({\n selector: '[rdxRovingFocusItem]',\n standalone: true,\n host: {\n '[attr.tabindex]': 'tabIndex',\n '[attr.data-orientation]': 'parent.orientation',\n '[attr.data-active]': 'active',\n '[attr.data-disabled]': '!focusable ? \"\" : undefined',\n '(mousedown)': 'handleMouseDown($event)',\n '(keydown)': 'handleKeydown($event)',\n '(focus)': 'onFocus()'\n }\n})\nexport class RdxRovingFocusItemDirective implements OnInit, OnDestroy {\n private readonly elementRef = inject(ElementRef);\n private readonly ngZone = inject(NgZone);\n protected readonly parent = inject(RdxRovingFocusGroupDirective);\n\n @Input({ transform: booleanAttribute }) focusable: boolean = true;\n @Input({ transform: booleanAttribute }) active: boolean = true;\n @Input() tabStopId: string;\n @Input({ transform: booleanAttribute }) allowShiftKey: boolean = false;\n\n private readonly id = computed(() => this.tabStopId || generateId());\n\n /** @ignore */\n readonly isCurrentTabStop = computed(() => this.parent.currentTabStopId() === this.id());\n\n /**\n * Lifecycle hook triggered on initialization.\n * Registers the element with the parent roving focus group if it is focusable.\n * @ignore\n */\n ngOnInit() {\n if (this.focusable) {\n this.parent.registerItem(this.elementRef.nativeElement);\n this.parent.onFocusableItemAdd();\n }\n }\n\n /**\n * Lifecycle hook triggered on destruction.\n * Unregisters the element from the parent roving focus group if it is focusable.\n * @ignore\n */\n ngOnDestroy() {\n if (this.focusable) {\n this.parent.unregisterItem(this.elementRef.nativeElement);\n this.parent.onFocusableItemRemove();\n }\n }\n\n /**\n * Determines the `tabIndex` of the element.\n * Returns `0` if the element is the current tab stop; otherwise, returns `-1`.\n * @ignore\n */\n get tabIndex() {\n return this.isCurrentTabStop() ? 0 : -1;\n }\n\n /** @ignore */\n handleMouseDown(event: MouseEvent) {\n if (!this.focusable) {\n // We prevent focusing non-focusable items on `mousedown`.\n // Even though the item has tabIndex={-1}, that only means take it out of the tab order.\n event.preventDefault();\n } else {\n // Safari doesn't focus a button when clicked so we run our logic on mousedown also\n this.parent.onItemFocus(this.id());\n }\n }\n\n /** @ignore */\n onFocus() {\n this.parent.onItemFocus(this.id());\n }\n\n /**\n * Handles the `keydown` event for keyboard navigation within the roving focus group.\n * Supports navigation based on orientation and direction, and focuses appropriate elements.\n *\n * @param event The `KeyboardEvent` object.\n * @ignore\n */\n handleKeydown(event: KeyboardEvent) {\n if (event.key === 'Tab' && event.shiftKey) {\n this.parent.onItemShiftTab();\n return;\n }\n\n if (event.target !== this.elementRef.nativeElement) return;\n\n const focusIntent = getFocusIntent(event, this.parent.orientation, this.parent.dir);\n\n if (focusIntent !== undefined) {\n if (event.metaKey || event.ctrlKey || event.altKey || (this.allowShiftKey ? false : event.shiftKey)) {\n return;\n }\n\n event.preventDefault();\n\n let candidateNodes = this.parent.focusableItems().filter((item) => item.dataset['disabled'] !== '');\n\n if (focusIntent === 'last') {\n candidateNodes.reverse();\n } else if (focusIntent === 'prev' || focusIntent === 'next') {\n if (focusIntent === 'prev') candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(this.elementRef.nativeElement);\n\n candidateNodes = this.parent.loop\n ? wrapArray(candidateNodes, currentIndex + 1)\n : candidateNodes.slice(currentIndex + 1);\n }\n\n this.ngZone.runOutsideAngular(() => {\n // eslint-disable-next-line promise/always-return,promise/catch-or-return\n Promise.resolve().then(() => {\n focusFirst(candidateNodes, false, this.elementRef.nativeElement);\n });\n });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A7C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;gBAC7B,SAAS,EAAA,CAAA;sBAAjB;gBACuC,aAAa,EAAA,CAAA;sBAApD,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;;ACnC1C;;AAEG;;;;"}
@@ -328,13 +328,16 @@ class RdxSelectItemDirective {
328
328
  }
329
329
  });
330
330
  }
331
- /** Gets the label to be used when determining whether the option should be focused. */
331
+ /** Gets the label to be used when determining whether the option should be focused.
332
+ * @ignore
333
+ */
332
334
  getLabel() {
333
335
  return this.viewValue;
334
336
  }
335
337
  /**
336
338
  * `Selects the option while indicating the selection came from the user. Used to
337
339
  * determine if the select's view -> model callback should be invoked.`
340
+ * @ignore
338
341
  */
339
342
  selectViaInteraction() {
340
343
  if (!this.disabled) {
@@ -342,6 +345,7 @@ class RdxSelectItemDirective {
342
345
  this.onSelectionChange.emit(new RdxSelectItemChange(this));
343
346
  }
344
347
  }
348
+ /** @ignore */
345
349
  handleKeydown(event) {
346
350
  if (event.keyCode === ENTER || event.keyCode === SPACE) {
347
351
  this.selectViaInteraction();
@@ -350,10 +354,12 @@ class RdxSelectItemDirective {
350
354
  event.stopPropagation();
351
355
  }
352
356
  }
357
+ /** @ignore */
353
358
  setActiveStyles() {
354
359
  this.highlighted = true;
355
360
  this.nativeElement.focus({ preventScroll: true });
356
361
  }
362
+ /** @ignore */
357
363
  setInactiveStyles() {
358
364
  this.highlighted = false;
359
365
  }