@radix-ng/primitives 1.0.1 → 1.0.3
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.
- package/composite/README.md +1 -1
- package/fesm2022/radix-ng-primitives-accordion.mjs +18 -36
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +134 -58
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +113 -64
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-composite.mjs +127 -43
- package/fesm2022/radix-ng-primitives-composite.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menu.mjs +288 -63
- package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menubar.mjs +24 -1
- package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-select.mjs +56 -29
- package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-slider.mjs +57 -13
- package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +292 -59
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toolbar.mjs +19 -13
- package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
- package/package.json +2 -10
- package/types/radix-ng-primitives-accordion.d.ts +7 -15
- package/types/radix-ng-primitives-checkbox.d.ts +98 -70
- package/types/radix-ng-primitives-collapsible.d.ts +44 -24
- package/types/radix-ng-primitives-composite.d.ts +58 -15
- package/types/radix-ng-primitives-menu.d.ts +44 -16
- package/types/radix-ng-primitives-menubar.d.ts +2 -0
- package/types/radix-ng-primitives-select.d.ts +46 -32
- package/types/radix-ng-primitives-slider.d.ts +19 -4
- package/types/radix-ng-primitives-tabs.d.ts +63 -11
- package/types/radix-ng-primitives-toolbar.d.ts +80 -73
- package/collection/README.md +0 -1
- package/fesm2022/radix-ng-primitives-collection.mjs +0 -72
- package/fesm2022/radix-ng-primitives-collection.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-roving-focus.mjs +0 -420
- package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +0 -1
- package/roving-focus/README.md +0 -3
- package/types/radix-ng-primitives-collection.d.ts +0 -44
- package/types/radix-ng-primitives-roving-focus.d.ts +0 -201
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-collapsible.mjs","sources":["../../../packages/primitives/collapsible/src/collapsible-root.directive.ts","../../../packages/primitives/collapsible/src/collapsible-panel-presence.directive.ts","../../../packages/primitives/collapsible/src/collapsible-panel.directive.ts","../../../packages/primitives/collapsible/src/collapsible-trigger.directive.ts","../../../packages/primitives/collapsible/index.ts","../../../packages/primitives/collapsible/radix-ng-primitives-collapsible.ts"],"sourcesContent":["import {\n booleanAttribute,\n computed,\n Directive,\n effect,\n inject,\n input,\n model,\n ModelSignal,\n output,\n signal,\n Signal,\n untracked,\n WritableSignal\n} from '@angular/core';\nimport {\n BooleanInput,\n createContext,\n injectId,\n RdxTransitionStatus,\n useTransitionStatus\n} from '@radix-ng/primitives/core';\n\nexport type RdxCollapsibleState = 'open' | 'closed';\n\nexport interface CollapsibleRootContext {\n /** Stable id linking the trigger's `aria-controls` to the panel. */\n panelId: Signal<string>;\n /** Writable so composing primitives (Accordion) can drive the state. */\n open: ModelSignal<boolean>;\n disabled: Signal<boolean>;\n /** Open/close transition phase, for `data-starting-style` / `data-ending-style`. */\n transitionStatus: Signal<RdxTransitionStatus>;\n /** `true` while the panel should stay rendered: open, or running its exit transition. */\n mounted: Signal<boolean>;\n /**\n * Composition fallbacks. The standalone Panel inputs write here, and Accordion writes here\n * directly; the Panel reads these so both wiring paths converge on a single source of truth.\n */\n keepMounted: WritableSignal<boolean>;\n hiddenUntilFound: WritableSignal<boolean>;\n toggle: () => void;\n /** Registers the panel element whose transition duration gates the close completion. */\n registerTransitionElement: (element: HTMLElement) => () => void;\n}\n\nexport const [injectCollapsibleRootContext, provideCollapsibleRootContext] = createContext<CollapsibleRootContext>(\n 'CollapsibleRootContext',\n 'components/collapsible'\n);\n\nconst rootContext = (): CollapsibleRootContext => {\n const instance = inject(RdxCollapsibleRootDirective);\n\n return {\n panelId: instance.panelId,\n open: instance.open,\n disabled: instance.disabled,\n transitionStatus: instance.transitionStatus,\n mounted: instance.mounted,\n keepMounted: instance.keepMountedContext,\n hiddenUntilFound: instance.hiddenUntilFoundContext,\n registerTransitionElement: (element) => instance.registerTransitionElement(element),\n toggle: () => {\n if (instance.disabled()) {\n return;\n }\n\n untracked(() => {\n instance.open.set(!instance.open());\n });\n\n instance.onOpenChange.emit(instance.open());\n }\n };\n};\n\n/**\n * Groups all parts of the collapsible.\n *\n * @group Components\n */\n@Directive({\n selector: '[rdxCollapsibleRoot]',\n exportAs: 'rdxCollapsibleRoot',\n providers: [provideCollapsibleRootContext(rootContext)],\n host: {\n '[attr.data-open]': 'open() ? \"\" : undefined',\n '[attr.data-closed]': 'open() ? undefined : \"\"',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxCollapsibleRootDirective {\n private readonly transition = useTransitionStatus((open) => this.onOpenChangeComplete.emit(open));\n\n /** Reactive open/close transition phase (`'starting'` | `'ending'` | `undefined`). */\n readonly transitionStatus = this.transition.status;\n\n /** Registers the panel element whose transition duration gates the close completion. */\n readonly registerTransitionElement = this.transition.registerElement;\n\n /**\n * The controlled open state of the collapsible.\n * `true` - expanded, `false` - collapsed.\n *\n * @group Props\n * @defaultValue false\n */\n readonly open = model<boolean>(false);\n\n /**\n * The open state of the collapsible when it is initially rendered.\n * Use when you do not need to control its open state.\n *\n * @group Props\n * @defaultValue false\n */\n readonly defaultOpen = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the component should ignore user interaction.\n *\n * @group Props\n * @defaultValue false\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Stable id linking the trigger's `aria-controls` to the panel. */\n readonly panelId = input<string>(injectId('rdx-collapsible-panel-'));\n\n /** Composition fallbacks (see {@link CollapsibleRootContext}). Default `false`. */\n readonly keepMountedContext = signal(false);\n readonly hiddenUntilFoundContext = signal(false);\n\n /** `true` while the panel must stay rendered: open, or mid exit transition. */\n readonly mounted = computed(() => this.open() || this.transitionStatus() === 'ending');\n\n /**\n * Event handler called when the open state of the collapsible changes.\n *\n * @group Emits\n */\n readonly onOpenChange = output<boolean>();\n\n /**\n * Event handler called after the open/close transition has finished.\n *\n * @group Emits\n */\n readonly onOpenChangeComplete = output<boolean>();\n\n private hasAppliedDefaultOpen = false;\n private previousOpen = this.open();\n\n constructor() {\n effect(() => {\n const defaultOpen = this.defaultOpen();\n\n if (!this.hasAppliedDefaultOpen && defaultOpen) {\n this.hasAppliedDefaultOpen = true;\n untracked(() => {\n this.open.set(true);\n // Treat an initially-open collapsible as settled so it doesn't play an\n // enter transition on first render.\n this.previousOpen = true;\n });\n }\n });\n\n effect(() => {\n const open = this.open();\n\n if (open !== this.previousOpen) {\n this.previousOpen = open;\n untracked(() => this.transition.start(open));\n }\n });\n }\n}\n","import { Directive } from '@angular/core';\nimport { provideRdxPresenceContext, RdxPresenceDirective } from '@radix-ng/primitives/presence';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n/**\n * Structural directive that mounts the collapsible panel contents only while open, unmounting them\n * once the exit animation finishes. Opt into this when the closed contents should leave the DOM;\n * otherwise apply `rdxCollapsiblePanel` directly (optionally with `keepMounted`).\n */\n@Directive({\n selector: 'ng-template[rdxCollapsiblePanelPresence]',\n providers: [\n provideRdxPresenceContext(() => ({\n present: injectCollapsibleRootContext().open\n }))\n ],\n hostDirectives: [RdxPresenceDirective]\n})\nexport class RdxCollapsiblePanelPresenceDirective {}\n","import {\n afterRenderEffect,\n booleanAttribute,\n computed,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n signal,\n untracked\n} from '@angular/core';\nimport { BooleanInput } from '@radix-ng/primitives/core';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n/**\n * Coerces a collapsible boolean input that distinguishes \"not set\" (`undefined`) from `false`,\n * so the Panel only overrides the shared context value when the consumer passes the input.\n */\nconst optionalBoolean = (value: BooleanInput | undefined): boolean | undefined =>\n value === undefined ? undefined : booleanAttribute(value);\n\n/**\n * A panel with the collapsible contents.\n */\n@Directive({\n selector: '[rdxCollapsiblePanel]',\n host: {\n '[id]': 'rootContext.panelId()',\n '[attr.data-open]': 'rootContext.open() ? \"\" : undefined',\n '[attr.data-closed]': 'rootContext.open() ? undefined : \"\"',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"\" : undefined',\n '[attr.data-starting-style]': 'rootContext.transitionStatus() === \"starting\" ? \"\" : undefined',\n '[attr.data-ending-style]': 'rootContext.transitionStatus() === \"ending\" ? \"\" : undefined',\n '[attr.hidden]': 'hidden()',\n '[style.--collapsible-panel-width.px]': 'width()',\n '[style.--collapsible-panel-height.px]': 'height()'\n }\n})\nexport class RdxCollapsiblePanelDirective {\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n protected readonly rootContext = injectCollapsibleRootContext();\n\n /**\n * Whether to keep the element in the DOM while the panel is closed.\n * When `true`, the closed panel keeps its element (no `hidden` attribute) so the consumer's\n * `data-closed` CSS is responsible for visually collapsing it.\n *\n * @group Props\n * @defaultValue false\n */\n readonly keepMounted = input<boolean | undefined, BooleanInput | undefined>(undefined, {\n transform: optionalBoolean\n });\n\n /**\n * Allows the browser's built-in page search to find and expand the panel contents.\n * When `true`, the closed panel uses `hidden=\"until-found\"` instead of plain `hidden`.\n *\n * @group Props\n * @defaultValue false\n */\n readonly hiddenUntilFound = input<boolean | undefined, BooleanInput | undefined>(undefined, {\n transform: optionalBoolean\n });\n\n readonly height = signal<number | null>(null);\n readonly width = signal<number | null>(null);\n\n /**\n * The `hidden` attribute value. The panel is shown while open or while its exit transition runs;\n * a kept-mounted panel stays visible (the consumer collapses it via CSS); otherwise the closed\n * panel is hidden — with `until-found` when find-in-page support is requested.\n */\n readonly hidden = computed<'' | 'until-found' | undefined>(() => {\n const visible = this.rootContext.open() || this.rootContext.transitionStatus() === 'ending';\n\n if (visible || this.rootContext.keepMounted()) {\n return undefined;\n }\n\n return this.rootContext.hiddenUntilFound() ? 'until-found' : '';\n });\n\n /**\n * The first measurement (the initial mount) must not re-enable animations, so an element that\n * mounts already open renders at its final size without playing the open animation.\n */\n private isFirstMeasure = true;\n private originalStyles?: { transitionDuration: string; animationName: string };\n\n constructor() {\n const unregister = this.rootContext.registerTransitionElement(this.elementRef.nativeElement);\n inject(DestroyRef).onDestroy(unregister);\n\n // Forward the Panel inputs into the shared context, but only when the consumer actually\n // sets them — so Accordion's context writes are never clobbered by the Panel defaults.\n effect(() => {\n const keepMounted = this.keepMounted();\n if (keepMounted !== undefined) {\n untracked(() => this.rootContext.keepMounted.set(keepMounted));\n }\n });\n\n effect(() => {\n const hiddenUntilFound = this.hiddenUntilFound();\n if (hiddenUntilFound !== undefined) {\n untracked(() => this.rootContext.hiddenUntilFound.set(hiddenUntilFound));\n }\n });\n\n // `afterRenderEffect` runs after the DOM is committed (but before paint) with the settled\n // `open` state — no `requestAnimationFrame` race — and is a no-op during SSR.\n afterRenderEffect(() => {\n // Re-measure whenever the open state flips; the panel is visible at that point (during\n // an exit it is kept rendered by the `ending` transition phase).\n this.rootContext.open();\n this.updateDimensions();\n });\n }\n\n private updateDimensions(): void {\n const node = this.elementRef.nativeElement;\n if (!node) return;\n\n this.originalStyles ??= {\n transitionDuration: node.style.transitionDuration,\n animationName: node.style.animationName\n };\n\n // Block any animation/transition so we can measure the element at its natural size.\n node.style.transitionDuration = '0s';\n node.style.animationName = 'none';\n\n // Let the element take its natural height while measuring, so a `height` bound to the very\n // variable we are computing (the Base UI collapse pattern) does not feed back into itself.\n const previousHeight = node.style.height;\n node.style.height = 'auto';\n\n const rect = node.getBoundingClientRect();\n this.height.set(rect.height);\n this.width.set(rect.width);\n\n node.style.height = previousHeight;\n\n // Re-enable the original animation, unless this is the very first (mount) measurement.\n if (!this.isFirstMeasure) {\n node.style.transitionDuration = this.originalStyles.transitionDuration;\n node.style.animationName = this.originalStyles.animationName;\n }\n\n this.isFirstMeasure = false;\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n/**\n * A button that opens and closes the collapsible panel.\n */\n@Directive({\n selector: '[rdxCollapsibleTrigger]',\n host: {\n '[attr.aria-controls]': 'rootContext.panelId()',\n '[attr.aria-expanded]': 'rootContext.open()',\n '[attr.data-panel-open]': 'rootContext.open() ? \"\" : undefined',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"\" : undefined',\n '[attr.disabled]': 'rootContext.disabled() || undefined',\n\n '(click)': 'rootContext.toggle()'\n }\n})\nexport class RdxCollapsibleTriggerDirective {\n protected readonly rootContext = injectCollapsibleRootContext();\n}\n","import { NgModule } from '@angular/core';\nimport { RdxCollapsiblePanelPresenceDirective } from './src/collapsible-panel-presence.directive';\nimport { RdxCollapsiblePanelDirective } from './src/collapsible-panel.directive';\nimport { RdxCollapsibleRootDirective } from './src/collapsible-root.directive';\nimport { RdxCollapsibleTriggerDirective } from './src/collapsible-trigger.directive';\n\nexport * from './src/collapsible-panel-presence.directive';\nexport * from './src/collapsible-panel.directive';\nexport * from './src/collapsible-root.directive';\nexport * from './src/collapsible-trigger.directive';\n\nconst _imports = [\n RdxCollapsiblePanelDirective,\n RdxCollapsibleRootDirective,\n RdxCollapsibleTriggerDirective,\n RdxCollapsiblePanelPresenceDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxCollapsibleModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AA8CO,MAAM,CAAC,4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A2B;YAC3B,8BAA8B;AAC9B,YAAA,oCAAoC,aAHpC,4BAA4B;YAC5B,2BAA2B;YAC3B,8BAA8B;YAC9B,oCAAoC,CAAA,EAAA,CAAA,CAAA;+GAO3B,oBAAoB,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;ACrBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"radix-ng-primitives-collapsible.mjs","sources":["../../../packages/primitives/collapsible/src/collapsible-root.directive.ts","../../../packages/primitives/collapsible/src/collapsible-panel.directive.ts","../../../packages/primitives/collapsible/src/collapsible-trigger.directive.ts","../../../packages/primitives/collapsible/index.ts","../../../packages/primitives/collapsible/radix-ng-primitives-collapsible.ts"],"sourcesContent":["import {\n booleanAttribute,\n computed,\n Directive,\n effect,\n inject,\n input,\n model,\n ModelSignal,\n output,\n signal,\n Signal,\n untracked,\n WritableSignal\n} from '@angular/core';\nimport {\n BooleanInput,\n createCancelableChangeEventDetails,\n createContext,\n injectId,\n RdxCancelableChangeEventDetails,\n RdxTransitionStatus,\n useTransitionStatus\n} from '@radix-ng/primitives/core';\n\nexport type RdxCollapsibleState = 'open' | 'closed';\nexport type RdxCollapsibleOpenChangeReason = 'trigger-press' | 'none';\nexport type RdxCollapsibleOpenChangeEventDetails = RdxCancelableChangeEventDetails<RdxCollapsibleOpenChangeReason>;\nexport interface RdxCollapsibleOpenChangeEvent {\n open: boolean;\n eventDetails: RdxCollapsibleOpenChangeEventDetails;\n}\n\nexport interface CollapsibleRootContext {\n /** Stable id linking the trigger's `aria-controls` to the panel. */\n panelId: Signal<string>;\n /** Writable so composing primitives (Accordion) can drive the state. */\n open: ModelSignal<boolean>;\n disabled: Signal<boolean>;\n /** Open/close transition phase, for `data-starting-style` / `data-ending-style`. */\n transitionStatus: Signal<RdxTransitionStatus>;\n /** `true` while the panel should stay rendered: open, or running its exit transition. */\n mounted: Signal<boolean>;\n /**\n * Composition fallbacks. The standalone Panel inputs write here, and Accordion writes here\n * directly; the Panel reads these so both wiring paths converge on a single source of truth.\n */\n keepMounted: WritableSignal<boolean>;\n hiddenUntilFound: WritableSignal<boolean>;\n toggle: (event: Event, trigger?: HTMLElement) => void;\n setOpen: (open: boolean, reason: RdxCollapsibleOpenChangeReason, event: Event, trigger?: HTMLElement) => boolean;\n setPanelIdState: (id: string | undefined) => void;\n /** Registers the panel element whose transition duration gates the close completion. */\n registerTransitionElement: (element: HTMLElement) => () => void;\n}\n\nexport const [injectCollapsibleRootContext, provideCollapsibleRootContext] = createContext<CollapsibleRootContext>(\n 'CollapsibleRootContext',\n 'components/collapsible'\n);\n\nconst rootContext = (): CollapsibleRootContext => {\n const instance = inject(RdxCollapsibleRootDirective);\n\n return {\n panelId: instance.resolvedPanelId,\n open: instance.open,\n disabled: instance.disabled,\n transitionStatus: instance.transitionStatus,\n mounted: instance.mounted,\n keepMounted: instance.keepMountedContext,\n hiddenUntilFound: instance.hiddenUntilFoundContext,\n setOpen: (open, reason, event, trigger) => instance.setOpen(open, reason, event, trigger),\n setPanelIdState: (id) => instance.setPanelIdState(id),\n registerTransitionElement: (element) => instance.registerTransitionElement(element),\n toggle: (event, trigger) => {\n if (instance.disabled()) {\n return;\n }\n\n instance.setOpen(!instance.open(), 'trigger-press', event, trigger);\n }\n };\n};\n\n/**\n * Groups all parts of the collapsible.\n *\n * @group Components\n */\n@Directive({\n selector: '[rdxCollapsibleRoot]',\n exportAs: 'rdxCollapsibleRoot',\n providers: [provideCollapsibleRootContext(rootContext)],\n host: {\n '[attr.data-open]': 'open() ? \"\" : undefined',\n '[attr.data-closed]': 'open() ? undefined : \"\"',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxCollapsibleRootDirective {\n private readonly transition = useTransitionStatus((open) => this.onOpenChangeComplete.emit(open));\n\n private readonly generatedPanelId = injectId('rdx-collapsible-panel-');\n private readonly panelIdState = signal<string | undefined>(undefined);\n\n /** Reactive open/close transition phase (`'starting'` | `'ending'` | `undefined`). */\n readonly transitionStatus = this.transition.status;\n\n /** Registers the panel element whose transition duration gates the close completion. */\n readonly registerTransitionElement = this.transition.registerElement;\n\n /**\n * The controlled open state of the collapsible.\n * `true` - expanded, `false` - collapsed.\n *\n * @group Props\n * @defaultValue false\n */\n readonly open = model<boolean>(false);\n\n /**\n * The open state of the collapsible when it is initially rendered.\n * Use when you do not need to control its open state.\n *\n * @group Props\n * @defaultValue false\n */\n readonly defaultOpen = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the component should ignore user interaction.\n *\n * @group Props\n * @defaultValue false\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Stable id linking the trigger's `aria-controls` to the panel. */\n readonly panelId = input<string | undefined>(undefined);\n\n /** Stable id linking the trigger's `aria-controls` to the panel. */\n readonly resolvedPanelId = computed(() => this.panelIdState() ?? this.panelId() ?? this.generatedPanelId);\n\n /** Composition fallbacks (see {@link CollapsibleRootContext}). Default `false`. */\n readonly keepMountedContext = signal(false);\n readonly hiddenUntilFoundContext = signal(false);\n\n /** `true` while the panel must stay rendered: open, or mid exit transition. */\n readonly mounted = computed(() => this.open() || this.transitionStatus() === 'ending');\n\n /**\n * Event handler called when the open state of the collapsible changes.\n *\n * @group Emits\n */\n readonly onOpenChange = output<RdxCollapsibleOpenChangeEvent>();\n\n /**\n * Event handler called after the open/close transition has finished.\n *\n * @group Emits\n */\n readonly onOpenChangeComplete = output<boolean>();\n\n private hasAppliedDefaultOpen = false;\n private previousOpen = this.open();\n\n setPanelIdState(id: string | undefined): void {\n this.panelIdState.set(id);\n }\n\n setOpen(nextOpen: boolean, reason: RdxCollapsibleOpenChangeReason, event: Event, trigger?: HTMLElement): boolean {\n if (nextOpen === this.open()) {\n return true;\n }\n\n const { eventDetails } = createCancelableChangeEventDetails(reason, event, trigger);\n\n this.onOpenChange.emit({ open: nextOpen, eventDetails });\n\n if (eventDetails.isCanceled()) {\n return false;\n }\n\n untracked(() => {\n this.open.set(nextOpen);\n });\n\n return true;\n }\n\n constructor() {\n effect(() => {\n const defaultOpen = this.defaultOpen();\n\n if (!this.hasAppliedDefaultOpen && defaultOpen) {\n this.hasAppliedDefaultOpen = true;\n untracked(() => {\n this.open.set(true);\n // Treat an initially-open collapsible as settled so it doesn't play an\n // enter transition on first render.\n this.previousOpen = true;\n });\n }\n });\n\n effect(() => {\n const open = this.open();\n\n if (open !== this.previousOpen) {\n this.previousOpen = open;\n untracked(() => this.transition.start(open));\n }\n });\n }\n}\n","import {\n afterRenderEffect,\n booleanAttribute,\n computed,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n Renderer2,\n signal,\n untracked\n} from '@angular/core';\nimport { BooleanInput } from '@radix-ng/primitives/core';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n/**\n * Coerces a collapsible boolean input that distinguishes \"not set\" (`undefined`) from `false`,\n * so the Panel only overrides the shared context value when the consumer passes the input.\n */\nconst optionalBoolean = (value: BooleanInput | undefined): boolean | undefined =>\n value === undefined ? undefined : booleanAttribute(value);\n\n/**\n * A panel with the collapsible contents.\n */\n@Directive({\n selector: '[rdxCollapsiblePanel]',\n host: {\n '[id]': 'rootContext.panelId()',\n '[attr.data-open]': 'rootContext.open() ? \"\" : undefined',\n '[attr.data-closed]': 'rootContext.open() ? undefined : \"\"',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"\" : undefined',\n '[attr.data-starting-style]': 'rootContext.transitionStatus() === \"starting\" ? \"\" : undefined',\n '[attr.data-ending-style]': 'rootContext.transitionStatus() === \"ending\" ? \"\" : undefined',\n '[attr.hidden]': 'hidden()',\n '[style.--collapsible-panel-width.px]': 'width()',\n '[style.--collapsible-panel-height.px]': 'height()'\n }\n})\nexport class RdxCollapsiblePanelDirective {\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly renderer = inject(Renderer2);\n private readonly destroyRef = inject(DestroyRef);\n private readonly marker = this.renderer.createComment('rdx-collapsible-panel');\n\n private parentNode: Node | null = null;\n private isAttached = true;\n\n protected readonly rootContext = injectCollapsibleRootContext();\n\n /**\n * Optional explicit panel id. When set, the trigger's `aria-controls` points to this id.\n *\n * @group Props\n */\n readonly id = input<string | undefined>(undefined, { alias: 'id' });\n\n /**\n * Whether to keep the element in the DOM while the panel is closed.\n * When `true`, the closed panel keeps its element and receives the `hidden` attribute once the\n * close transition finishes.\n *\n * @group Props\n * @defaultValue false\n */\n readonly keepMounted = input<boolean | undefined, BooleanInput | undefined>(undefined, {\n transform: optionalBoolean\n });\n\n /**\n * Allows the browser's built-in page search to find and expand the panel contents.\n * When `true`, the closed panel uses `hidden=\"until-found\"` instead of plain `hidden`.\n *\n * @group Props\n * @defaultValue false\n */\n readonly hiddenUntilFound = input<boolean | undefined, BooleanInput | undefined>(undefined, {\n transform: optionalBoolean\n });\n\n readonly height = signal<number | null>(null);\n readonly width = signal<number | null>(null);\n\n /** Mirrors Base UI's `shouldRender`: hidden panels unmount unless kept for search/measurement. */\n readonly shouldRender = computed(\n () =>\n this.rootContext.keepMounted() ||\n this.rootContext.hiddenUntilFound() ||\n this.rootContext.mounted() ||\n this.rootContext.open()\n );\n\n /**\n * The `hidden` attribute value. The panel is shown while open or while its exit transition runs.\n * A kept-mounted panel remains in the DOM but is still hidden while closed.\n */\n readonly hidden = computed<'' | 'until-found' | undefined>(() => {\n const visible = this.rootContext.open() || this.rootContext.transitionStatus() === 'ending';\n\n if (visible) {\n return undefined;\n }\n\n return this.rootContext.hiddenUntilFound() ? 'until-found' : '';\n });\n\n /**\n * The first measurement (the initial mount) must not re-enable animations, so an element that\n * mounts already open renders at its final size without playing the open animation.\n */\n private isFirstMeasure = true;\n private originalStyles?: { transitionDuration: string; animationName: string };\n\n constructor() {\n const unregister = this.rootContext.registerTransitionElement(this.elementRef.nativeElement);\n this.destroyRef.onDestroy(unregister);\n\n this.insertMarker();\n\n const unlistenBeforeMatch = this.renderer.listen(\n this.elementRef.nativeElement,\n 'beforematch',\n (event: Event) => {\n this.rootContext.setOpen(true, 'none', event);\n }\n );\n\n this.destroyRef.onDestroy(() => {\n unlistenBeforeMatch();\n this.removeMarker();\n });\n\n effect(() => {\n this.rootContext.setPanelIdState(this.id());\n });\n\n this.destroyRef.onDestroy(() => {\n this.rootContext.setPanelIdState(undefined);\n });\n\n effect(() => {\n this.syncRenderedState();\n });\n\n // Forward the Panel inputs into the shared context, but only when the consumer actually\n // sets them — so Accordion's context writes are never clobbered by the Panel defaults.\n effect(() => {\n const keepMounted = this.keepMounted();\n if (keepMounted !== undefined) {\n untracked(() => this.rootContext.keepMounted.set(keepMounted));\n }\n });\n\n effect(() => {\n const hiddenUntilFound = this.hiddenUntilFound();\n if (hiddenUntilFound !== undefined) {\n untracked(() => this.rootContext.hiddenUntilFound.set(hiddenUntilFound));\n }\n });\n\n // `afterRenderEffect` runs after the DOM is committed (but before paint) with the settled\n // `open` state — no `requestAnimationFrame` race — and is a no-op during SSR.\n afterRenderEffect(() => {\n // Re-measure whenever the open state flips; the panel is visible at that point (during\n // an exit it is kept rendered by the `ending` transition phase).\n this.rootContext.open();\n this.updateDimensions();\n });\n }\n\n private insertMarker(): void {\n const host = this.elementRef.nativeElement;\n const parent = this.renderer.parentNode(host) as Node | null;\n\n if (!parent) {\n return;\n }\n\n this.parentNode = parent;\n this.renderer.insertBefore(parent, this.marker, host);\n }\n\n private removeMarker(): void {\n const parent = this.renderer.parentNode(this.marker) as Node | null;\n\n if (parent) {\n this.renderer.removeChild(parent, this.marker);\n }\n }\n\n private syncRenderedState(): void {\n const parent = this.parentNode;\n\n if (!parent) {\n return;\n }\n\n const host = this.elementRef.nativeElement;\n const shouldRender = this.shouldRender();\n\n if (shouldRender && !this.isAttached) {\n this.renderer.insertBefore(parent, host, this.renderer.nextSibling(this.marker));\n this.isAttached = true;\n return;\n }\n\n if (!shouldRender && this.isAttached) {\n this.renderer.removeChild(parent, host);\n this.isAttached = false;\n }\n }\n\n private updateDimensions(): void {\n const node = this.elementRef.nativeElement;\n if (!node) return;\n\n this.originalStyles ??= {\n transitionDuration: node.style.transitionDuration,\n animationName: node.style.animationName\n };\n\n // Block any animation/transition so we can measure the element at its natural size.\n node.style.transitionDuration = '0s';\n node.style.animationName = 'none';\n\n // Let the element take its natural height while measuring, so a `height` bound to the very\n // variable we are computing (the Base UI collapse pattern) does not feed back into itself.\n const previousHeight = node.style.height;\n node.style.height = 'auto';\n\n const rect = node.getBoundingClientRect();\n this.height.set(rect.height);\n this.width.set(rect.width);\n\n node.style.height = previousHeight;\n\n // Re-enable the original animation, unless this is the very first (mount) measurement.\n if (!this.isFirstMeasure) {\n node.style.transitionDuration = this.originalStyles.transitionDuration;\n node.style.animationName = this.originalStyles.animationName;\n }\n\n this.isFirstMeasure = false;\n }\n}\n","import { Directive, ElementRef, inject } from '@angular/core';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n/**\n * A button that opens and closes the collapsible panel.\n */\n@Directive({\n selector: '[rdxCollapsibleTrigger]',\n host: {\n '[attr.aria-controls]': 'rootContext.open() ? rootContext.panelId() : undefined',\n '[attr.aria-expanded]': 'rootContext.open()',\n '[attr.data-panel-open]': 'rootContext.open() ? \"\" : undefined',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"\" : undefined',\n '[attr.aria-disabled]': 'rootContext.disabled() ? \"true\" : undefined',\n\n '(click)': 'handleClick($event)'\n }\n})\nexport class RdxCollapsibleTriggerDirective {\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n protected readonly rootContext = injectCollapsibleRootContext();\n\n protected handleClick(event: MouseEvent): void {\n this.rootContext.toggle(event, this.elementRef.nativeElement);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RdxCollapsiblePanelDirective } from './src/collapsible-panel.directive';\nimport { RdxCollapsibleRootDirective } from './src/collapsible-root.directive';\nimport { RdxCollapsibleTriggerDirective } from './src/collapsible-trigger.directive';\n\nexport * from './src/collapsible-panel.directive';\nexport * from './src/collapsible-root.directive';\nexport * from './src/collapsible-trigger.directive';\n\nconst _imports = [RdxCollapsiblePanelDirective, RdxCollapsibleRootDirective, RdxCollapsibleTriggerDirective];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxCollapsibleModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAwDO,MAAM,CAAC,4BAA4B,EAAE,6BAA6B,CAAC,GAAG,aAAa,CACtF,wBAAwB,EACxB,wBAAwB;AAG5B,MAAM,WAAW,GAAG,MAA6B;AAC7C,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,2BAA2B,CAAC;IAEpD,OAAO;QACH,OAAO,EAAE,QAAQ,CAAC,eAAe;QACjC,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;QAC3C,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,WAAW,EAAE,QAAQ,CAAC,kBAAkB;QACxC,gBAAgB,EAAE,QAAQ,CAAC,uBAAuB;QAClD,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC;QACzF,eAAe,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;QACrD,yBAAyB,EAAE,CAAC,OAAO,KAAK,QAAQ,CAAC,yBAAyB,CAAC,OAAO,CAAC;AACnF,QAAA,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAI;AACvB,YAAA,IAAI,QAAQ,CAAC,QAAQ,EA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;AACxB,iBAAA;;;ACdD;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, signal,
|
|
2
|
+
import { inject, ElementRef, signal, output, computed, effect, Directive, input, linkedSignal, afterNextRender, untracked, booleanAttribute, model, NgModule } from '@angular/core';
|
|
3
3
|
import { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, HOME, END, createContext } from '@radix-ng/primitives/core';
|
|
4
4
|
import { injectDirection } from '@radix-ng/primitives/direction-provider';
|
|
5
5
|
|
|
@@ -190,6 +190,111 @@ function getScrollStyles(element) {
|
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
const listContext = () => {
|
|
194
|
+
const list = inject(RdxCompositeList);
|
|
195
|
+
return {
|
|
196
|
+
listElement: list.elementRef.nativeElement,
|
|
197
|
+
items: list.items,
|
|
198
|
+
itemMap: list.itemMap,
|
|
199
|
+
registerItem: (item) => list.registerItem(item),
|
|
200
|
+
indexOf: (element) => list.indexOf(element)
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
const [injectRdxCompositeListContext, provideRdxCompositeListContext] = createContext('RdxCompositeListContext', 'utils/composite');
|
|
204
|
+
/**
|
|
205
|
+
* Base UI-style composite list. Owns item registration and DOM-order metadata without applying
|
|
206
|
+
* roving tabindex or keyboard navigation.
|
|
207
|
+
*/
|
|
208
|
+
class RdxCompositeList {
|
|
209
|
+
constructor() {
|
|
210
|
+
this.elementRef = inject(ElementRef);
|
|
211
|
+
this.registeredItems = signal([], ...(ngDevMode ? [{ debugName: "registeredItems" }] : /* istanbul ignore next */ []));
|
|
212
|
+
/** Emits when the ordered item map changes. */
|
|
213
|
+
this.onMapChange = output();
|
|
214
|
+
/** Items registered with this list, sorted in DOM order. */
|
|
215
|
+
this.items = computed(() => sortByDocumentPosition(this.registeredItems()), ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
216
|
+
/** Ordered metadata keyed by item element. */
|
|
217
|
+
this.itemMap = computed(() => {
|
|
218
|
+
const map = new Map();
|
|
219
|
+
this.items().forEach((item, index) => {
|
|
220
|
+
map.set(item.element, { ...(item.metadata() ?? {}), index });
|
|
221
|
+
});
|
|
222
|
+
return map;
|
|
223
|
+
}, ...(ngDevMode ? [{ debugName: "itemMap" }] : /* istanbul ignore next */ []));
|
|
224
|
+
effect(() => {
|
|
225
|
+
this.onMapChange.emit(this.itemMap());
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
registerItem(item) {
|
|
229
|
+
this.registeredItems.update((items) => [
|
|
230
|
+
...items.filter((registered) => registered.element !== item.element),
|
|
231
|
+
item
|
|
232
|
+
]);
|
|
233
|
+
return () => {
|
|
234
|
+
this.registeredItems.update((items) => items.filter((registered) => registered.element !== item.element));
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
indexOf(element) {
|
|
238
|
+
return this.items().findIndex((item) => item.element === element);
|
|
239
|
+
}
|
|
240
|
+
elements() {
|
|
241
|
+
return this.items().map((item) => item.element);
|
|
242
|
+
}
|
|
243
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeList, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
244
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxCompositeList, isStandalone: true, selector: "[rdxCompositeList]", outputs: { onMapChange: "onMapChange" }, providers: [provideRdxCompositeListContext(listContext)], exportAs: ["rdxCompositeList"], ngImport: i0 }); }
|
|
245
|
+
}
|
|
246
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeList, decorators: [{
|
|
247
|
+
type: Directive,
|
|
248
|
+
args: [{
|
|
249
|
+
selector: '[rdxCompositeList]',
|
|
250
|
+
exportAs: 'rdxCompositeList',
|
|
251
|
+
providers: [provideRdxCompositeListContext(listContext)]
|
|
252
|
+
}]
|
|
253
|
+
}], ctorParameters: () => [], propDecorators: { onMapChange: [{ type: i0.Output, args: ["onMapChange"] }] } });
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Registers the host with the nearest composite list without changing focus behavior.
|
|
257
|
+
*/
|
|
258
|
+
class RdxCompositeListItem {
|
|
259
|
+
constructor() {
|
|
260
|
+
this.listContext = injectRdxCompositeListContext(true);
|
|
261
|
+
this.elementRef = inject(ElementRef);
|
|
262
|
+
this.hasRendered = signal(false, ...(ngDevMode ? [{ debugName: "hasRendered" }] : /* istanbul ignore next */ []));
|
|
263
|
+
/** Arbitrary metadata included in the list's ordered item map. */
|
|
264
|
+
this.metadataInput = input(undefined, { ...(ngDevMode ? { debugName: "metadataInput" } : /* istanbul ignore next */ {}), alias: 'metadata' });
|
|
265
|
+
this._metadata = linkedSignal(() => this.metadataInput(), ...(ngDevMode ? [{ debugName: "_metadata" }] : /* istanbul ignore next */ []));
|
|
266
|
+
this.index = computed(() => this.listContext?.indexOf(this.elementRef.nativeElement) ?? -1, ...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
|
|
267
|
+
this.inListElement = computed(() => {
|
|
268
|
+
const listContext = this.listContext;
|
|
269
|
+
return !!listContext && listContext.listElement.contains(this.elementRef.nativeElement);
|
|
270
|
+
}, ...(ngDevMode ? [{ debugName: "inListElement" }] : /* istanbul ignore next */ []));
|
|
271
|
+
afterNextRender(() => {
|
|
272
|
+
this.hasRendered.set(true);
|
|
273
|
+
});
|
|
274
|
+
effect((onCleanup) => {
|
|
275
|
+
const listContext = this.listContext;
|
|
276
|
+
if (!listContext || !this.hasRendered() || !this.inListElement()) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const element = this.elementRef.nativeElement;
|
|
280
|
+
const unregister = untracked(() => listContext.registerItem({ element, metadata: this._metadata.asReadonly() }));
|
|
281
|
+
onCleanup(unregister);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
setMetadata(value) {
|
|
285
|
+
this._metadata.set(value);
|
|
286
|
+
}
|
|
287
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeListItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
288
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxCompositeListItem, isStandalone: true, selector: "[rdxCompositeListItem]", inputs: { metadataInput: { classPropertyName: "metadataInput", publicName: "metadata", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["rdxCompositeListItem"], ngImport: i0 }); }
|
|
289
|
+
}
|
|
290
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeListItem, decorators: [{
|
|
291
|
+
type: Directive,
|
|
292
|
+
args: [{
|
|
293
|
+
selector: '[rdxCompositeListItem]',
|
|
294
|
+
exportAs: 'rdxCompositeListItem'
|
|
295
|
+
}]
|
|
296
|
+
}], ctorParameters: () => [], propDecorators: { metadataInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "metadata", required: false }] }] } });
|
|
297
|
+
|
|
193
298
|
const rootContext = () => {
|
|
194
299
|
const root = inject(RdxCompositeRoot);
|
|
195
300
|
return {
|
|
@@ -198,8 +303,6 @@ const rootContext = () => {
|
|
|
198
303
|
highlightItemOnHover: root.highlightItemOnHover,
|
|
199
304
|
orientation: root.orientation,
|
|
200
305
|
dir: root.dir,
|
|
201
|
-
registerItem: (item) => root.registerItem(item),
|
|
202
|
-
indexOf: (element) => root.indexOf(element),
|
|
203
306
|
isIndexDisabled: (index) => root.isIndexDisabled(index),
|
|
204
307
|
setHighlightedIndex: (index, shouldScrollIntoView) => root.setHighlightedIndex(index, shouldScrollIntoView),
|
|
205
308
|
relayKeyboardEvent: (event) => root.relayKeyboardEvent(event)
|
|
@@ -212,7 +315,7 @@ const [injectRdxCompositeRootContext, provideRdxCompositeRootContext] = createCo
|
|
|
212
315
|
class RdxCompositeRoot {
|
|
213
316
|
constructor() {
|
|
214
317
|
this.elementRef = inject(ElementRef);
|
|
215
|
-
this.
|
|
318
|
+
this.compositeList = inject(RdxCompositeList, { self: true });
|
|
216
319
|
this.hasSetInitialIndex = false;
|
|
217
320
|
/** The composite orientation. */
|
|
218
321
|
this.orientationInput = input('both', { ...(ngDevMode ? { debugName: "orientationInput" } : /* istanbul ignore next */ {}), alias: 'orientation' });
|
|
@@ -251,14 +354,8 @@ class RdxCompositeRoot {
|
|
|
251
354
|
this.onHighlightedIndexChange = output();
|
|
252
355
|
/** Emits when the ordered item map changes. */
|
|
253
356
|
this.onMapChange = output();
|
|
254
|
-
this.items =
|
|
255
|
-
this.itemMap =
|
|
256
|
-
const map = new Map();
|
|
257
|
-
this.items().forEach((item, index) => {
|
|
258
|
-
map.set(item.element, { ...(item.metadata() ?? {}), index });
|
|
259
|
-
});
|
|
260
|
-
return map;
|
|
261
|
-
}, ...(ngDevMode ? [{ debugName: "itemMap" }] : /* istanbul ignore next */ []));
|
|
357
|
+
this.items = this.compositeList.items;
|
|
358
|
+
this.itemMap = this.compositeList.itemMap;
|
|
262
359
|
effect(() => {
|
|
263
360
|
const items = this.items();
|
|
264
361
|
if (items.length === 0) {
|
|
@@ -283,17 +380,8 @@ class RdxCompositeRoot {
|
|
|
283
380
|
this.onMapChange.emit(this.itemMap());
|
|
284
381
|
});
|
|
285
382
|
}
|
|
286
|
-
registerItem(item) {
|
|
287
|
-
this.registeredItems.update((items) => [
|
|
288
|
-
...items.filter((registered) => registered.element !== item.element),
|
|
289
|
-
item
|
|
290
|
-
]);
|
|
291
|
-
return () => {
|
|
292
|
-
this.registeredItems.update((items) => items.filter((registered) => registered.element !== item.element));
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
383
|
indexOf(element) {
|
|
296
|
-
return this.
|
|
384
|
+
return this.compositeList.indexOf(element);
|
|
297
385
|
}
|
|
298
386
|
setOrientation(value) {
|
|
299
387
|
this._orientation.set(value);
|
|
@@ -402,16 +490,17 @@ class RdxCompositeRoot {
|
|
|
402
490
|
});
|
|
403
491
|
}
|
|
404
492
|
elements() {
|
|
405
|
-
return this.
|
|
493
|
+
return this.compositeList.elements();
|
|
406
494
|
}
|
|
407
495
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
408
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxCompositeRoot, isStandalone: true, selector: "[rdxCompositeRoot]", inputs: { orientationInput: { classPropertyName: "orientationInput", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, dirInput: { classPropertyName: "dirInput", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, loopFocusInput: { classPropertyName: "loopFocusInput", publicName: "loopFocus", isSignal: true, isRequired: false, transformFunction: null }, enableHomeAndEndKeysInput: { classPropertyName: "enableHomeAndEndKeysInput", publicName: "enableHomeAndEndKeys", isSignal: true, isRequired: false, transformFunction: null }, disabledIndicesInput: { classPropertyName: "disabledIndicesInput", publicName: "disabledIndices", isSignal: true, isRequired: false, transformFunction: null }, modifierKeysInput: { classPropertyName: "modifierKeysInput", publicName: "modifierKeys", isSignal: true, isRequired: false, transformFunction: null }, highlightItemOnHover: { classPropertyName: "highlightItemOnHover", publicName: "highlightItemOnHover", isSignal: true, isRequired: false, transformFunction: null }, stopEventPropagation: { classPropertyName: "stopEventPropagation", publicName: "stopEventPropagation", isSignal: true, isRequired: false, transformFunction: null }, highlightedIndex: { classPropertyName: "highlightedIndex", publicName: "highlightedIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { highlightedIndex: "highlightedIndexChange", onHighlightedIndexChange: "onHighlightedIndexChange", onMapChange: "onMapChange" }, host: { listeners: { "keydown": "handleKeydown($event)" } }, providers: [provideRdxCompositeRootContext(rootContext)], exportAs: ["rdxCompositeRoot"], ngImport: i0 }); }
|
|
496
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxCompositeRoot, isStandalone: true, selector: "[rdxCompositeRoot]", inputs: { orientationInput: { classPropertyName: "orientationInput", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, dirInput: { classPropertyName: "dirInput", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, loopFocusInput: { classPropertyName: "loopFocusInput", publicName: "loopFocus", isSignal: true, isRequired: false, transformFunction: null }, enableHomeAndEndKeysInput: { classPropertyName: "enableHomeAndEndKeysInput", publicName: "enableHomeAndEndKeys", isSignal: true, isRequired: false, transformFunction: null }, disabledIndicesInput: { classPropertyName: "disabledIndicesInput", publicName: "disabledIndices", isSignal: true, isRequired: false, transformFunction: null }, modifierKeysInput: { classPropertyName: "modifierKeysInput", publicName: "modifierKeys", isSignal: true, isRequired: false, transformFunction: null }, highlightItemOnHover: { classPropertyName: "highlightItemOnHover", publicName: "highlightItemOnHover", isSignal: true, isRequired: false, transformFunction: null }, stopEventPropagation: { classPropertyName: "stopEventPropagation", publicName: "stopEventPropagation", isSignal: true, isRequired: false, transformFunction: null }, highlightedIndex: { classPropertyName: "highlightedIndex", publicName: "highlightedIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { highlightedIndex: "highlightedIndexChange", onHighlightedIndexChange: "onHighlightedIndexChange", onMapChange: "onMapChange" }, host: { listeners: { "keydown": "handleKeydown($event)" } }, providers: [provideRdxCompositeRootContext(rootContext)], exportAs: ["rdxCompositeRoot"], hostDirectives: [{ directive: RdxCompositeList }], ngImport: i0 }); }
|
|
409
497
|
}
|
|
410
498
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeRoot, decorators: [{
|
|
411
499
|
type: Directive,
|
|
412
500
|
args: [{
|
|
413
501
|
selector: '[rdxCompositeRoot]',
|
|
414
502
|
exportAs: 'rdxCompositeRoot',
|
|
503
|
+
hostDirectives: [RdxCompositeList],
|
|
415
504
|
providers: [provideRdxCompositeRootContext(rootContext)],
|
|
416
505
|
host: {
|
|
417
506
|
'(keydown)': 'handleKeydown($event)'
|
|
@@ -426,11 +515,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
426
515
|
class RdxCompositeItem {
|
|
427
516
|
constructor() {
|
|
428
517
|
this.rootContext = injectRdxCompositeRootContext(true);
|
|
518
|
+
this.listItem = inject(RdxCompositeListItem, { self: true });
|
|
429
519
|
this.elementRef = inject(ElementRef);
|
|
430
|
-
|
|
431
|
-
this.metadataInput = input(undefined, { ...(ngDevMode ? { debugName: "metadataInput" } : /* istanbul ignore next */ {}), alias: 'metadata' });
|
|
432
|
-
this._metadata = linkedSignal(() => this.metadataInput(), ...(ngDevMode ? [{ debugName: "_metadata" }] : /* istanbul ignore next */ []));
|
|
433
|
-
this.index = computed(() => this.rootContext?.indexOf(this.elementRef.nativeElement) ?? -1, ...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
|
|
520
|
+
this.index = this.listItem.index;
|
|
434
521
|
this.inRootElement = computed(() => {
|
|
435
522
|
const rootContext = this.rootContext;
|
|
436
523
|
return !!rootContext && rootContext.rootElement.contains(this.elementRef.nativeElement);
|
|
@@ -444,18 +531,9 @@ class RdxCompositeItem {
|
|
|
444
531
|
const index = this.index();
|
|
445
532
|
return index !== -1 && rootContext.highlightedIndex() === index && !rootContext.isIndexDisabled(index) ? 0 : -1;
|
|
446
533
|
}, ...(ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []));
|
|
447
|
-
effect((onCleanup) => {
|
|
448
|
-
const rootContext = this.rootContext;
|
|
449
|
-
if (!rootContext || !this.inRootElement()) {
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
const element = this.elementRef.nativeElement;
|
|
453
|
-
const unregister = untracked(() => rootContext.registerItem({ element, metadata: this._metadata.asReadonly() }));
|
|
454
|
-
onCleanup(unregister);
|
|
455
|
-
});
|
|
456
534
|
}
|
|
457
535
|
setMetadata(value) {
|
|
458
|
-
this.
|
|
536
|
+
this.listItem.setMetadata(value);
|
|
459
537
|
}
|
|
460
538
|
handleFocus() {
|
|
461
539
|
const index = this.index();
|
|
@@ -478,25 +556,31 @@ class RdxCompositeItem {
|
|
|
478
556
|
}
|
|
479
557
|
}
|
|
480
558
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
481
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
559
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxCompositeItem, isStandalone: true, selector: "[rdxCompositeItem]", host: { listeners: { "focus": "handleFocus()", "mousemove": "handleMouseMove()" }, properties: { "attr.tabindex": "tabIndex()" } }, exportAs: ["rdxCompositeItem"], hostDirectives: [{ directive: RdxCompositeListItem, inputs: ["metadata", "metadata"] }], ngImport: i0 }); }
|
|
482
560
|
}
|
|
483
561
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeItem, decorators: [{
|
|
484
562
|
type: Directive,
|
|
485
563
|
args: [{
|
|
486
564
|
selector: '[rdxCompositeItem]',
|
|
487
565
|
exportAs: 'rdxCompositeItem',
|
|
566
|
+
hostDirectives: [
|
|
567
|
+
{
|
|
568
|
+
directive: RdxCompositeListItem,
|
|
569
|
+
inputs: ['metadata']
|
|
570
|
+
}
|
|
571
|
+
],
|
|
488
572
|
host: {
|
|
489
573
|
'[attr.tabindex]': 'tabIndex()',
|
|
490
574
|
'(focus)': 'handleFocus()',
|
|
491
575
|
'(mousemove)': 'handleMouseMove()'
|
|
492
576
|
}
|
|
493
577
|
}]
|
|
494
|
-
}]
|
|
578
|
+
}] });
|
|
495
579
|
|
|
496
|
-
const compositeImports = [RdxCompositeRoot, RdxCompositeItem];
|
|
580
|
+
const compositeImports = [RdxCompositeList, RdxCompositeListItem, RdxCompositeRoot, RdxCompositeItem];
|
|
497
581
|
class RdxCompositeModule {
|
|
498
582
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
499
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeModule, imports: [RdxCompositeRoot, RdxCompositeItem], exports: [RdxCompositeRoot, RdxCompositeItem] }); }
|
|
583
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeModule, imports: [RdxCompositeList, RdxCompositeListItem, RdxCompositeRoot, RdxCompositeItem], exports: [RdxCompositeList, RdxCompositeListItem, RdxCompositeRoot, RdxCompositeItem] }); }
|
|
500
584
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeModule }); }
|
|
501
585
|
}
|
|
502
586
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCompositeModule, decorators: [{
|
|
@@ -511,5 +595,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
511
595
|
* Generated bundle index. Do not edit.
|
|
512
596
|
*/
|
|
513
597
|
|
|
514
|
-
export { ACTIVE_COMPOSITE_ITEM, ARROW_KEYS, COMPOSITE_KEYS, MODIFIER_KEYS, RdxCompositeItem, RdxCompositeModule, RdxCompositeRoot, compositeImports, findNonDisabledListIndex, getCompositeNavigationKeys, getMaxListIndex, getMinListIndex, injectRdxCompositeRootContext, isElementDisabled, isElementVisible, isIndexOutOfListBounds, isListIndexDisabled, isModifierKeySet, isNativeTextInput, provideRdxCompositeRootContext, scrollIntoViewIfNeeded, shouldKeepNativeTextInputBehavior, sortByDocumentPosition };
|
|
598
|
+
export { ACTIVE_COMPOSITE_ITEM, ARROW_KEYS, COMPOSITE_KEYS, MODIFIER_KEYS, RdxCompositeItem, RdxCompositeList, RdxCompositeListItem, RdxCompositeModule, RdxCompositeRoot, compositeImports, findNonDisabledListIndex, getCompositeNavigationKeys, getMaxListIndex, getMinListIndex, injectRdxCompositeListContext, injectRdxCompositeRootContext, isElementDisabled, isElementVisible, isIndexOutOfListBounds, isListIndexDisabled, isModifierKeySet, isNativeTextInput, provideRdxCompositeListContext, provideRdxCompositeRootContext, scrollIntoViewIfNeeded, shouldKeepNativeTextInputBehavior, sortByDocumentPosition };
|
|
515
599
|
//# sourceMappingURL=radix-ng-primitives-composite.mjs.map
|