@radix-ng/primitives 1.0.0-beta.5 → 1.0.1

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 (50) hide show
  1. package/composite/README.md +3 -0
  2. package/fesm2022/radix-ng-primitives-accordion.mjs +12 -36
  3. package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
  4. package/fesm2022/radix-ng-primitives-composite.mjs +515 -0
  5. package/fesm2022/radix-ng-primitives-composite.mjs.map +1 -0
  6. package/fesm2022/radix-ng-primitives-drawer.mjs +442 -2
  7. package/fesm2022/radix-ng-primitives-drawer.mjs.map +1 -1
  8. package/fesm2022/radix-ng-primitives-menu.mjs +38 -16
  9. package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
  10. package/fesm2022/radix-ng-primitives-menubar.mjs +68 -36
  11. package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
  12. package/fesm2022/radix-ng-primitives-navigation-menu.mjs +281 -88
  13. package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
  14. package/fesm2022/radix-ng-primitives-popover.mjs +40 -15
  15. package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
  16. package/fesm2022/radix-ng-primitives-popper.mjs +73 -65
  17. package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
  18. package/fesm2022/radix-ng-primitives-radio.mjs +63 -27
  19. package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
  20. package/fesm2022/radix-ng-primitives-roving-focus.mjs +40 -8
  21. package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
  22. package/fesm2022/radix-ng-primitives-scroll-area.mjs +56 -25
  23. package/fesm2022/radix-ng-primitives-scroll-area.mjs.map +1 -1
  24. package/fesm2022/radix-ng-primitives-select.mjs +3 -0
  25. package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
  26. package/fesm2022/radix-ng-primitives-tabs.mjs +50 -21
  27. package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
  28. package/fesm2022/radix-ng-primitives-toggle-group.mjs +66 -21
  29. package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
  30. package/fesm2022/radix-ng-primitives-toggle.mjs +29 -11
  31. package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
  32. package/fesm2022/radix-ng-primitives-toolbar.mjs +50 -24
  33. package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
  34. package/navigation-menu/README.md +5 -2
  35. package/package.json +5 -1
  36. package/types/radix-ng-primitives-accordion.d.ts +9 -13
  37. package/types/radix-ng-primitives-composite.d.ts +152 -0
  38. package/types/radix-ng-primitives-drawer.d.ts +40 -2
  39. package/types/radix-ng-primitives-menu.d.ts +5 -3
  40. package/types/radix-ng-primitives-menubar.d.ts +10 -5
  41. package/types/radix-ng-primitives-navigation-menu.d.ts +65 -33
  42. package/types/radix-ng-primitives-popover.d.ts +9 -5
  43. package/types/radix-ng-primitives-popper.d.ts +1 -0
  44. package/types/radix-ng-primitives-radio.d.ts +11 -9
  45. package/types/radix-ng-primitives-roving-focus.d.ts +15 -1
  46. package/types/radix-ng-primitives-scroll-area.d.ts +4 -1
  47. package/types/radix-ng-primitives-tabs.d.ts +8 -5
  48. package/types/radix-ng-primitives-toggle-group.d.ts +27 -16
  49. package/types/radix-ng-primitives-toggle.d.ts +5 -5
  50. package/types/radix-ng-primitives-toolbar.d.ts +22 -14
@@ -1 +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/index.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\n/**\n * Sorts elements by their position in the document, so the order matches what the user sees.\n */\nexport function sortByDocumentPosition(elements: HTMLElement[]): HTMLElement[] {\n return [...elements].sort((a, b) => (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1));\n}\n\nlet idCounter = 0;\n\nexport function generateId(): string {\n return `rf-item-${++idCounter}`;\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n booleanAttribute,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n linkedSignal,\n model,\n output,\n PLATFORM_ID,\n signal\n} from '@angular/core';\nimport { BooleanInput, createContext } from '@radix-ng/primitives/core';\nimport { injectDirection } from '@radix-ng/primitives/direction-provider';\nimport { Direction, ENTRY_FOCUS, EVENT_OPTIONS, focusFirst, Orientation, sortByDocumentPosition } from './utils';\n\nconst rootContext = () => {\n const rovingFocusGroup = inject(RdxRovingFocusGroupDirective);\n return {\n loop: rovingFocusGroup.loop,\n dir: rovingFocusGroup.dir,\n orientation: rovingFocusGroup.orientation,\n currentTabStopId: rovingFocusGroup.currentTabStopId,\n focusableItems: rovingFocusGroup.focusableItems,\n onItemFocus: (tabStopId: string) => {\n rovingFocusGroup.currentTabStopId.set(tabStopId);\n },\n onItemShiftTab: () => {\n rovingFocusGroup.isTabbingBackOut.set(true);\n },\n registerItem: (item: HTMLElement, tabStopId: string) => rovingFocusGroup.registerItem(item, tabStopId),\n unregisterItem: (item: HTMLElement, tabStopId: string) => rovingFocusGroup.unregisterItem(item, tabStopId)\n };\n};\n\nexport type RovingFocusGroupContext = ReturnType<typeof rootContext>;\n\nexport const [injectRovingFocusGroupContext, provideRovingFocusGroupContext] = createContext<RovingFocusGroupContext>(\n 'RovingFocusGroupContext',\n 'utils/roving-focus'\n);\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxRovingFocusGroup]',\n providers: [provideRovingFocusGroupContext(rootContext)],\n host: {\n '[attr.data-orientation]': 'orientation()',\n '[attr.tabindex]': 'isTabbingBackOut() || focusableItems().length === 0 ? -1 : 0',\n '[attr.dir]': 'dir()',\n '(focus)': 'handleFocus($event)',\n '(focusout)': 'isTabbingBackOut.set(false)',\n '(mouseup)': 'handleMouseUp()',\n '(mousedown)': 'isClickFocus.set(true)'\n }\n})\nexport class RdxRovingFocusGroupDirective {\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly elementRef = inject(ElementRef);\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The orientation of the group. Mainly so arrow navigation is done accordingly (left & right vs. up & down)\n */\n readonly orientationInput = input<Orientation>('horizontal', { alias: 'orientation' });\n\n /**\n * The direction of navigation between items.\n */\n readonly dirInput = input<Direction | undefined>(undefined, { alias: 'dir' });\n private readonly effectiveDir = injectDirection(this.dirInput);\n\n /**\n * Whether keyboard navigation should loop around\n */\n readonly loopInput = input<boolean, BooleanInput>(true, { transform: booleanAttribute, alias: 'loop' });\n\n /**\n * When `true`, will prevent scrolling to the focus item when focused.\n * @group Props\n */\n readonly preventScrollOnEntryFocus = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The value of the current stop item.\n *\n * Use when you do not need to control the state of the stop item.\n * @group Props\n */\n readonly defaultCurrentTabStopId = input<string | undefined>(undefined);\n\n /**\n * The controlled value of the current stop item. Can be binded as `model`.\n * @group Props\n */\n readonly currentTabStopId = model<string | undefined>(undefined);\n\n /**\n * Event handler called when container is being focused. Can be prevented.\n * @group Emits\n */\n readonly entryFocus = output<Event>();\n\n private readonly _orientation = linkedSignal(() => this.orientationInput());\n readonly orientation = this._orientation.asReadonly();\n\n private readonly _dir = linkedSignal(() => this.effectiveDir());\n readonly dir = this._dir.asReadonly();\n\n private readonly _loop = linkedSignal(() => this.loopInput());\n readonly loop = this._loop.asReadonly();\n\n readonly focusableItems = signal<HTMLElement[]>([]);\n protected readonly isClickFocus = signal(false);\n readonly isTabbingBackOut = signal(false);\n private readonly itemIds = new WeakMap<HTMLElement, string>();\n private isDestroyed = false;\n\n constructor() {\n this.destroyRef.onDestroy(() => {\n this.isDestroyed = true;\n });\n\n effect(() => {\n if (this.currentTabStopId() === undefined) {\n const def = this.defaultCurrentTabStopId();\n if (def !== undefined) {\n this.currentTabStopId.set(def);\n }\n }\n });\n }\n\n setOrientation(value: Orientation) {\n this._orientation.set(value);\n }\n\n setDir(value: Direction) {\n this._dir.set(value);\n }\n\n setLoop(value: boolean) {\n this._loop.set(value);\n }\n\n /** @ignore */\n registerItem(item: HTMLElement, tabStopId: string) {\n this.itemIds.set(item, tabStopId);\n // Keep the registry in DOM order, so arrow navigation matches the visual order\n // regardless of the order in which items are created/registered.\n this.focusableItems.update((items) => sortByDocumentPosition([...items, item]));\n }\n\n /** @ignore */\n unregisterItem(item: HTMLElement, tabStopId: string) {\n const remainingItems = this.focusableItems().filter((el) => el !== item);\n\n this.focusableItems.set(remainingItems);\n this.itemIds.delete(item);\n\n if (!this.isDestroyed && this.currentTabStopId() === tabStopId) {\n this.currentTabStopId.set(this.itemIds.get(remainingItems[0]));\n }\n }\n\n /** @ignore */\n handleMouseUp() {\n if (!this.isBrowser) return;\n\n // reset `isClickFocus` after 1 tick because handleFocus might not triggered due to focused element\n requestAnimationFrame(() => {\n this.isClickFocus.set(false);\n });\n }\n\n /** @ignore */\n handleFocus(event: Event) {\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 // The current tab stop is the only item with `tabindex=\"0\"` (driven by\n // `currentTabStopId`). We match on it instead of the DOM `id`, because consumers\n // (tabs, navigation-menu) own the element `id` and it may not equal the internal id.\n const currentItem = items.find((item) => item.getAttribute('tabindex') === '0');\n\n const candidateItems = [activeItem, currentItem, ...items].filter(Boolean) as typeof items;\n\n focusFirst(candidateItems, this.preventScrollOnEntryFocus());\n }\n }\n\n this.isClickFocus.set(false);\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n linkedSignal,\n PLATFORM_ID,\n untracked\n} from '@angular/core';\nimport { BooleanInput } from '@radix-ng/primitives/core';\nimport { injectRovingFocusGroupContext } from './roving-focus-group.directive';\nimport { focusFirst, generateId, getFocusIntent, wrapArray } from './utils';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxRovingFocusItem]',\n host: {\n '[attr.tabindex]': 'tabindex()',\n '[attr.data-orientation]': 'rootContext?.orientation()',\n '[attr.data-active]': 'active() ? \"true\" : undefined',\n '[attr.data-disabled]': '!focusable() ? \"\" : undefined',\n '(mousedown)': 'handleMouseDown($event)',\n '(keydown)': 'handleKeydown($event)',\n '(focus)': 'onFocus()'\n }\n})\nexport class RdxRovingFocusItemDirective {\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly elementRef = inject(ElementRef);\n\n /**\n * The enclosing roving-focus group. Optional: when the item is used outside a group\n * (e.g. a standalone Toggle), it degrades to a plain element and does not manage focus.\n */\n protected readonly rootContext = injectRovingFocusGroupContext(true);\n\n /**\n * When false, item will not be focusable.\n * @group Props\n */\n readonly focusableInput = input<boolean, BooleanInput>(true, { transform: booleanAttribute, alias: 'focusable' });\n\n /**\n * When `true`, marks the item as the active one, so it is preferred when focus enters the group.\n * @group Props\n */\n readonly activeInput = input<boolean, BooleanInput>(false, { transform: booleanAttribute, alias: 'active' });\n\n /**\n * @group Props\n */\n readonly tabStopIdInput = input<string>(undefined, { alias: 'tabStopId' });\n\n /**\n * When true, shift + arrow key will allow focusing on next/previous item.\n * @group Props\n */\n readonly allowShiftKey = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n // Stable fallback id, generated once so it never changes across recomputations of `id`.\n private readonly generatedId = generateId();\n protected readonly id = computed(() => this.tabStopId() || this.generatedId);\n protected readonly isCurrentTabStop = computed(() => this.rootContext?.currentTabStopId() === this.id());\n\n protected readonly focusable = linkedSignal(() => this.focusableInput());\n protected readonly active = linkedSignal(() => this.activeInput());\n private readonly tabStopId = linkedSignal(() => this.tabStopIdInput());\n\n /**\n * The roving tabindex. Without a group the item keeps its natural tab order (`null`); inside a\n * group exactly one focusable item is a tab stop (`0`), the rest are reachable only via arrows (`-1`).\n */\n protected readonly tabindex = computed(() => {\n if (!this.rootContext) {\n return null;\n }\n return this.focusable() && this.isCurrentTabStop() ? 0 : -1;\n });\n\n constructor() {\n // Keep the group's registry in sync with `focusable`, which can change after creation\n // (e.g. toolbar/navigation-menu toggle it via `setFocusable`). The cleanup also runs on\n // destroy, so a single effect covers register/unregister for the whole lifecycle.\n effect((onCleanup) => {\n const rootContext = this.rootContext;\n if (!rootContext || !this.focusable()) return;\n\n const element = this.elementRef.nativeElement;\n // `registerItem` reads and writes the group's `focusableItems` signal; calling it\n // untracked prevents the effect from depending on its own write and looping.\n const tabStopId = this.id();\n untracked(() => rootContext.registerItem(element, tabStopId));\n\n onCleanup(() => rootContext.unregisterItem(element, tabStopId));\n });\n }\n\n setFocusable(value: boolean) {\n this.focusable.set(value);\n }\n\n setActive(value: boolean) {\n this.active.set(value);\n }\n\n setTabStopId(value: string) {\n this.tabStopId.set(value);\n }\n\n /** @ignore */\n onFocus() {\n this.rootContext?.onItemFocus(this.id());\n }\n\n /** @ignore */\n handleMouseDown(event: Event) {\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.rootContext?.onItemFocus(this.id());\n }\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: Event) {\n const rootContext = this.rootContext;\n if (!rootContext) return;\n\n const keyEvent = event as KeyboardEvent;\n if (keyEvent.key === 'Tab' && keyEvent.shiftKey) {\n rootContext.onItemShiftTab();\n return;\n }\n\n if (event.target !== this.elementRef.nativeElement) return;\n\n const focusIntent = getFocusIntent(keyEvent, rootContext.orientation(), rootContext.dir());\n\n if (focusIntent !== undefined) {\n if (\n keyEvent.metaKey ||\n keyEvent.ctrlKey ||\n keyEvent.altKey ||\n (this.allowShiftKey() ? false : keyEvent.shiftKey)\n ) {\n return;\n }\n\n event.preventDefault();\n\n let candidateNodes = rootContext.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 = rootContext.loop()\n ? wrapArray(candidateNodes, currentIndex + 1)\n : candidateNodes.slice(currentIndex + 1);\n }\n\n queueMicrotask(() => {\n if (this.isBrowser) {\n const rootNode = this.elementRef.nativeElement.getRootNode() as Document | ShadowRoot;\n focusFirst(candidateNodes, false, rootNode);\n }\n });\n }\n }\n}\n","import { RdxRovingFocusGroupDirective } from './src/roving-focus-group.directive';\nimport { RdxRovingFocusItemDirective } from './src/roving-focus-item.directive';\n\nexport * from './src/roving-focus-group.directive';\nexport * from './src/roving-focus-item.directive';\n\nexport { focusFirst } from './src/utils';\nexport type { Direction, Orientation } from './src/utils';\n\nexport const rovingFocusImports = [RdxRovingFocusGroupDirective, RdxRovingFocusItemDirective];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAGO,MAAM,WAAW,GAAG,+BAA+B;AACnD,MAAM,aAAa,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE;AAI1D,MAAM,uBAAuB,GA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AA,EAAA,UAAA,EAAA,WAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,aAAA,EAAA,EAAA,iBAAA,EAAA,eAAA,EAAA,UAAA,EAAA,eAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,WAAA,EAAA,yBAAA,EAAA,SAAA,EAAA,uBAAA,EAAA,OAAA,EAAA,WAAA,EAAA,EAAA,UAAA,EAAA,EAAA,eAAA,EAAA,YAAA,EAAA,uBAAA,EAAA,4BAAA,EAAA,kBAAA,EAAA,iCAAA,EAAA,oBAAA,EAAA,iCAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAA3B,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAZvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,IAAI,EAAE;AACF,wBAAA,iBAAiB,EAAE,YAAY;AAC/B,wBAAA,yBAAyB,EAAE,4BAA4B;AACvD,wBAAA,oBAAoB,EAAE,+BAA+B;AACrD,wBAAA,sBAAsB,EAAE,+BAA+B;AACvD,wBAAA,aAAa,EAAE,yBAAyB;AACxC,wBAAA,WAAW,EAAE,uBAAuB;AACpC,wBAAA,SAAS,EAAE;AACd;AACJ,iBAAA;;;MCtBY,kBAAkB,GAAG,CAAC,4BAA4B,EAAE,2BAA2B;;ACT5F;;AAEG;;;;"}
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/index.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\n/**\n * Sorts elements by their position in the document, so the order matches what the user sees.\n */\nexport function sortByDocumentPosition(elements: HTMLElement[]): HTMLElement[] {\n return [...elements].sort((a, b) => (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1));\n}\n\nlet idCounter = 0;\n\nexport function generateId(): string {\n return `rf-item-${++idCounter}`;\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n booleanAttribute,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n linkedSignal,\n model,\n output,\n PLATFORM_ID,\n signal\n} from '@angular/core';\nimport { BooleanInput, createContext } from '@radix-ng/primitives/core';\nimport { injectDirection } from '@radix-ng/primitives/direction-provider';\nimport { Direction, ENTRY_FOCUS, EVENT_OPTIONS, focusFirst, Orientation, sortByDocumentPosition } from './utils';\n\nconst rootContext = () => {\n const rovingFocusGroup = inject(RdxRovingFocusGroupDirective);\n return {\n enabled: rovingFocusGroup.enabled,\n loop: rovingFocusGroup.loop,\n dir: rovingFocusGroup.dir,\n orientation: rovingFocusGroup.orientation,\n currentTabStopId: rovingFocusGroup.currentTabStopId,\n focusableItems: rovingFocusGroup.focusableItems,\n onItemFocus: (tabStopId: string) => {\n rovingFocusGroup.currentTabStopId.set(tabStopId);\n },\n onItemShiftTab: () => {\n rovingFocusGroup.isTabbingBackOut.set(true);\n },\n registerItem: (item: HTMLElement, tabStopId: string) => rovingFocusGroup.registerItem(item, tabStopId),\n unregisterItem: (item: HTMLElement, tabStopId: string) => rovingFocusGroup.unregisterItem(item, tabStopId)\n };\n};\n\nexport type RovingFocusGroupContext = ReturnType<typeof rootContext>;\n\nexport const [injectRovingFocusGroupContext, provideRovingFocusGroupContext] = createContext<RovingFocusGroupContext>(\n 'RovingFocusGroupContext',\n 'utils/roving-focus'\n);\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxRovingFocusGroup]',\n providers: [provideRovingFocusGroupContext(rootContext)],\n host: {\n '[attr.data-orientation]': 'orientation()',\n '[attr.tabindex]': 'enabled() ? (isTabbingBackOut() || focusableItems().length === 0 ? -1 : 0) : null',\n '[attr.dir]': 'dir()',\n '(focus)': 'handleFocus($event)',\n '(focusout)': 'isTabbingBackOut.set(false)',\n '(mouseup)': 'handleMouseUp()',\n '(mousedown)': 'isClickFocus.set(true)'\n }\n})\nexport class RdxRovingFocusGroupDirective {\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly elementRef = inject(ElementRef);\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The orientation of the group. Mainly so arrow navigation is done accordingly (left & right vs. up & down)\n */\n readonly orientationInput = input<Orientation>('horizontal', { alias: 'orientation' });\n\n /**\n * The direction of navigation between items.\n */\n readonly dirInput = input<Direction | undefined>(undefined, { alias: 'dir' });\n private readonly effectiveDir = injectDirection(this.dirInput);\n\n /**\n * Whether keyboard navigation should loop around\n */\n readonly loopInput = input<boolean, BooleanInput>(true, { transform: booleanAttribute, alias: 'loop' });\n\n /**\n * Whether roving focus behavior is active for the group.\n * @group Props\n */\n readonly enabledInput = input<boolean, BooleanInput>(true, { transform: booleanAttribute, alias: 'enabled' });\n\n /**\n * When `true`, will prevent scrolling to the focus item when focused.\n * @group Props\n */\n readonly preventScrollOnEntryFocus = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The value of the current stop item.\n *\n * Use when you do not need to control the state of the stop item.\n * @group Props\n */\n readonly defaultCurrentTabStopId = input<string | undefined>(undefined);\n\n /**\n * The controlled value of the current stop item. Can be binded as `model`.\n * @group Props\n */\n readonly currentTabStopId = model<string | undefined>(undefined);\n\n /**\n * Event handler called when container is being focused. Can be prevented.\n * @group Emits\n */\n readonly entryFocus = output<Event>();\n\n private readonly _orientation = linkedSignal(() => this.orientationInput());\n readonly orientation = this._orientation.asReadonly();\n\n private readonly _dir = linkedSignal(() => this.effectiveDir());\n readonly dir = this._dir.asReadonly();\n\n private readonly _loop = linkedSignal(() => this.loopInput());\n readonly loop = this._loop.asReadonly();\n\n private readonly _enabled = linkedSignal(() => this.enabledInput());\n readonly enabled = this._enabled.asReadonly();\n\n readonly focusableItems = signal<HTMLElement[]>([]);\n protected readonly isClickFocus = signal(false);\n readonly isTabbingBackOut = signal(false);\n private readonly itemIds = new WeakMap<HTMLElement, string>();\n private isDestroyed = false;\n\n constructor() {\n this.destroyRef.onDestroy(() => {\n this.isDestroyed = true;\n });\n\n effect(() => {\n if (this.currentTabStopId() === undefined) {\n const def = this.defaultCurrentTabStopId();\n if (def !== undefined) {\n this.currentTabStopId.set(def);\n }\n }\n });\n }\n\n setOrientation(value: Orientation) {\n this._orientation.set(value);\n }\n\n setDir(value: Direction) {\n this._dir.set(value);\n }\n\n setLoop(value: boolean) {\n this._loop.set(value);\n }\n\n setEnabled(value: boolean) {\n this._enabled.set(value);\n }\n\n /** @ignore */\n registerItem(item: HTMLElement, tabStopId: string) {\n this.itemIds.set(item, tabStopId);\n // Keep the registry in DOM order, so arrow navigation matches the visual order\n // regardless of the order in which items are created/registered.\n this.focusableItems.update((items) => sortByDocumentPosition([...items, item]));\n }\n\n /** @ignore */\n unregisterItem(item: HTMLElement, tabStopId: string) {\n const remainingItems = this.focusableItems().filter((el) => el !== item);\n\n this.focusableItems.set(remainingItems);\n this.itemIds.delete(item);\n\n if (!this.isDestroyed && this.currentTabStopId() === tabStopId) {\n this.currentTabStopId.set(this.itemIds.get(remainingItems[0]));\n }\n }\n\n /** @ignore */\n handleMouseUp() {\n if (!this.isBrowser) return;\n\n // reset `isClickFocus` after 1 tick because handleFocus might not triggered due to focused element\n requestAnimationFrame(() => {\n this.isClickFocus.set(false);\n });\n }\n\n /** @ignore */\n handleFocus(event: Event) {\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 this.enabled() &&\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 // The current tab stop is the only item with `tabindex=\"0\"` (driven by\n // `currentTabStopId`). We match on it instead of the DOM `id`, because consumers\n // (tabs, navigation-menu) own the element `id` and it may not equal the internal id.\n const currentItem = items.find((item) => item.getAttribute('tabindex') === '0');\n\n const candidateItems = [activeItem, currentItem, ...items].filter(Boolean) as typeof items;\n\n focusFirst(candidateItems, this.preventScrollOnEntryFocus());\n }\n }\n\n this.isClickFocus.set(false);\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n linkedSignal,\n PLATFORM_ID,\n signal,\n untracked\n} from '@angular/core';\nimport { BooleanInput } from '@radix-ng/primitives/core';\nimport { injectRovingFocusGroupContext } from './roving-focus-group.directive';\nimport { focusFirst, generateId, getFocusIntent, wrapArray } from './utils';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxRovingFocusItem]',\n host: {\n '[attr.tabindex]': 'tabindex()',\n '[attr.data-orientation]': 'enabled() ? rootContext?.orientation() : undefined',\n '[attr.data-active]': 'active() ? \"true\" : undefined',\n '[attr.data-disabled]': 'enabled() && !focusable() ? \"\" : undefined',\n '(mousedown)': 'handleMouseDown($event)',\n '(keydown)': 'handleKeydown($event)',\n '(focus)': 'onFocus()'\n }\n})\nexport class RdxRovingFocusItemDirective {\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly elementRef = inject(ElementRef);\n\n /**\n * The enclosing roving-focus group. Optional: when the item is used outside a group\n * (e.g. a standalone Toggle), it degrades to a plain element and does not manage focus.\n */\n protected readonly rootContext = injectRovingFocusGroupContext(true);\n\n /**\n * When false, item will not be focusable.\n * @group Props\n */\n readonly focusableInput = input<boolean, BooleanInput>(true, { transform: booleanAttribute, alias: 'focusable' });\n\n /**\n * When `true`, marks the item as the active one, so it is preferred when focus enters the group.\n * @group Props\n */\n readonly activeInput = input<boolean, BooleanInput>(false, { transform: booleanAttribute, alias: 'active' });\n\n /**\n * @group Props\n */\n readonly tabStopIdInput = input<string>(undefined, { alias: 'tabStopId' });\n\n /**\n * When true, shift + arrow key will allow focusing on next/previous item.\n * @group Props\n */\n readonly allowShiftKey = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n // Stable fallback id, generated once so it never changes across recomputations of `id`.\n private readonly generatedId = generateId();\n protected readonly id = computed(() => this.tabStopId() || this.generatedId);\n protected readonly isCurrentTabStop = computed(() => this.rootContext?.currentTabStopId() === this.id());\n\n protected readonly focusable = linkedSignal(() => this.focusableInput());\n protected readonly active = linkedSignal(() => this.activeInput());\n protected readonly enabled = signal(true);\n private readonly tabStopId = linkedSignal(() => this.tabStopIdInput());\n\n /**\n * The roving tabindex. Without a group the item keeps its natural tab order (`null`); inside a\n * group exactly one focusable item is a tab stop (`0`), the rest are reachable only via arrows (`-1`).\n */\n protected readonly tabindex = computed(() => {\n if (!this.rootContext) {\n return null;\n }\n if (!this.enabled()) {\n return null;\n }\n if (!this.rootContext.enabled()) {\n return null;\n }\n return this.focusable() && this.isCurrentTabStop() ? 0 : -1;\n });\n\n constructor() {\n // Keep the group's registry in sync with `focusable`, which can change after creation\n // (e.g. toolbar/navigation-menu toggle it via `setFocusable`). The cleanup also runs on\n // destroy, so a single effect covers register/unregister for the whole lifecycle.\n effect((onCleanup) => {\n const rootContext = this.rootContext;\n if (!rootContext || !this.enabled() || !this.focusable()) return;\n\n const element = this.elementRef.nativeElement;\n // `registerItem` reads and writes the group's `focusableItems` signal; calling it\n // untracked prevents the effect from depending on its own write and looping.\n const tabStopId = this.id();\n untracked(() => rootContext.registerItem(element, tabStopId));\n\n onCleanup(() => rootContext.unregisterItem(element, tabStopId));\n });\n }\n\n setFocusable(value: boolean) {\n this.focusable.set(value);\n }\n\n setEnabled(value: boolean) {\n this.enabled.set(value);\n }\n\n setActive(value: boolean) {\n this.active.set(value);\n }\n\n setTabStopId(value: string) {\n this.tabStopId.set(value);\n }\n\n /** @ignore */\n onFocus() {\n if (!this.enabled()) {\n return;\n }\n\n this.rootContext?.onItemFocus(this.id());\n }\n\n /** @ignore */\n handleMouseDown(event: Event) {\n if (!this.enabled()) {\n return;\n }\n\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.rootContext?.onItemFocus(this.id());\n }\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: Event) {\n const rootContext = this.rootContext;\n if (!rootContext) return;\n if (!this.enabled()) return;\n if (!rootContext.enabled()) return;\n\n const keyEvent = event as KeyboardEvent;\n if (keyEvent.key === 'Tab' && keyEvent.shiftKey) {\n rootContext.onItemShiftTab();\n return;\n }\n\n if (event.target !== this.elementRef.nativeElement) return;\n\n const focusIntent = getFocusIntent(keyEvent, rootContext.orientation(), rootContext.dir());\n\n if (focusIntent !== undefined) {\n if (\n keyEvent.metaKey ||\n keyEvent.ctrlKey ||\n keyEvent.altKey ||\n (this.allowShiftKey() ? false : keyEvent.shiftKey)\n ) {\n return;\n }\n\n event.preventDefault();\n\n let candidateNodes = rootContext.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 = rootContext.loop()\n ? wrapArray(candidateNodes, currentIndex + 1)\n : candidateNodes.slice(currentIndex + 1);\n }\n\n queueMicrotask(() => {\n if (this.isBrowser) {\n const rootNode = this.elementRef.nativeElement.getRootNode() as Document | ShadowRoot;\n focusFirst(candidateNodes, false, rootNode);\n }\n });\n }\n }\n}\n","import { RdxRovingFocusGroupDirective } from './src/roving-focus-group.directive';\nimport { RdxRovingFocusItemDirective } from './src/roving-focus-item.directive';\n\nexport * from './src/roving-focus-group.directive';\nexport * from './src/roving-focus-item.directive';\n\nexport { focusFirst } from './src/utils';\nexport type { Direction, Orientation } from './src/utils';\n\nexport const rovingFocusImports = [RdxRovingFocusGroupDirective, RdxRovingFocusItemDirective];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAGO,MAAM,WAAW,GAAG,+BAA+B;AACnD,MAAM,aAAa,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE;AAI1D,MAAM,uBAAuB,GAAgC;AAChE,IAAA,SAAS,EAAE,MAAM;AACjB,IAAA,OAAO,EAAE,MAAM;AACf,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,SAAS,EAAE,MAAM;AACjB,IAAA,MAAM,EAAE,OAAO;AACf,IAAA,IAAI,EAAE,OAAO;AACb,IAAA,QAAQ,EAAE,MAAM;AAChB,IAAA,GAAG,EAAE;CACR;AAEK,SAAU,oBAAoB,CAAC,GAAW,EAAE,GAAe,EAAA;IAC7D,IAAI,GAAG,KAAK,KAAK;AAAE,QAAA,OAAO,GAAG;IAC7B,OAAO,GAAG,KAAK,WAAW,GAAG,YAAY,GAAG,GAAG,KAAK,YAAY,GAAG,WAAW,GAAG,GAAG;AACxF;SAEgB,cAAc,CAAC,KAAoB,EAAE,WAAyB,EAAE,GAAe,EAAA;IAC3F,MAAM,GAAG,GAAG,oBAAoB,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC;AAChD,IAAA,IAAI,WAAW,KAAK,UAAU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AAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,IAAI,EAAE;AACF,wBAAA,iBAAiB,EAAE,YAAY;AAC/B,wBAAA,yBAAyB,EAAE,oDAAoD;AAC/E,wBAAA,oBAAoB,EAAE,+BAA+B;AACrD,wBAAA,sBAAsB,EAAE,4CAA4C;AACpE,wBAAA,aAAa,EAAE,yBAAyB;AACxC,wBAAA,WAAW,EAAE,uBAAuB;AACpC,wBAAA,SAAS,EAAE;AACd;AACJ,iBAAA;;;MCvBY,kBAAkB,GAAG,CAAC,4BAA4B,EAAE,2BAA2B;;ACT5F;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, DestroyRef, input, computed, signal, ElementRef, Directive, PLATFORM_ID, effect, afterNextRender, booleanAttribute, NgModule } from '@angular/core';
2
+ import { inject, DestroyRef, input, booleanAttribute, computed, signal, ElementRef, Directive, PLATFORM_ID, CSP_NONCE, effect, afterNextRender, NgModule } from '@angular/core';
3
3
  import { clamp, createContext } from '@radix-ng/primitives/core';
4
4
  import { injectDirection } from '@radix-ng/primitives/direction-provider';
5
5
  import { isPlatformBrowser } from '@angular/common';
@@ -55,19 +55,20 @@ function normalizeScrollOffset(value, max) {
55
55
  }
56
56
  return clamped;
57
57
  }
58
- let scrollbarHideStylesInjected = false;
59
58
  /**
60
59
  * Injects (once per document) the CSS that hides the native scrollbars of the viewport.
61
60
  * Headless directives can't hide WebKit scrollbars via inline styles, so a small
62
61
  * stylesheet keyed by the `[rdxScrollAreaViewport]` selector is appended to `<head>`.
63
62
  */
64
- function injectScrollbarHideStyles(document) {
65
- if (scrollbarHideStylesInjected || typeof document === 'undefined') {
63
+ function injectScrollbarHideStyles(document, nonce) {
64
+ if (typeof document === 'undefined' || document.head.querySelector('style[data-rdx-scroll-area]')) {
66
65
  return;
67
66
  }
68
- scrollbarHideStylesInjected = true;
69
67
  const style = document.createElement('style');
70
68
  style.setAttribute('data-rdx-scroll-area', '');
69
+ if (nonce) {
70
+ style.nonce = nonce;
71
+ }
71
72
  style.textContent = `[rdxScrollAreaViewport]{scrollbar-width:none;-ms-overflow-style:none}[rdxScrollAreaViewport]::-webkit-scrollbar{display:none}`;
72
73
  document.head.appendChild(style);
73
74
  }
@@ -82,6 +83,7 @@ const rootContext = () => {
82
83
  rootId: root.rootId,
83
84
  direction: root.direction,
84
85
  overflowEdgeThreshold: root.normalizedThreshold,
86
+ disableStyleElements: root.disableStyleElements,
85
87
  hovering: root.hovering,
86
88
  scrollingX: root.scrollingX,
87
89
  scrollingY: root.scrollingY,
@@ -131,6 +133,7 @@ class RdxScrollAreaRoot {
131
133
  * Accepts a single number for all edges or an object to configure them individually.
132
134
  */
133
135
  this.overflowEdgeThreshold = input(0, ...(ngDevMode ? [{ debugName: "overflowEdgeThreshold" }] : /* istanbul ignore next */ []));
136
+ this.disableStyleElements = input(false, { ...(ngDevMode ? { debugName: "disableStyleElements" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
134
137
  this.normalizedThreshold = computed(() => normalizeOverflowEdgeThreshold(this.overflowEdgeThreshold()), ...(ngDevMode ? [{ debugName: "normalizedThreshold" }] : /* istanbul ignore next */ []));
135
138
  this.hovering = signal(false, ...(ngDevMode ? [{ debugName: "hovering" }] : /* istanbul ignore next */ []));
136
139
  this.scrollingX = signal(false, ...(ngDevMode ? [{ debugName: "scrollingX" }] : /* istanbul ignore next */ []));
@@ -297,7 +300,7 @@ class RdxScrollAreaRoot {
297
300
  }
298
301
  }
299
302
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxScrollAreaRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
300
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxScrollAreaRoot, isStandalone: true, selector: "[rdxScrollAreaRoot]", inputs: { dirInput: { classPropertyName: "dirInput", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, overflowEdgeThreshold: { classPropertyName: "overflowEdgeThreshold", publicName: "overflowEdgeThreshold", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "presentation" }, listeners: { "pointerenter": "onPointerEnterOrMove($event)", "pointermove": "onPointerEnterOrMove($event)", "pointerdown": "onTouchModalityChange($event)", "pointerleave": "hovering.set(false)" }, properties: { "style.position": "\"relative\"", "style.--scroll-area-corner-height": "cornerSize().height + \"px\"", "style.--scroll-area-corner-width": "cornerSize().width + \"px\"", "attr.data-scrolling": "(scrollingX() || scrollingY()) ? \"\" : undefined", "attr.data-has-overflow-x": "!hiddenState().x ? \"\" : undefined", "attr.data-has-overflow-y": "!hiddenState().y ? \"\" : undefined", "attr.data-overflow-x-start": "overflowEdges().xStart ? \"\" : undefined", "attr.data-overflow-x-end": "overflowEdges().xEnd ? \"\" : undefined", "attr.data-overflow-y-start": "overflowEdges().yStart ? \"\" : undefined", "attr.data-overflow-y-end": "overflowEdges().yEnd ? \"\" : undefined" } }, providers: [provideScrollAreaRootContext(rootContext)], exportAs: ["rdxScrollAreaRoot"], ngImport: i0 }); }
303
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxScrollAreaRoot, isStandalone: true, selector: "[rdxScrollAreaRoot]", inputs: { dirInput: { classPropertyName: "dirInput", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, overflowEdgeThreshold: { classPropertyName: "overflowEdgeThreshold", publicName: "overflowEdgeThreshold", isSignal: true, isRequired: false, transformFunction: null }, disableStyleElements: { classPropertyName: "disableStyleElements", publicName: "disableStyleElements", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "presentation" }, listeners: { "pointerenter": "onPointerEnterOrMove($event)", "pointermove": "onPointerEnterOrMove($event)", "pointerdown": "onTouchModalityChange($event)", "pointerleave": "hovering.set(false)" }, properties: { "style.position": "\"relative\"", "style.--scroll-area-corner-height": "cornerSize().height + \"px\"", "style.--scroll-area-corner-width": "cornerSize().width + \"px\"", "attr.data-scrolling": "(scrollingX() || scrollingY()) ? \"\" : undefined", "attr.data-has-overflow-x": "!hiddenState().x ? \"\" : undefined", "attr.data-has-overflow-y": "!hiddenState().y ? \"\" : undefined", "attr.data-overflow-x-start": "overflowEdges().xStart ? \"\" : undefined", "attr.data-overflow-x-end": "overflowEdges().xEnd ? \"\" : undefined", "attr.data-overflow-y-start": "overflowEdges().yStart ? \"\" : undefined", "attr.data-overflow-y-end": "overflowEdges().yEnd ? \"\" : undefined" } }, providers: [provideScrollAreaRootContext(rootContext)], exportAs: ["rdxScrollAreaRoot"], ngImport: i0 }); }
301
304
  }
302
305
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxScrollAreaRoot, decorators: [{
303
306
  type: Directive,
@@ -323,7 +326,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
323
326
  '(pointerleave)': 'hovering.set(false)'
324
327
  }
325
328
  }]
326
- }], ctorParameters: () => [], propDecorators: { dirInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "dir", required: false }] }], overflowEdgeThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "overflowEdgeThreshold", required: false }] }] } });
329
+ }], ctorParameters: () => [], propDecorators: { dirInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "dir", required: false }] }], overflowEdgeThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "overflowEdgeThreshold", required: false }] }], disableStyleElements: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableStyleElements", required: false }] }] } });
327
330
  function normalizeOverflowEdgeThreshold(threshold) {
328
331
  if (typeof threshold === 'number') {
329
332
  const value = Math.max(0, threshold);
@@ -356,11 +359,16 @@ class RdxScrollAreaViewport {
356
359
  this.element = inject(ElementRef).nativeElement;
357
360
  this.destroyRef = inject(DestroyRef);
358
361
  this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
362
+ this.cspNonce = inject(CSP_NONCE, { optional: true });
359
363
  this.programmaticScroll = true;
360
364
  this.lastMeasuredMetrics = [NaN, NaN, NaN, NaN];
361
365
  this.rootContext.viewportRef.current = this.element;
362
366
  if (this.isBrowser) {
363
- injectScrollbarHideStyles(document);
367
+ effect(() => {
368
+ if (!this.rootContext.disableStyleElements()) {
369
+ injectScrollbarHideStyles(this.element.ownerDocument, this.cspNonce);
370
+ }
371
+ });
364
372
  }
365
373
  // Recompute after hidden-state toggles (so newly shown scrollbars get measured),
366
374
  // on direction flips, and when the overflow-edge threshold changes.
@@ -381,6 +389,9 @@ class RdxScrollAreaViewport {
381
389
  }
382
390
  });
383
391
  this.destroyRef.onDestroy(() => {
392
+ if (this.rootContext.viewportRef.current === this.element) {
393
+ this.rootContext.viewportRef.current = null;
394
+ }
384
395
  clearTimeout(this.scrollEndTimer);
385
396
  clearTimeout(this.animationsTimer);
386
397
  });
@@ -650,7 +661,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
650
661
  class RdxScrollAreaCorner {
651
662
  constructor() {
652
663
  this.rootContext = injectScrollAreaRootContext();
653
- this.rootContext.cornerRef.current = inject(ElementRef).nativeElement;
664
+ const element = inject(ElementRef).nativeElement;
665
+ const destroyRef = inject(DestroyRef);
666
+ this.rootContext.cornerRef.current = element;
667
+ destroyRef.onDestroy(() => {
668
+ if (this.rootContext.cornerRef.current === element) {
669
+ this.rootContext.cornerRef.current = null;
670
+ }
671
+ });
654
672
  }
655
673
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxScrollAreaCorner, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
656
674
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxScrollAreaCorner, isStandalone: true, selector: "[rdxScrollAreaCorner]", host: { properties: { "style.position": "\"absolute\"", "style.bottom": "\"0\"", "style.inset-inline-end": "\"0\"", "style.width": "rootContext.cornerSize().width + \"px\"", "style.height": "rootContext.cornerSize().height + \"px\"", "style.display": "rootContext.hiddenState().corner ? \"none\" : null" } }, exportAs: ["rdxScrollAreaCorner"], ngImport: i0 }); }
@@ -696,13 +714,14 @@ class RdxScrollAreaScrollbar {
696
714
  this.hideTrackUntilMeasured = computed(() => !this.rootContext.hasMeasuredScrollbar() && !this.keepMounted(), ...(ngDevMode ? [{ debugName: "hideTrackUntilMeasured" }] : /* istanbul ignore next */ []));
697
715
  // Register this element as the vertical or horizontal scrollbar ref.
698
716
  // Runs as an effect so the bound `orientation` input is available.
699
- effect(() => {
700
- if (this.orientation() === 'vertical') {
701
- this.rootContext.scrollbarYRef.current = this.element;
702
- }
703
- else {
704
- this.rootContext.scrollbarXRef.current = this.element;
705
- }
717
+ effect((onCleanup) => {
718
+ const ref = this.orientation() === 'vertical' ? this.rootContext.scrollbarYRef : this.rootContext.scrollbarXRef;
719
+ ref.current = this.element;
720
+ onCleanup(() => {
721
+ if (ref.current === this.element) {
722
+ ref.current = null;
723
+ }
724
+ });
706
725
  });
707
726
  }
708
727
  onWheel(event) {
@@ -742,10 +761,9 @@ class RdxScrollAreaScrollbar {
742
761
  return;
743
762
  }
744
763
  const orientation = this.orientation();
745
- const target = event.target;
746
764
  const thumb = orientation === 'vertical' ? this.rootContext.thumbYRef.current : this.rootContext.thumbXRef.current;
747
765
  // Ignore clicks on the thumb itself.
748
- if (thumb && target && thumb.contains(target)) {
766
+ if (thumb && eventTargetsElement(event, thumb)) {
749
767
  return;
750
768
  }
751
769
  const viewportEl = this.rootContext.viewportRef.current;
@@ -834,6 +852,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
834
852
  }
835
853
  }]
836
854
  }], ctorParameters: () => [], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], keepMounted: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepMounted", required: false }] }] } });
855
+ function eventTargetsElement(event, element) {
856
+ if (event.composedPath().includes(element)) {
857
+ return true;
858
+ }
859
+ const target = event.target;
860
+ return isNode(target) && element.contains(target);
861
+ }
862
+ function isNode(value) {
863
+ return !!value && 'nodeType' in value;
864
+ }
837
865
 
838
866
  /**
839
867
  * The draggable part of the scrollbar that indicates the current scroll position.
@@ -846,13 +874,16 @@ class RdxScrollAreaThumb {
846
874
  this.rootContext = injectScrollAreaRootContext();
847
875
  this.scrollbarContext = injectScrollAreaScrollbarContext();
848
876
  this.element = inject(ElementRef).nativeElement;
849
- effect(() => {
850
- if (this.scrollbarContext.orientation() === 'vertical') {
851
- this.rootContext.thumbYRef.current = this.element;
852
- }
853
- else {
854
- this.rootContext.thumbXRef.current = this.element;
855
- }
877
+ effect((onCleanup) => {
878
+ const ref = this.scrollbarContext.orientation() === 'vertical'
879
+ ? this.rootContext.thumbYRef
880
+ : this.rootContext.thumbXRef;
881
+ ref.current = this.element;
882
+ onCleanup(() => {
883
+ if (ref.current === this.element) {
884
+ ref.current = null;
885
+ }
886
+ });
856
887
  });
857
888
  }
858
889
  endDrag(event) {