@radix-ng/primitives 1.0.2 → 1.0.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-checkbox.mjs","sources":["../../../packages/primitives/checkbox/src/checkbox-group.ts","../../../packages/primitives/checkbox/src/checkbox-root.ts","../../../packages/primitives/checkbox/src/checkbox-button.ts","../../../packages/primitives/checkbox/src/checkbox-indicator.ts","../../../packages/primitives/checkbox/src/checkbox-input.ts","../../../packages/primitives/checkbox/index.ts","../../../packages/primitives/checkbox/radix-ng-primitives-checkbox.ts"],"sourcesContent":["import {\n booleanAttribute,\n computed,\n Directive,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n Signal\n} from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport {\n BooleanInput,\n createCancelableChangeEventDetails,\n createContext,\n provideValueAccessor,\n RdxCancelableChangeEventDetails\n} from '@radix-ng/primitives/core';\nimport type { CheckedState } from './checkbox-root';\n\nexport type RdxCheckboxGroupValueChangeReason = 'none';\nexport type RdxCheckboxGroupValueChangeEventDetails =\n RdxCancelableChangeEventDetails<RdxCheckboxGroupValueChangeReason>;\n\nexport interface RdxCheckboxGroupValueChangeEvent {\n value: string[];\n eventDetails: RdxCheckboxGroupValueChangeEventDetails;\n}\n\nexport interface RdxCheckboxGroupContext {\n /** The names of the currently checked checkboxes. */\n value: Signal<string[]>;\n /** All checkbox names, used by a `parent` checkbox to check/uncheck every child. */\n allValues: Signal<string[]>;\n /** Whether the whole group is disabled. */\n disabled: Signal<boolean>;\n /** The derived state of a `parent` checkbox: all / none / some checked. */\n parentState: Signal<CheckedState>;\n /** The space-separated control ids the `parent` checkbox controls (for `aria-controls`). */\n controlledIds: Signal<string | undefined>;\n /** A stable id for a child's control element, derived from the group id and the child name. */\n controlId: (name: string) => string;\n /** Toggle a single child by name. */\n toggleValue: (name: string, event?: Event) => void;\n /** Toggle every child on or off (used by a `parent` checkbox). */\n toggleAll: (event?: Event) => void;\n /** Register a child's name and disabled state so the parent can preserve disabled items. */\n registerChild: (name: string, disabled: Signal<boolean>) => () => void;\n /** Register a child's control element id so the parent can reference it via `aria-controls`. */\n registerControl: (name: string, id: string) => () => void;\n}\n\nexport const [injectCheckboxGroupContext, provideCheckboxGroupContext] = createContext<RdxCheckboxGroupContext>(\n 'CheckboxGroupContext',\n 'components/checkbox'\n);\n\nconst groupContext = (): RdxCheckboxGroupContext => {\n const group = inject(RdxCheckboxGroupDirective);\n return {\n value: group.value,\n allValues: group.allValues,\n disabled: group.disabledState,\n parentState: group.parentState,\n controlledIds: group.controlledIds,\n controlId: (name) => group.controlId(name),\n toggleValue: (name, event) => group.toggleValue(name, event),\n toggleAll: (event) => group.toggleAll(event),\n registerChild: (name, disabled) => group.registerChild(name, disabled),\n registerControl: (name, id) => group.registerControl(name, id)\n };\n};\n\nlet nextCheckboxGroupId = 0;\n\n/**\n * Groups a set of checkboxes that share a single array value (the names of the checked boxes).\n *\n * Each child `rdxCheckboxRoot` participates by its `name`. A child marked `parent` becomes a\n * \"select all\" checkbox whose state is derived from `allValues`.\n */\n@Directive({\n selector: '[rdxCheckboxGroup]',\n exportAs: 'rdxCheckboxGroup',\n providers: [provideValueAccessor(RdxCheckboxGroupDirective), provideCheckboxGroupContext(groupContext)],\n host: {\n role: 'group',\n '[attr.data-disabled]': 'disabledState() ? \"\" : undefined'\n }\n})\nexport class RdxCheckboxGroupDirective implements ControlValueAccessor {\n /** The names of the currently checked checkboxes. Use with `onValueChange` or `[(value)]`. */\n readonly value = model<string[]>([]);\n\n /** The names checked initially when the group is uncontrolled. */\n readonly defaultValue = input<string[]>();\n\n /** All checkbox names in the group. Required for a `parent` (select-all) checkbox. */\n readonly allValues = input<string[]>([]);\n\n /** Whether the whole group is disabled. */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Emits the new array of checked names whenever the value changes. */\n readonly onValueChange = output<RdxCheckboxGroupValueChangeEvent>();\n\n private readonly disabledByCva = signal(false);\n readonly disabledState = computed(() => this.disabledByCva() || this.disabled());\n\n /** Derived state for a `parent` checkbox: `true` (all), `false` (none) or `'indeterminate'`. */\n readonly parentState = computed<CheckedState>(() => {\n const total = this.allValues().length;\n const count = this.value().length;\n if (total > 0 && count === total) {\n return true;\n }\n return count > 0 ? 'indeterminate' : false;\n });\n\n /**\n * The value as last set directly by a child (or the initial value) — the \"remembered\" partial\n * selection that a `parent` checkbox cycles back to, mirroring Base UI's `uncontrolledStateRef`.\n */\n private uncontrolledState: string[] = [];\n private seeded = false;\n /** Where the parent is in its mixed → on → off cycle. Reset to `mixed` on any direct child change. */\n private parentStatus: 'on' | 'off' | 'mixed' = 'mixed';\n /** Per-name disabled signals, so the parent can preserve disabled-but-checked children. */\n private readonly disabledByName = new Map<string, Signal<boolean>>();\n\n /** Stable group id used to derive child control ids when the consumer sets none. */\n private readonly elementId = `rdx-checkbox-group-${nextCheckboxGroupId++}`;\n /** Registered control element ids, keyed by child name. */\n private readonly controlIds = signal<Record<string, string>>({});\n\n /** The space-separated control ids in `allValues` order, for the parent's `aria-controls`. */\n readonly controlledIds = computed<string | undefined>(() => {\n const ids = this.controlIds();\n const list = this.allValues()\n .map((name) => ids[name])\n .filter((id): id is string => id !== undefined);\n return list.length > 0 ? list.join(' ') : undefined;\n });\n\n private hasAppliedDefault = false;\n private onChange: (value: string[]) => void = () => {\n /* Empty */\n };\n onTouched: () => void = () => {\n /* Empty */\n };\n\n constructor() {\n effect(() => {\n const defaultValue = this.defaultValue();\n if (!this.hasAppliedDefault && defaultValue !== undefined) {\n this.hasAppliedDefault = true;\n this.value.set(defaultValue);\n }\n });\n }\n\n /** @ignore Register a child's disabled signal keyed by its name. */\n registerChild(name: string, disabled: Signal<boolean>): () => void {\n this.disabledByName.set(name, disabled);\n return () => {\n if (this.disabledByName.get(name) === disabled) {\n this.disabledByName.delete(name);\n }\n };\n }\n\n /** A stable control id for a child, derived from the group id and the child name. */\n controlId(name: string): string {\n return `${this.elementId}-${name}`;\n }\n\n /** @ignore Register a child's control element id so the parent can list it in `aria-controls`. */\n registerControl(name: string, id: string): () => void {\n this.controlIds.update((ids) => ({ ...ids, [name]: id }));\n return () => {\n this.controlIds.update((ids) => {\n if (ids[name] !== id) {\n return ids;\n }\n const next = { ...ids };\n delete next[name];\n return next;\n });\n };\n }\n\n /** Add/remove a single child name from the value (a direct child change). */\n toggleValue(name: string, event?: Event): void {\n if (this.disabledState()) {\n return;\n }\n\n const current = this.value();\n const next = current.includes(name) ? current.filter((v) => v !== name) : [...current, name];\n if (!this.emit(next, event)) {\n return;\n }\n\n // A direct child change becomes the new \"remembered\" selection and resets the parent cycle.\n this.seeded = true;\n this.uncontrolledState = next;\n this.parentStatus = 'mixed';\n }\n\n /**\n * Toggle from the `parent` checkbox. Mirrors Base UI's `useCheckboxGroupParent`:\n *\n * - When the remembered selection is all/none, this is a plain check-all ↔ uncheck-all toggle.\n * - When it is a partial selection, clicks cycle: partial → all → none → partial → …, so the\n * user's original partial choice is restored rather than lost.\n *\n * Disabled-but-checked children are always preserved (they cannot be toggled programmatically).\n */\n toggleAll(event?: Event): void {\n if (this.disabledState()) {\n return;\n }\n\n this.ensureSeeded();\n\n const allValues = this.allValues();\n const remembered = this.uncontrolledState;\n\n // Disabled children that were checked stay checked through every transition.\n const none = allValues.filter((name) => this.isNameDisabled(name) && remembered.includes(name));\n const all = allValues.filter((name) => !this.isNameDisabled(name) || remembered.includes(name));\n\n const rememberedIsAllOrNone = remembered.length === all.length || remembered.length === 0;\n if (rememberedIsAllOrNone) {\n this.emit(this.value().length === all.length ? none : all, event);\n return;\n }\n\n let nextStatus: 'on' | 'off' | 'mixed' = 'mixed';\n let nextValue = remembered;\n if (this.parentStatus === 'mixed') {\n nextStatus = 'on';\n nextValue = all;\n } else if (this.parentStatus === 'on') {\n nextStatus = 'off';\n nextValue = none;\n }\n\n if (!this.emit(nextValue, event)) {\n return;\n }\n this.parentStatus = nextStatus;\n }\n\n private isNameDisabled(name: string): boolean {\n return this.disabledByName.get(name)?.() ?? false;\n }\n\n /** Seed the remembered selection from the current value the first time the parent is used. */\n private ensureSeeded(): void {\n if (!this.seeded) {\n this.seeded = true;\n this.uncontrolledState = this.value();\n }\n }\n\n private emit(next: string[], event?: Event): boolean {\n const trigger = event?.currentTarget instanceof HTMLElement ? event.currentTarget : undefined;\n const { eventDetails } = createCancelableChangeEventDetails(\n 'none',\n event ?? new Event('checkbox-group.value-change'),\n trigger\n );\n this.onValueChange.emit({ value: next, eventDetails });\n if (eventDetails.isCanceled()) {\n return false;\n }\n\n this.value.set(next);\n this.onChange(next);\n this.onTouched();\n return true;\n }\n\n /** @ignore */\n writeValue(value: string[] | null): void {\n this.value.set(value ?? []);\n }\n\n /** @ignore */\n registerOnChange(fn: (value: string[]) => void): void {\n this.onChange = fn;\n }\n\n /** @ignore */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /** @ignore */\n setDisabledState(isDisabled: boolean): void {\n this.disabledByCva.set(isDisabled);\n }\n}\n","import {\n booleanAttribute,\n computed,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n Renderer2\n} from '@angular/core';\nimport {\n BooleanInput,\n createCancelableChangeEventDetails,\n createContext,\n RdxCancelableChangeEventDetails,\n RdxControlValueAccessor,\n RdxFormCheckboxControl\n} from '@radix-ng/primitives/core';\nimport { injectCheckboxGroupContext } from './checkbox-group';\n\n/**\n * Internal tri-state used only for the derived `parent` (select-all) state in\n * `rdxCheckboxGroup` and compatibility helpers. The public `checked` member is\n * a plain `boolean`; mixed state is exposed via the separate `indeterminate`\n * member (Base UI shape).\n */\nexport type CheckedState = boolean | 'indeterminate';\n\nexport function isIndeterminate(checked?: CheckedState): checked is 'indeterminate' {\n return checked === 'indeterminate';\n}\n\nexport function getState(checked: CheckedState) {\n return isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';\n}\n\nexport type RdxCheckboxCheckedChangeReason = 'none';\nexport type RdxCheckboxCheckedChangeEventDetails = RdxCancelableChangeEventDetails<RdxCheckboxCheckedChangeReason>;\n\nexport interface RdxCheckboxCheckedChangeEvent {\n checked: boolean;\n eventDetails: RdxCheckboxCheckedChangeEventDetails;\n}\n\nconst rootContext = () => {\n const checkbox = inject(RdxCheckboxRootDirective);\n\n // `checked`/`disabled` come from the directive so they reflect group membership when the\n // checkbox is inside a `rdxCheckboxGroup`; otherwise they fall back to the CVA.\n return {\n checked: checkbox.checkedState,\n indeterminate: checkbox.indeterminateState,\n disabled: checkbox.disabledState,\n required: checkbox.required,\n value: checkbox.submitValue,\n name: checkbox.name,\n parent: checkbox.parent,\n form: checkbox.form,\n readonly: checkbox.readOnlyState,\n state: checkbox.state,\n uncheckedValue: checkbox.uncheckedValue,\n toggle(event?: Event) {\n checkbox.toggle(event);\n }\n };\n};\n\nexport type CheckboxRootContext = ReturnType<typeof rootContext>;\n\nexport const [injectCheckboxRootContext, provideCheckboxRootContext] = createContext<CheckboxRootContext>(\n 'CheckboxRootContext',\n 'components/checkbox'\n);\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxCheckboxRoot]',\n providers: [provideCheckboxRootContext(rootContext)],\n hostDirectives: [\n {\n directive: RdxControlValueAccessor,\n inputs: ['value:checked', 'disabled']\n }\n ],\n host: {\n '[attr.data-checked]': 'checkedState() && !indeterminateState() ? \"\" : undefined',\n '[attr.data-unchecked]': '!checkedState() && !indeterminateState() ? \"\" : undefined',\n '[attr.data-indeterminate]': 'indeterminateState() ? \"\" : undefined',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : undefined',\n '[attr.data-readonly]': 'readOnlyState() ? \"\" : undefined',\n '[attr.data-required]': 'required() ? \"\" : undefined'\n }\n})\nexport class RdxCheckboxRootDirective implements RdxFormCheckboxControl {\n private readonly controlValueAccessor = inject(RdxControlValueAccessor);\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly renderer = inject(Renderer2);\n private uncheckedInputElement: HTMLInputElement | null = null;\n\n /** The group this checkbox belongs to, if it is rendered inside a `rdxCheckboxGroup`. */\n private readonly group = injectCheckboxGroupContext(true);\n\n /**\n * @ignore\n * Reflects the effective disabled state (CVA, covering reactive-forms `.disable()`, plus the\n * group's disabled state), used for the `data-disabled` host attribute.\n */\n protected readonly isDisabled = computed(() => this.disabledState());\n\n /**\n * The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.\n *\n * Mixed state is no longer expressed through `checked` — use the separate\n * `indeterminate` input (Base UI shape). This `boolean` model is what\n * `RdxFormCheckboxControl` / Angular Signal Forms bind to.\n * @group Props\n */\n readonly checked = model<boolean>(false);\n\n /**\n * The state of the checkbox when it is initially rendered.\n *\n * @default false\n * @group Props\n */\n readonly defaultChecked = input<boolean | undefined, BooleanInput | undefined>(undefined, {\n transform: (value) => (value === undefined ? undefined : booleanAttribute(value))\n });\n\n /**\n * Whether the checkbox is in a mixed state: neither ticked nor unticked.\n * Orthogonal to `checked` and not part of the submitted form value. A user\n * click resolves the checkbox to `checked` and clears `indeterminate`.\n * @group Props\n */\n readonly indeterminate = model<boolean>(false);\n\n /**\n * The value of the checkbox. This is what is submitted with the form when the checkbox is checked.\n *\n * Bound publicly as `[value]`; the TS member is named `submitValue` so the\n * directive can satisfy `RdxFormCheckboxControl`, whose contract reserves a\n * `value` member for `RdxFormValueControl` and forbids it on checkbox-style\n * controls. (Checkbox is not yet marked `implements` — its `checked` is still\n * `CheckedState`; see the `indeterminate` half of collision #1.)\n * @group Props\n */\n readonly submitValue = input<string>('on', { alias: 'value' });\n\n /**\n * The value submitted with the form when the checkbox is unchecked.\n * By default, unchecked checkboxes do not submit any value, matching native checkbox behavior.\n *\n * @group Props\n */\n readonly uncheckedValue = input<string>();\n\n /**\n * Whether or not the checkbox button is disabled. This prevents the user from interacting with it.\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the user should be unable to tick or untick the checkbox.\n * @group Props\n */\n readonly readonly = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Alias matching Base UI's `readOnly` prop spelling. */\n readonly readOnly = input<boolean, BooleanInput>(false, { alias: 'readOnly', transform: booleanAttribute });\n\n /**\n * Whether or not the checkbox is required.\n * @group Props\n */\n readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Name of the form control. Submitted with the form as part of a name/value pair. Inside a\n * `rdxCheckboxGroup` this also identifies the checkbox in the group's value array.\n * @group Props\n */\n readonly name = input<string>();\n\n /**\n * When inside a `rdxCheckboxGroup`, marks this as the \"select all\" checkbox: its state is\n * derived from the group's `allValues`, and toggling it checks or unchecks every child.\n * @group Props\n */\n readonly parent = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Associates the control with a form element.\n * @group Props\n */\n readonly form = input<string>();\n\n /**\n * Event emitted when the checkbox checked state changes.\n * @group Emits\n */\n readonly onCheckedChange = output<RdxCheckboxCheckedChangeEvent>();\n\n /**\n * @ignore\n * The effective checked state as a `boolean`. Inside a `rdxCheckboxGroup` it is derived from the\n * group (a `parent` checkbox is checked only when every child is; a child from whether its `name`\n * is in the group value); standalone it reads the CVA value.\n */\n readonly checkedState = computed<boolean>(() => {\n const group = this.group;\n if (group) {\n if (this.parent()) {\n return group.parentState() === true;\n }\n\n const name = this.name();\n if (name !== undefined) {\n return group.value().includes(name);\n }\n }\n\n return !!this.controlValueAccessor.value();\n });\n\n /**\n * @ignore\n * The effective mixed state. A `parent` checkbox is indeterminate when some — but not all —\n * children are checked; otherwise it follows the `indeterminate` input.\n */\n readonly indeterminateState = computed<boolean>(() => {\n const group = this.group;\n if (group && this.parent()) {\n return group.parentState() === 'indeterminate';\n }\n\n return this.indeterminate();\n });\n\n /** @ignore The effective disabled state, including the group. */\n readonly disabledState = computed(() => this.controlValueAccessor.disabled() || (this.group?.disabled() ?? false));\n readonly readOnlyState = computed(() => this.readonly() || this.readOnly());\n\n readonly state = computed(() =>\n this.indeterminateState() ? 'indeterminate' : this.checkedState() ? 'checked' : 'unchecked'\n );\n\n constructor() {\n // Inside a group, register this child's name and its own disabled state so a `parent`\n // checkbox can preserve disabled-but-checked children when selecting/deselecting all.\n effect((onCleanup) => {\n const group = this.group;\n const name = this.name();\n if (group && !this.parent() && name !== undefined) {\n onCleanup(group.registerChild(name, this.controlValueAccessor.disabled));\n }\n });\n\n let hasAppliedDefault = false;\n effect(() => {\n const defaultChecked = this.defaultChecked();\n if (!hasAppliedDefault && defaultChecked !== undefined) {\n hasAppliedDefault = true;\n this.checked.set(defaultChecked);\n this.controlValueAccessor.setValue(defaultChecked);\n }\n });\n\n effect(() => {\n this.syncUncheckedInput();\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.removeUncheckedInput();\n });\n }\n\n toggle(event?: Event) {\n if (this.disabledState() || this.readOnlyState()) {\n return;\n }\n\n const group = this.group;\n if (group) {\n if (this.parent()) {\n group.toggleAll(event);\n return;\n }\n\n const name = this.name();\n if (name !== undefined) {\n group.toggleValue(name, event);\n return;\n }\n }\n\n // From the indeterminate state a click resolves to checked (matching\n // native + Base UI), otherwise it flips the boolean. A single setValue so\n // onCheckedChange fires once; the `checked`/`indeterminate` models are\n // kept in sync so `[(checked)]` / `[(indeterminate)]` reflect the change.\n const next = this.indeterminateState() ? true : !this.checkedState();\n const trigger = event?.currentTarget instanceof HTMLElement ? event.currentTarget : undefined;\n const { eventDetails } = createCancelableChangeEventDetails(\n 'none',\n event ?? new Event('checkbox.checked-change'),\n trigger\n );\n this.onCheckedChange.emit({ checked: next, eventDetails });\n if (eventDetails.isCanceled()) {\n return;\n }\n\n this.indeterminate.set(false);\n this.checked.set(next);\n this.controlValueAccessor.setValue(next);\n }\n\n private syncUncheckedInput(): void {\n const name = this.name();\n const uncheckedValue = this.uncheckedValue();\n const shouldRender =\n !this.checkedState() && !this.group && !this.parent() && name !== undefined && uncheckedValue !== undefined;\n\n if (!shouldRender) {\n this.removeUncheckedInput();\n return;\n }\n\n const input = this.ensureUncheckedInput();\n this.renderer.setAttribute(input, 'type', 'hidden');\n this.renderer.setAttribute(input, 'name', name);\n this.renderer.setAttribute(input, 'value', uncheckedValue);\n this.setOptionalAttribute(input, 'form', this.form());\n this.setBooleanAttribute(input, 'disabled', this.disabledState());\n }\n\n private ensureUncheckedInput(): HTMLInputElement {\n if (this.uncheckedInputElement) {\n return this.uncheckedInputElement;\n }\n\n const host = this.elementRef.nativeElement;\n const parent = host.parentNode;\n const input = this.renderer.createElement('input') as HTMLInputElement;\n if (parent) {\n this.renderer.insertBefore(parent, input, host.nextSibling);\n }\n this.uncheckedInputElement = input;\n return input;\n }\n\n private removeUncheckedInput(): void {\n const input = this.uncheckedInputElement;\n if (!input) {\n return;\n }\n\n const parent = input.parentNode;\n if (parent) {\n this.renderer.removeChild(parent, input);\n }\n this.uncheckedInputElement = null;\n }\n\n private setOptionalAttribute(element: HTMLElement, name: string, value: string | undefined): void {\n if (value) {\n this.renderer.setAttribute(element, name, value);\n } else {\n this.renderer.removeAttribute(element, name);\n }\n }\n\n private setBooleanAttribute(element: HTMLElement, name: string, value: boolean): void {\n if (value) {\n this.renderer.setAttribute(element, name, '');\n } else {\n this.renderer.removeAttribute(element, name);\n }\n }\n}\n","import { computed, Directive, effect, ElementRef, inject } from '@angular/core';\nimport { injectCheckboxGroupContext } from './checkbox-group';\nimport { injectCheckboxRootContext } from './checkbox-root';\n\n/**\n * Directive: rdxCheckboxButton\n * Purpose: Turns a native <button> into an accessible checkbox control bound to the Radix Checkbox context.\n * It mirrors the checkbox state via ARIA/data attributes, toggles on click, and prevents Enter activation per WAI-ARIA.\n * In forms, it stops the button's click from bubbling so only the hidden input emits the native event used for form/validator integration.\n */\n@Directive({\n selector: 'button[rdxCheckboxButton]',\n host: {\n type: 'button',\n role: 'checkbox',\n '[attr.aria-checked]': 'rootContext.indeterminate() ? \"mixed\" : rootContext.checked()',\n '[attr.aria-controls]': 'ariaControls()',\n '[attr.aria-disabled]': 'rootContext.disabled() ? \"true\" : undefined',\n '[attr.aria-required]': 'rootContext.required() || undefined',\n '[attr.aria-readonly]': 'rootContext.readonly() || undefined',\n '[attr.data-checked]': 'rootContext.checked() && !rootContext.indeterminate() ? \"\" : undefined',\n '[attr.data-unchecked]': '!rootContext.checked() && !rootContext.indeterminate() ? \"\" : undefined',\n '[attr.data-indeterminate]': 'rootContext.indeterminate() ? \"\" : undefined',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"\" : undefined',\n '[attr.data-readonly]': 'rootContext.readonly() ? \"\" : undefined',\n '[attr.data-required]': 'rootContext.required() ? \"\" : undefined',\n '(click)': 'clicked($event)',\n // According to WAI ARIA, Checkboxes don't activate on enter keypress\n '(keydown.enter)': '$event.preventDefault()'\n }\n})\nexport class RdxCheckboxButtonDirective {\n protected readonly rootContext = injectCheckboxRootContext();\n private readonly group = injectCheckboxGroupContext(true);\n\n private readonly elementRef = inject<ElementRef<HTMLButtonElement>>(ElementRef);\n\n /** A `parent` checkbox lists the ids of the children it controls. */\n protected readonly ariaControls = computed(() =>\n this.group && this.rootContext.parent() ? this.group.controlledIds() : undefined\n );\n\n constructor() {\n // A child checkbox in a group exposes its control id so the parent can reference it via\n // `aria-controls`. Use the consumer's id when present, otherwise derive a stable one.\n effect((onCleanup) => {\n const group = this.group;\n const name = this.rootContext.name();\n if (!group || this.rootContext.parent() || name === undefined) {\n return;\n }\n\n const el = this.elementRef.nativeElement;\n if (!el.id) {\n el.id = group.controlId(name);\n }\n onCleanup(group.registerControl(name, el.id));\n });\n }\n\n protected clicked(event: MouseEvent) {\n if (event.defaultPrevented || this.rootContext.disabled() || this.rootContext.readonly()) {\n return;\n }\n\n this.rootContext.toggle(event);\n\n if (this.rootContext.form() || this.elementRef.nativeElement.closest('form')) {\n // if checkbox is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect checkbox updates.\n event.stopPropagation();\n }\n }\n}\n","import { booleanAttribute, computed, Directive, input } from '@angular/core';\nimport { BooleanInput } from '@radix-ng/primitives/core';\nimport { injectCheckboxRootContext } from './checkbox-root';\n\n@Directive({\n selector: '[rdxCheckboxIndicator]',\n host: {\n '[attr.data-checked]': 'rootContext.checked() && !rootContext.indeterminate() ? \"\" : undefined',\n '[attr.data-unchecked]': '!rootContext.checked() && !rootContext.indeterminate() ? \"\" : undefined',\n '[attr.data-indeterminate]': 'rootContext.indeterminate() ? \"\" : undefined',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"\" : undefined',\n '[attr.data-readonly]': 'rootContext.readonly() ? \"\" : undefined',\n '[attr.data-required]': 'rootContext.required() ? \"\" : undefined',\n '[attr.data-starting-style]': 'isVisible() ? \"\" : undefined',\n '[attr.data-ending-style]': '!isVisible() ? \"\" : undefined',\n '[style.display]': '!keepMounted() && !isVisible() ? \"none\" : null',\n '[style.pointer-events]': '\"none\"'\n }\n})\nexport class RdxCheckboxIndicatorDirective {\n protected readonly rootContext = injectCheckboxRootContext();\n\n /** Keep the indicator in the DOM when unchecked so CSS exit animations can play. */\n readonly keepMounted = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n protected readonly isVisible = computed(() => this.rootContext.checked() || this.rootContext.indeterminate());\n}\n","import { Directive, effect, ElementRef, inject } from '@angular/core';\nimport { injectCheckboxRootContext } from './checkbox-root';\n\n@Directive({\n selector: 'input[rdxCheckboxInput]',\n host: {\n type: 'checkbox',\n tabindex: '-1',\n 'aria-hidden': 'true',\n '[attr.name]': 'rootContext.parent() ? undefined : rootContext.name() || undefined',\n // Only a truly checked box is submitted; `indeterminate` is a property\n // (set below), never a submitted \"checked\" value.\n '[attr.checked]': 'rootContext.state() === \"checked\" ? \"\" : undefined',\n '[checked]': 'rootContext.checked()',\n '[attr.form]': 'rootContext.form() || undefined',\n '[attr.value]': 'rootContext.value()',\n '[required]': 'rootContext.required()',\n '[disabled]': 'rootContext.disabled()',\n '[style]': `{\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n inset: 0,\n transform: 'translateX(-100%)',\n }`\n }\n})\nexport class RdxCheckboxInputDirective {\n protected readonly rootContext = injectCheckboxRootContext();\n\n private readonly input = inject<ElementRef<HTMLInputElement>>(ElementRef).nativeElement;\n\n constructor() {\n let isInitial = true;\n\n /**\n * Keeps the hidden native input in sync so form submission, native\n * validation and form events reflect the checkbox state.\n *\n * - `indeterminate` is a native property (not a submittable value), so we\n * mirror it here rather than via an attribute.\n * - On every change (but not the initial render) we emit bubbling\n * `input`/`change` events so native form listeners react. We do NOT\n * dispatch a `click`: a click on a checkbox runs the toggle activation\n * behavior and would desync the input from the bound state.\n */\n effect(() => {\n // Track both so the native input mirrors the checkbox and emits change\n // events when either the checked or indeterminate state moves.\n this.rootContext.checked();\n this.input.indeterminate = this.rootContext.indeterminate();\n\n if (isInitial) {\n isInitial = false;\n return;\n }\n\n this.input.dispatchEvent(new Event('input', { bubbles: true }));\n this.input.dispatchEvent(new Event('change', { bubbles: true }));\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RdxCheckboxButtonDirective } from './src/checkbox-button';\nimport { RdxCheckboxGroupDirective } from './src/checkbox-group';\nimport { RdxCheckboxIndicatorDirective } from './src/checkbox-indicator';\nimport { RdxCheckboxInputDirective } from './src/checkbox-input';\nimport { RdxCheckboxRootDirective } from './src/checkbox-root';\n\nexport * from './src/checkbox-button';\nexport * from './src/checkbox-group';\nexport * from './src/checkbox-indicator';\nexport * from './src/checkbox-input';\nexport * from './src/checkbox-root';\nexport type { CheckedState } from './src/checkbox-root';\n\nexport const checkboxImports = [\n RdxCheckboxInputDirective,\n RdxCheckboxRootDirective,\n RdxCheckboxButtonDirective,\n RdxCheckboxIndicatorDirective,\n RdxCheckboxGroupDirective\n];\n\n@NgModule({\n imports: [...checkboxImports],\n exports: [...checkboxImports]\n})\nexport class RdxCheckboxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAsDO,MAAM,CAAC,0B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AAM,eAAe,GAAG;IAC3B,yBAAyB;IACzB,wBAAwB;IACxB,0BAA0B;IAC1B,6BAA6B;IAC7B;;MAOS,iBAAiB,CAAA;8GAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAjB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,YAX1B,yBAAyB;YACzB,wBAAwB;YACxB,0BAA0B;YAC1B,6BAA6B;AAC7B,YAAA,yBAAyB,aAJzB,yBAAyB;YACzB,wBAAwB;YACxB,0BAA0B;YAC1B,6BAA6B;YAC7B,yBAAyB,CAAA,EAAA,CAAA,CAAA;+GAOhB,iBAAiB,EAAA,CAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,eAAe,CAAC;AAC7B,oBAAA,OAAO,EAAE,CAAC,GAAG,eAAe;AAC/B,iBAAA;;;ACzBD;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-checkbox.mjs","sources":["../../../packages/primitives/checkbox/src/checkbox-group.ts","../../../packages/primitives/checkbox/src/checkbox-root.ts","../../../packages/primitives/checkbox/src/checkbox-button.ts","../../../packages/primitives/checkbox/src/checkbox-indicator.ts","../../../packages/primitives/checkbox/src/checkbox-input.ts","../../../packages/primitives/checkbox/index.ts","../../../packages/primitives/checkbox/radix-ng-primitives-checkbox.ts"],"sourcesContent":["import {\n booleanAttribute,\n computed,\n Directive,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n Signal\n} from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport {\n BooleanInput,\n createCancelableChangeEventDetails,\n createContext,\n provideValueAccessor,\n RdxCancelableChangeEventDetails\n} from '@radix-ng/primitives/core';\nimport type { CheckedState } from './checkbox-root';\n\nexport type RdxCheckboxGroupValueChangeReason = 'none';\nexport type RdxCheckboxGroupValueChangeEventDetails =\n RdxCancelableChangeEventDetails<RdxCheckboxGroupValueChangeReason>;\n\nexport interface RdxCheckboxGroupValueChangeEvent {\n value: string[];\n eventDetails: RdxCheckboxGroupValueChangeEventDetails;\n}\n\nexport interface RdxCheckboxGroupContext {\n /** The names of the currently checked checkboxes. */\n value: Signal<string[]>;\n /** All checkbox names, used by a `parent` checkbox to check/uncheck every child. */\n allValues: Signal<string[]>;\n /** Whether the whole group is disabled. */\n disabled: Signal<boolean>;\n /** The derived state of a `parent` checkbox: all / none / some checked. */\n parentState: Signal<CheckedState>;\n /** The space-separated control ids the `parent` checkbox controls (for `aria-controls`). */\n controlledIds: Signal<string | undefined>;\n /** A stable id for a child's control element, derived from the group id and the child name. */\n controlId: (name: string) => string;\n /** Toggle a single child by name. */\n toggleValue: (name: string, event?: Event) => void;\n /** Toggle every child on or off (used by a `parent` checkbox). */\n toggleAll: (event?: Event) => void;\n /** Register a child's name and disabled state so the parent can preserve disabled items. */\n registerChild: (name: string, disabled: Signal<boolean>) => () => void;\n /** Register a child's control element id so the parent can reference it via `aria-controls`. */\n registerControl: (name: string, id: string) => () => void;\n}\n\nexport const [injectCheckboxGroupContext, provideCheckboxGroupContext] = createContext<RdxCheckboxGroupContext>(\n 'CheckboxGroupContext',\n 'components/checkbox'\n);\n\nconst groupContext = (): RdxCheckboxGroupContext => {\n const group = inject(RdxCheckboxGroupDirective);\n return {\n value: group.value,\n allValues: group.allValues,\n disabled: group.disabledState,\n parentState: group.parentState,\n controlledIds: group.controlledIds,\n controlId: (name) => group.controlId(name),\n toggleValue: (name, event) => group.toggleValue(name, event),\n toggleAll: (event) => group.toggleAll(event),\n registerChild: (name, disabled) => group.registerChild(name, disabled),\n registerControl: (name, id) => group.registerControl(name, id)\n };\n};\n\nlet nextCheckboxGroupId = 0;\n\n/**\n * Groups a set of checkboxes that share a single array value (the names of the checked boxes).\n *\n * Each child `rdxCheckboxRoot` participates by its `name`. A child marked `parent` becomes a\n * \"select all\" checkbox whose state is derived from `allValues`.\n */\n@Directive({\n selector: '[rdxCheckboxGroup]',\n exportAs: 'rdxCheckboxGroup',\n providers: [provideValueAccessor(RdxCheckboxGroupDirective), provideCheckboxGroupContext(groupContext)],\n host: {\n role: 'group',\n '[attr.data-disabled]': 'disabledState() ? \"\" : undefined'\n }\n})\nexport class RdxCheckboxGroupDirective implements ControlValueAccessor {\n /** The names of the currently checked checkboxes. Use with `onValueChange` or `[(value)]`. */\n readonly value = model<string[]>([]);\n\n /** The names checked initially when the group is uncontrolled. */\n readonly defaultValue = input<string[]>();\n\n /** All checkbox names in the group. Required for a `parent` (select-all) checkbox. */\n readonly allValues = input<string[]>([]);\n\n /** Whether the whole group is disabled. */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Emits the new array of checked names whenever the value changes. */\n readonly onValueChange = output<RdxCheckboxGroupValueChangeEvent>();\n\n private readonly disabledByCva = signal(false);\n readonly disabledState = computed(() => this.disabledByCva() || this.disabled());\n\n /** Derived state for a `parent` checkbox: `true` (all), `false` (none) or `'indeterminate'`. */\n readonly parentState = computed<CheckedState>(() => {\n const total = this.allValues().length;\n const count = this.value().length;\n if (total > 0 && count === total) {\n return true;\n }\n return count > 0 ? 'indeterminate' : false;\n });\n\n /**\n * The value as last set directly by a child (or the initial value) — the \"remembered\" partial\n * selection that a `parent` checkbox cycles back to, mirroring Base UI's `uncontrolledStateRef`.\n */\n private uncontrolledState: string[] = [];\n private seeded = false;\n /** Where the parent is in its mixed → on → off cycle. Reset to `mixed` on any direct child change. */\n private parentStatus: 'on' | 'off' | 'mixed' = 'mixed';\n /** Per-name disabled signals, so the parent can preserve disabled-but-checked children. */\n private readonly disabledByName = new Map<string, Signal<boolean>>();\n\n /** Stable group id used to derive child control ids when the consumer sets none. */\n private readonly elementId = `rdx-checkbox-group-${nextCheckboxGroupId++}`;\n /** Registered control element ids, keyed by child name. */\n private readonly controlIds = signal<Record<string, string>>({});\n\n /** The space-separated control ids in `allValues` order, for the parent's `aria-controls`. */\n readonly controlledIds = computed<string | undefined>(() => {\n const ids = this.controlIds();\n const list = this.allValues()\n .map((name) => ids[name])\n .filter((id): id is string => id !== undefined);\n return list.length > 0 ? list.join(' ') : undefined;\n });\n\n private hasAppliedDefault = false;\n private onChange: (value: string[]) => void = () => {\n /* Empty */\n };\n onTouched: () => void = () => {\n /* Empty */\n };\n\n constructor() {\n effect(() => {\n const defaultValue = this.defaultValue();\n if (!this.hasAppliedDefault && defaultValue !== undefined) {\n this.hasAppliedDefault = true;\n this.value.set(defaultValue);\n }\n });\n }\n\n /** @ignore Register a child's disabled signal keyed by its name. */\n registerChild(name: string, disabled: Signal<boolean>): () => void {\n this.disabledByName.set(name, disabled);\n return () => {\n if (this.disabledByName.get(name) === disabled) {\n this.disabledByName.delete(name);\n }\n };\n }\n\n /** A stable control id for a child, derived from the group id and the child name. */\n controlId(name: string): string {\n return `${this.elementId}-${name}`;\n }\n\n /** @ignore Register a child's control element id so the parent can list it in `aria-controls`. */\n registerControl(name: string, id: string): () => void {\n this.controlIds.update((ids) => ({ ...ids, [name]: id }));\n return () => {\n this.controlIds.update((ids) => {\n if (ids[name] !== id) {\n return ids;\n }\n const next = { ...ids };\n delete next[name];\n return next;\n });\n };\n }\n\n /** Add/remove a single child name from the value (a direct child change). */\n toggleValue(name: string, event?: Event): void {\n if (this.disabledState()) {\n return;\n }\n\n const current = this.value();\n const next = current.includes(name) ? current.filter((v) => v !== name) : [...current, name];\n if (!this.emit(next, event)) {\n return;\n }\n\n // A direct child change becomes the new \"remembered\" selection and resets the parent cycle.\n this.seeded = true;\n this.uncontrolledState = next;\n this.parentStatus = 'mixed';\n }\n\n /**\n * Toggle from the `parent` checkbox. Mirrors Base UI's `useCheckboxGroupParent`:\n *\n * - When the remembered selection is all/none, this is a plain check-all ↔ uncheck-all toggle.\n * - When it is a partial selection, clicks cycle: partial → all → none → partial → …, so the\n * user's original partial choice is restored rather than lost.\n *\n * Disabled-but-checked children are always preserved (they cannot be toggled programmatically).\n */\n toggleAll(event?: Event): void {\n if (this.disabledState()) {\n return;\n }\n\n this.ensureSeeded();\n\n const allValues = this.allValues();\n const remembered = this.uncontrolledState;\n\n // Disabled children that were checked stay checked through every transition.\n const none = allValues.filter((name) => this.isNameDisabled(name) && remembered.includes(name));\n const all = allValues.filter((name) => !this.isNameDisabled(name) || remembered.includes(name));\n\n const rememberedIsAllOrNone = remembered.length === all.length || remembered.length === 0;\n if (rememberedIsAllOrNone) {\n this.emit(this.value().length === all.length ? none : all, event);\n return;\n }\n\n let nextStatus: 'on' | 'off' | 'mixed' = 'mixed';\n let nextValue = remembered;\n if (this.parentStatus === 'mixed') {\n nextStatus = 'on';\n nextValue = all;\n } else if (this.parentStatus === 'on') {\n nextStatus = 'off';\n nextValue = none;\n }\n\n if (!this.emit(nextValue, event)) {\n return;\n }\n this.parentStatus = nextStatus;\n }\n\n private isNameDisabled(name: string): boolean {\n return this.disabledByName.get(name)?.() ?? false;\n }\n\n /** Seed the remembered selection from the current value the first time the parent is used. */\n private ensureSeeded(): void {\n if (!this.seeded) {\n this.seeded = true;\n this.uncontrolledState = this.value();\n }\n }\n\n private emit(next: string[], event?: Event): boolean {\n const trigger = event?.currentTarget instanceof HTMLElement ? event.currentTarget : undefined;\n const { eventDetails } = createCancelableChangeEventDetails(\n 'none',\n event ?? new Event('checkbox-group.value-change'),\n trigger\n );\n this.onValueChange.emit({ value: next, eventDetails });\n if (eventDetails.isCanceled()) {\n return false;\n }\n\n this.value.set(next);\n this.onChange(next);\n this.onTouched();\n return true;\n }\n\n /** @ignore */\n writeValue(value: string[] | null): void {\n this.value.set(value ?? []);\n }\n\n /** @ignore */\n registerOnChange(fn: (value: string[]) => void): void {\n this.onChange = fn;\n }\n\n /** @ignore */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /** @ignore */\n setDisabledState(isDisabled: boolean): void {\n this.disabledByCva.set(isDisabled);\n }\n}\n","import {\n booleanAttribute,\n computed,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n Renderer2\n} from '@angular/core';\nimport {\n BooleanInput,\n createCancelableChangeEventDetails,\n createContext,\n RdxCancelableChangeEventDetails,\n RdxControlValueAccessor,\n RdxFormCheckboxControl\n} from '@radix-ng/primitives/core';\nimport { injectCheckboxGroupContext } from './checkbox-group';\n\n/**\n * Internal tri-state used only for the derived `parent` (select-all) state in\n * `rdxCheckboxGroup` and compatibility helpers. The public `checked` member is\n * a plain `boolean`; mixed state is exposed via the separate `indeterminate`\n * member (Base UI shape).\n */\nexport type CheckedState = boolean | 'indeterminate';\n\nexport function isIndeterminate(checked?: CheckedState): checked is 'indeterminate' {\n return checked === 'indeterminate';\n}\n\nexport function getState(checked: CheckedState) {\n return isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';\n}\n\nexport type RdxCheckboxCheckedChangeReason = 'none';\nexport type RdxCheckboxCheckedChangeEventDetails = RdxCancelableChangeEventDetails<RdxCheckboxCheckedChangeReason>;\n\nexport interface RdxCheckboxCheckedChangeEvent {\n checked: boolean;\n eventDetails: RdxCheckboxCheckedChangeEventDetails;\n}\n\nconst rootContext = () => {\n const checkbox = inject(RdxCheckboxRootDirective);\n\n // `checked`/`disabled` come from the directive so they reflect group membership when the\n // checkbox is inside a `rdxCheckboxGroup`; otherwise they fall back to the CVA.\n return {\n checked: checkbox.checkedState,\n indeterminate: checkbox.indeterminateState,\n disabled: checkbox.disabledState,\n required: checkbox.required,\n value: checkbox.submitValue,\n name: checkbox.name,\n parent: checkbox.parent,\n form: checkbox.form,\n readonly: checkbox.readOnlyState,\n state: checkbox.state,\n uncheckedValue: checkbox.uncheckedValue,\n toggle(event?: Event) {\n checkbox.toggle(event);\n }\n };\n};\n\nexport type CheckboxRootContext = ReturnType<typeof rootContext>;\n\nexport const [injectCheckboxRootContext, provideCheckboxRootContext] = createContext<CheckboxRootContext>(\n 'CheckboxRootContext',\n 'components/checkbox'\n);\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxCheckboxRoot]',\n providers: [provideCheckboxRootContext(rootContext)],\n hostDirectives: [\n {\n directive: RdxControlValueAccessor,\n inputs: ['value:checked', 'disabled']\n }\n ],\n host: {\n '[attr.data-checked]': 'checkedState() && !indeterminateState() ? \"\" : undefined',\n '[attr.data-unchecked]': '!checkedState() && !indeterminateState() ? \"\" : undefined',\n '[attr.data-indeterminate]': 'indeterminateState() ? \"\" : undefined',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : undefined',\n '[attr.data-readonly]': 'readOnlyState() ? \"\" : undefined',\n '[attr.data-required]': 'required() ? \"\" : undefined'\n }\n})\nexport class RdxCheckboxRootDirective implements RdxFormCheckboxControl {\n private readonly controlValueAccessor = inject(RdxControlValueAccessor);\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly renderer = inject(Renderer2);\n private uncheckedInputElement: HTMLInputElement | null = null;\n\n /** The group this checkbox belongs to, if it is rendered inside a `rdxCheckboxGroup`. */\n private readonly group = injectCheckboxGroupContext(true);\n\n /**\n * @ignore\n * Reflects the effective disabled state (CVA, covering reactive-forms `.disable()`, plus the\n * group's disabled state), used for the `data-disabled` host attribute.\n */\n protected readonly isDisabled = computed(() => this.disabledState());\n\n /**\n * The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.\n *\n * Mixed state is no longer expressed through `checked` — use the separate\n * `indeterminate` input (Base UI shape). This `boolean` model is what\n * `RdxFormCheckboxControl` / Angular Signal Forms bind to.\n * @group Props\n */\n readonly checked = model<boolean>(false);\n\n /**\n * The state of the checkbox when it is initially rendered.\n *\n * @default false\n * @group Props\n */\n readonly defaultChecked = input<boolean | undefined, BooleanInput | undefined>(undefined, {\n transform: (value) => (value === undefined ? undefined : booleanAttribute(value))\n });\n\n /**\n * Whether the checkbox is in a mixed state: neither ticked nor unticked.\n * Orthogonal to `checked` and not part of the submitted form value. A user\n * click resolves the checkbox to `checked` and clears `indeterminate`.\n * @group Props\n */\n readonly indeterminate = model<boolean>(false);\n\n /**\n * The value of the checkbox. This is what is submitted with the form when the checkbox is checked.\n *\n * Bound publicly as `[value]`; the TS member is named `submitValue` so the\n * directive can satisfy `RdxFormCheckboxControl`, whose contract reserves a\n * `value` member for `RdxFormValueControl` and forbids it on checkbox-style\n * controls. (Checkbox is not yet marked `implements` — its `checked` is still\n * `CheckedState`; see the `indeterminate` half of collision #1.)\n * @group Props\n */\n readonly submitValue = input<string>('on', { alias: 'value' });\n\n /**\n * The value submitted with the form when the checkbox is unchecked.\n * By default, unchecked checkboxes do not submit any value, matching native checkbox behavior.\n *\n * @group Props\n */\n readonly uncheckedValue = input<string>();\n\n /**\n * Whether or not the checkbox button is disabled. This prevents the user from interacting with it.\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the user should be unable to tick or untick the checkbox. Bound in templates as\n * `readOnly` (Base UI spelling); the TS member stays `readonly` to satisfy `RdxFormCheckboxControl`.\n * @group Props\n */\n readonly readonly = input<boolean, BooleanInput>(false, { alias: 'readOnly', transform: booleanAttribute });\n\n /**\n * Whether or not the checkbox is required.\n * @group Props\n */\n readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Name of the form control. Submitted with the form as part of a name/value pair. Inside a\n * `rdxCheckboxGroup` this also identifies the checkbox in the group's value array.\n * @group Props\n */\n readonly name = input<string>();\n\n /**\n * When inside a `rdxCheckboxGroup`, marks this as the \"select all\" checkbox: its state is\n * derived from the group's `allValues`, and toggling it checks or unchecks every child.\n * @group Props\n */\n readonly parent = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Associates the control with a form element.\n * @group Props\n */\n readonly form = input<string>();\n\n /**\n * Event emitted when the checkbox checked state changes.\n * @group Emits\n */\n readonly onCheckedChange = output<RdxCheckboxCheckedChangeEvent>();\n\n /**\n * @ignore\n * The effective checked state as a `boolean`. Inside a `rdxCheckboxGroup` it is derived from the\n * group (a `parent` checkbox is checked only when every child is; a child from whether its `name`\n * is in the group value); standalone it reads the CVA value.\n */\n readonly checkedState = computed<boolean>(() => {\n const group = this.group;\n if (group) {\n if (this.parent()) {\n return group.parentState() === true;\n }\n\n const name = this.name();\n if (name !== undefined) {\n return group.value().includes(name);\n }\n }\n\n return !!this.controlValueAccessor.value();\n });\n\n /**\n * @ignore\n * The effective mixed state. A `parent` checkbox is indeterminate when some — but not all —\n * children are checked; otherwise it follows the `indeterminate` input.\n */\n readonly indeterminateState = computed<boolean>(() => {\n const group = this.group;\n if (group && this.parent()) {\n return group.parentState() === 'indeterminate';\n }\n\n return this.indeterminate();\n });\n\n /** @ignore The effective disabled state, including the group. */\n readonly disabledState = computed(() => this.controlValueAccessor.disabled() || (this.group?.disabled() ?? false));\n readonly readOnlyState = computed(() => this.readonly());\n\n readonly state = computed(() =>\n this.indeterminateState() ? 'indeterminate' : this.checkedState() ? 'checked' : 'unchecked'\n );\n\n constructor() {\n // Inside a group, register this child's name and its own disabled state so a `parent`\n // checkbox can preserve disabled-but-checked children when selecting/deselecting all.\n effect((onCleanup) => {\n const group = this.group;\n const name = this.name();\n if (group && !this.parent() && name !== undefined) {\n onCleanup(group.registerChild(name, this.controlValueAccessor.disabled));\n }\n });\n\n let hasAppliedDefault = false;\n effect(() => {\n const defaultChecked = this.defaultChecked();\n if (!hasAppliedDefault && defaultChecked !== undefined) {\n hasAppliedDefault = true;\n this.checked.set(defaultChecked);\n this.controlValueAccessor.setValue(defaultChecked);\n }\n });\n\n effect(() => {\n this.syncUncheckedInput();\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.removeUncheckedInput();\n });\n }\n\n toggle(event?: Event) {\n if (this.disabledState() || this.readOnlyState()) {\n return;\n }\n\n const group = this.group;\n if (group) {\n if (this.parent()) {\n group.toggleAll(event);\n return;\n }\n\n const name = this.name();\n if (name !== undefined) {\n group.toggleValue(name, event);\n return;\n }\n }\n\n // From the indeterminate state a click resolves to checked (matching\n // native + Base UI), otherwise it flips the boolean. A single setValue so\n // onCheckedChange fires once; the `checked`/`indeterminate` models are\n // kept in sync so `[(checked)]` / `[(indeterminate)]` reflect the change.\n const next = this.indeterminateState() ? true : !this.checkedState();\n const trigger = event?.currentTarget instanceof HTMLElement ? event.currentTarget : undefined;\n const { eventDetails } = createCancelableChangeEventDetails(\n 'none',\n event ?? new Event('checkbox.checked-change'),\n trigger\n );\n this.onCheckedChange.emit({ checked: next, eventDetails });\n if (eventDetails.isCanceled()) {\n return;\n }\n\n this.indeterminate.set(false);\n this.checked.set(next);\n this.controlValueAccessor.setValue(next);\n }\n\n private syncUncheckedInput(): void {\n const name = this.name();\n const uncheckedValue = this.uncheckedValue();\n const shouldRender =\n !this.checkedState() && !this.group && !this.parent() && name !== undefined && uncheckedValue !== undefined;\n\n if (!shouldRender) {\n this.removeUncheckedInput();\n return;\n }\n\n const input = this.ensureUncheckedInput();\n this.renderer.setAttribute(input, 'type', 'hidden');\n this.renderer.setAttribute(input, 'name', name);\n this.renderer.setAttribute(input, 'value', uncheckedValue);\n this.setOptionalAttribute(input, 'form', this.form());\n this.setBooleanAttribute(input, 'disabled', this.disabledState());\n }\n\n private ensureUncheckedInput(): HTMLInputElement {\n if (this.uncheckedInputElement) {\n return this.uncheckedInputElement;\n }\n\n const host = this.elementRef.nativeElement;\n const parent = host.parentNode;\n const input = this.renderer.createElement('input') as HTMLInputElement;\n if (parent) {\n this.renderer.insertBefore(parent, input, host.nextSibling);\n }\n this.uncheckedInputElement = input;\n return input;\n }\n\n private removeUncheckedInput(): void {\n const input = this.uncheckedInputElement;\n if (!input) {\n return;\n }\n\n const parent = input.parentNode;\n if (parent) {\n this.renderer.removeChild(parent, input);\n }\n this.uncheckedInputElement = null;\n }\n\n private setOptionalAttribute(element: HTMLElement, name: string, value: string | undefined): void {\n if (value) {\n this.renderer.setAttribute(element, name, value);\n } else {\n this.renderer.removeAttribute(element, name);\n }\n }\n\n private setBooleanAttribute(element: HTMLElement, name: string, value: boolean): void {\n if (value) {\n this.renderer.setAttribute(element, name, '');\n } else {\n this.renderer.removeAttribute(element, name);\n }\n }\n}\n","import { computed, Directive, effect, ElementRef, inject } from '@angular/core';\nimport { injectCheckboxGroupContext } from './checkbox-group';\nimport { injectCheckboxRootContext } from './checkbox-root';\n\n/**\n * Directive: rdxCheckboxButton\n * Purpose: Turns a native <button> into an accessible checkbox control bound to the Radix Checkbox context.\n * It mirrors the checkbox state via ARIA/data attributes, toggles on click, and prevents Enter activation per WAI-ARIA.\n * In forms, it stops the button's click from bubbling so only the hidden input emits the native event used for form/validator integration.\n */\n@Directive({\n selector: 'button[rdxCheckboxButton]',\n host: {\n type: 'button',\n role: 'checkbox',\n '[attr.aria-checked]': 'rootContext.indeterminate() ? \"mixed\" : rootContext.checked()',\n '[attr.aria-controls]': 'ariaControls()',\n '[attr.aria-disabled]': 'rootContext.disabled() ? \"true\" : undefined',\n '[attr.aria-required]': 'rootContext.required() || undefined',\n '[attr.aria-readonly]': 'rootContext.readonly() || undefined',\n '[attr.data-checked]': 'rootContext.checked() && !rootContext.indeterminate() ? \"\" : undefined',\n '[attr.data-unchecked]': '!rootContext.checked() && !rootContext.indeterminate() ? \"\" : undefined',\n '[attr.data-indeterminate]': 'rootContext.indeterminate() ? \"\" : undefined',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"\" : undefined',\n '[attr.data-readonly]': 'rootContext.readonly() ? \"\" : undefined',\n '[attr.data-required]': 'rootContext.required() ? \"\" : undefined',\n '(click)': 'clicked($event)',\n // According to WAI ARIA, Checkboxes don't activate on enter keypress\n '(keydown.enter)': '$event.preventDefault()'\n }\n})\nexport class RdxCheckboxButtonDirective {\n protected readonly rootContext = injectCheckboxRootContext();\n private readonly group = injectCheckboxGroupContext(true);\n\n private readonly elementRef = inject<ElementRef<HTMLButtonElement>>(ElementRef);\n\n /** A `parent` checkbox lists the ids of the children it controls. */\n protected readonly ariaControls = computed(() =>\n this.group && this.rootContext.parent() ? this.group.controlledIds() : undefined\n );\n\n constructor() {\n // A child checkbox in a group exposes its control id so the parent can reference it via\n // `aria-controls`. Use the consumer's id when present, otherwise derive a stable one.\n effect((onCleanup) => {\n const group = this.group;\n const name = this.rootContext.name();\n if (!group || this.rootContext.parent() || name === undefined) {\n return;\n }\n\n const el = this.elementRef.nativeElement;\n if (!el.id) {\n el.id = group.controlId(name);\n }\n onCleanup(group.registerControl(name, el.id));\n });\n }\n\n protected clicked(event: MouseEvent) {\n if (event.defaultPrevented || this.rootContext.disabled() || this.rootContext.readonly()) {\n return;\n }\n\n this.rootContext.toggle(event);\n\n if (this.rootContext.form() || this.elementRef.nativeElement.closest('form')) {\n // if checkbox is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect checkbox updates.\n event.stopPropagation();\n }\n }\n}\n","import { booleanAttribute, computed, Directive, input } from '@angular/core';\nimport { BooleanInput } from '@radix-ng/primitives/core';\nimport { injectCheckboxRootContext } from './checkbox-root';\n\n@Directive({\n selector: '[rdxCheckboxIndicator]',\n host: {\n '[attr.data-checked]': 'rootContext.checked() && !rootContext.indeterminate() ? \"\" : undefined',\n '[attr.data-unchecked]': '!rootContext.checked() && !rootContext.indeterminate() ? \"\" : undefined',\n '[attr.data-indeterminate]': 'rootContext.indeterminate() ? \"\" : undefined',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"\" : undefined',\n '[attr.data-readonly]': 'rootContext.readonly() ? \"\" : undefined',\n '[attr.data-required]': 'rootContext.required() ? \"\" : undefined',\n '[attr.data-starting-style]': 'isVisible() ? \"\" : undefined',\n '[attr.data-ending-style]': '!isVisible() ? \"\" : undefined',\n '[style.display]': '!keepMounted() && !isVisible() ? \"none\" : null',\n '[style.pointer-events]': '\"none\"'\n }\n})\nexport class RdxCheckboxIndicatorDirective {\n protected readonly rootContext = injectCheckboxRootContext();\n\n /** Keep the indicator in the DOM when unchecked so CSS exit animations can play. */\n readonly keepMounted = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n protected readonly isVisible = computed(() => this.rootContext.checked() || this.rootContext.indeterminate());\n}\n","import { Directive, effect, ElementRef, inject } from '@angular/core';\nimport { injectCheckboxRootContext } from './checkbox-root';\n\n@Directive({\n selector: 'input[rdxCheckboxInput]',\n host: {\n type: 'checkbox',\n tabindex: '-1',\n 'aria-hidden': 'true',\n '[attr.name]': 'rootContext.parent() ? undefined : rootContext.name() || undefined',\n // Only a truly checked box is submitted; `indeterminate` is a property\n // (set below), never a submitted \"checked\" value.\n '[attr.checked]': 'rootContext.state() === \"checked\" ? \"\" : undefined',\n '[checked]': 'rootContext.checked()',\n '[attr.form]': 'rootContext.form() || undefined',\n '[attr.value]': 'rootContext.value()',\n '[required]': 'rootContext.required()',\n '[disabled]': 'rootContext.disabled()',\n '[style]': `{\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n inset: 0,\n transform: 'translateX(-100%)',\n }`\n }\n})\nexport class RdxCheckboxInputDirective {\n protected readonly rootContext = injectCheckboxRootContext();\n\n private readonly input = inject<ElementRef<HTMLInputElement>>(ElementRef).nativeElement;\n\n constructor() {\n let isInitial = true;\n\n /**\n * Keeps the hidden native input in sync so form submission, native\n * validation and form events reflect the checkbox state.\n *\n * - `indeterminate` is a native property (not a submittable value), so we\n * mirror it here rather than via an attribute.\n * - On every change (but not the initial render) we emit bubbling\n * `input`/`change` events so native form listeners react. We do NOT\n * dispatch a `click`: a click on a checkbox runs the toggle activation\n * behavior and would desync the input from the bound state.\n */\n effect(() => {\n // Track both so the native input mirrors the checkbox and emits change\n // events when either the checked or indeterminate state moves.\n this.rootContext.checked();\n this.input.indeterminate = this.rootContext.indeterminate();\n\n if (isInitial) {\n isInitial = false;\n return;\n }\n\n this.input.dispatchEvent(new Event('input', { bubbles: true }));\n this.input.dispatchEvent(new Event('change', { bubbles: true }));\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RdxCheckboxButtonDirective } from './src/checkbox-button';\nimport { RdxCheckboxGroupDirective } from './src/checkbox-group';\nimport { RdxCheckboxIndicatorDirective } from './src/checkbox-indicator';\nimport { RdxCheckboxInputDirective } from './src/checkbox-input';\nimport { RdxCheckboxRootDirective } from './src/checkbox-root';\n\nexport * from './src/checkbox-button';\nexport * from './src/checkbox-group';\nexport * from './src/checkbox-indicator';\nexport * from './src/checkbox-input';\nexport * from './src/checkbox-root';\nexport type { CheckedState } from './src/checkbox-root';\n\nexport const checkboxImports = [\n RdxCheckboxInputDirective,\n RdxCheckboxRootDirective,\n RdxCheckboxButtonDirective,\n RdxCheckboxIndicatorDirective,\n RdxCheckboxGroupDirective\n];\n\n@NgModule({\n imports: [...checkboxImports],\n exports: [...checkboxImports]\n})\nexport class RdxCheckboxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAsDO,MAAM,CAAC,0BAA0B,EAAE,2BAA2B,CAAC,GAAG,aAAa,CAClF,sBAAsB,EACtB,qBAAqB;AAGzB,MAAM,YAAY,GAAG,MAA8B;AAC/C,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,yBAAyB,CAAC;IAC/C,OAAO;QACH,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,QAAQ,EAAE,KAAK,CAAC,aAAa;QAC7B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,SAAS,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;AAC1C,QAAA,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC;QAC5D,SAAS,EAAE,CAAC,KAAK,KA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AAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,eAAe,CAAC;AAC7B,oBAAA,OAAO,EAAE,CAAC,GAAG,eAAe;AAC/B,iBAAA;;;ACzBD;;AAEG;;;;"}
@@ -1,29 +1,26 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, untracked, model, input, booleanAttribute, signal, computed, output, effect, Directive, ElementRef, DestroyRef, afterRenderEffect, NgModule } from '@angular/core';
3
- import * as i1 from '@radix-ng/primitives/presence';
4
- import { provideRdxPresenceContext, RdxPresenceDirective } from '@radix-ng/primitives/presence';
5
- import { createContext, useTransitionStatus, injectId } from '@radix-ng/primitives/core';
2
+ import { inject, untracked, signal, model, input, booleanAttribute, computed, output, effect, Directive, ElementRef, Renderer2, DestroyRef, afterRenderEffect, NgModule } from '@angular/core';
3
+ import { createContext, createCancelableChangeEventDetails, useTransitionStatus, injectId } from '@radix-ng/primitives/core';
6
4
 
7
5
  const [injectCollapsibleRootContext, provideCollapsibleRootContext] = createContext('CollapsibleRootContext', 'components/collapsible');
8
6
  const rootContext = () => {
9
7
  const instance = inject(RdxCollapsibleRootDirective);
10
8
  return {
11
- panelId: instance.panelId,
9
+ panelId: instance.resolvedPanelId,
12
10
  open: instance.open,
13
11
  disabled: instance.disabled,
14
12
  transitionStatus: instance.transitionStatus,
15
13
  mounted: instance.mounted,
16
14
  keepMounted: instance.keepMountedContext,
17
15
  hiddenUntilFound: instance.hiddenUntilFoundContext,
16
+ setOpen: (open, reason, event, trigger) => instance.setOpen(open, reason, event, trigger),
17
+ setPanelIdState: (id) => instance.setPanelIdState(id),
18
18
  registerTransitionElement: (element) => instance.registerTransitionElement(element),
19
- toggle: () => {
19
+ toggle: (event, trigger) => {
20
20
  if (instance.disabled()) {
21
21
  return;
22
22
  }
23
- untracked(() => {
24
- instance.open.set(!instance.open());
25
- });
26
- instance.onOpenChange.emit(instance.open());
23
+ instance.setOpen(!instance.open(), 'trigger-press', event, trigger);
27
24
  }
28
25
  };
29
26
  };
@@ -33,8 +30,27 @@ const rootContext = () => {
33
30
  * @group Components
34
31
  */
35
32
  class RdxCollapsibleRootDirective {
33
+ setPanelIdState(id) {
34
+ this.panelIdState.set(id);
35
+ }
36
+ setOpen(nextOpen, reason, event, trigger) {
37
+ if (nextOpen === this.open()) {
38
+ return true;
39
+ }
40
+ const { eventDetails } = createCancelableChangeEventDetails(reason, event, trigger);
41
+ this.onOpenChange.emit({ open: nextOpen, eventDetails });
42
+ if (eventDetails.isCanceled()) {
43
+ return false;
44
+ }
45
+ untracked(() => {
46
+ this.open.set(nextOpen);
47
+ });
48
+ return true;
49
+ }
36
50
  constructor() {
37
51
  this.transition = useTransitionStatus((open) => this.onOpenChangeComplete.emit(open));
52
+ this.generatedPanelId = injectId('rdx-collapsible-panel-');
53
+ this.panelIdState = signal(undefined, ...(ngDevMode ? [{ debugName: "panelIdState" }] : /* istanbul ignore next */ []));
38
54
  /** Reactive open/close transition phase (`'starting'` | `'ending'` | `undefined`). */
39
55
  this.transitionStatus = this.transition.status;
40
56
  /** Registers the panel element whose transition duration gates the close completion. */
@@ -63,7 +79,9 @@ class RdxCollapsibleRootDirective {
63
79
  */
64
80
  this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
65
81
  /** Stable id linking the trigger's `aria-controls` to the panel. */
66
- this.panelId = input(injectId('rdx-collapsible-panel-'), ...(ngDevMode ? [{ debugName: "panelId" }] : /* istanbul ignore next */ []));
82
+ this.panelId = input(undefined, ...(ngDevMode ? [{ debugName: "panelId" }] : /* istanbul ignore next */ []));
83
+ /** Stable id linking the trigger's `aria-controls` to the panel. */
84
+ this.resolvedPanelId = computed(() => this.panelIdState() ?? this.panelId() ?? this.generatedPanelId, ...(ngDevMode ? [{ debugName: "resolvedPanelId" }] : /* istanbul ignore next */ []));
67
85
  /** Composition fallbacks (see {@link CollapsibleRootContext}). Default `false`. */
68
86
  this.keepMountedContext = signal(false, ...(ngDevMode ? [{ debugName: "keepMountedContext" }] : /* istanbul ignore next */ []));
69
87
  this.hiddenUntilFoundContext = signal(false, ...(ngDevMode ? [{ debugName: "hiddenUntilFoundContext" }] : /* istanbul ignore next */ []));
@@ -120,32 +138,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
120
138
  }]
121
139
  }], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], defaultOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultOpen", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], panelId: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelId", required: false }] }], onOpenChange: [{ type: i0.Output, args: ["onOpenChange"] }], onOpenChangeComplete: [{ type: i0.Output, args: ["onOpenChangeComplete"] }] } });
122
140
 
123
- /**
124
- * Structural directive that mounts the collapsible panel contents only while open, unmounting them
125
- * once the exit animation finishes. Opt into this when the closed contents should leave the DOM;
126
- * otherwise apply `rdxCollapsiblePanel` directly (optionally with `keepMounted`).
127
- */
128
- class RdxCollapsiblePanelPresenceDirective {
129
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollapsiblePanelPresenceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
130
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxCollapsiblePanelPresenceDirective, isStandalone: true, selector: "ng-template[rdxCollapsiblePanelPresence]", providers: [
131
- provideRdxPresenceContext(() => ({
132
- present: injectCollapsibleRootContext().open
133
- }))
134
- ], hostDirectives: [{ directive: i1.RdxPresenceDirective }], ngImport: i0 }); }
135
- }
136
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollapsiblePanelPresenceDirective, decorators: [{
137
- type: Directive,
138
- args: [{
139
- selector: 'ng-template[rdxCollapsiblePanelPresence]',
140
- providers: [
141
- provideRdxPresenceContext(() => ({
142
- present: injectCollapsibleRootContext().open
143
- }))
144
- ],
145
- hostDirectives: [RdxPresenceDirective]
146
- }]
147
- }] });
148
-
149
141
  /**
150
142
  * Coerces a collapsible boolean input that distinguishes "not set" (`undefined`) from `false`,
151
143
  * so the Panel only overrides the shared context value when the consumer passes the input.
@@ -157,11 +149,22 @@ const optionalBoolean = (value) => value === undefined ? undefined : booleanAttr
157
149
  class RdxCollapsiblePanelDirective {
158
150
  constructor() {
159
151
  this.elementRef = inject(ElementRef);
152
+ this.renderer = inject(Renderer2);
153
+ this.destroyRef = inject(DestroyRef);
154
+ this.marker = this.renderer.createComment('rdx-collapsible-panel');
155
+ this.parentNode = null;
156
+ this.isAttached = true;
160
157
  this.rootContext = injectCollapsibleRootContext();
158
+ /**
159
+ * Optional explicit panel id. When set, the trigger's `aria-controls` points to this id.
160
+ *
161
+ * @group Props
162
+ */
163
+ this.id = input(undefined, { ...(ngDevMode ? { debugName: "id" } : /* istanbul ignore next */ {}), alias: 'id' });
161
164
  /**
162
165
  * Whether to keep the element in the DOM while the panel is closed.
163
- * When `true`, the closed panel keeps its element (no `hidden` attribute) so the consumer's
164
- * `data-closed` CSS is responsible for visually collapsing it.
166
+ * When `true`, the closed panel keeps its element and receives the `hidden` attribute once the
167
+ * close transition finishes.
165
168
  *
166
169
  * @group Props
167
170
  * @defaultValue false
@@ -177,14 +180,18 @@ class RdxCollapsiblePanelDirective {
177
180
  this.hiddenUntilFound = input(undefined, { ...(ngDevMode ? { debugName: "hiddenUntilFound" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
178
181
  this.height = signal(null, ...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
179
182
  this.width = signal(null, ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
183
+ /** Mirrors Base UI's `shouldRender`: hidden panels unmount unless kept for search/measurement. */
184
+ this.shouldRender = computed(() => this.rootContext.keepMounted() ||
185
+ this.rootContext.hiddenUntilFound() ||
186
+ this.rootContext.mounted() ||
187
+ this.rootContext.open(), ...(ngDevMode ? [{ debugName: "shouldRender" }] : /* istanbul ignore next */ []));
180
188
  /**
181
- * The `hidden` attribute value. The panel is shown while open or while its exit transition runs;
182
- * a kept-mounted panel stays visible (the consumer collapses it via CSS); otherwise the closed
183
- * panel is hidden — with `until-found` when find-in-page support is requested.
189
+ * The `hidden` attribute value. The panel is shown while open or while its exit transition runs.
190
+ * A kept-mounted panel remains in the DOM but is still hidden while closed.
184
191
  */
185
192
  this.hidden = computed(() => {
186
193
  const visible = this.rootContext.open() || this.rootContext.transitionStatus() === 'ending';
187
- if (visible || this.rootContext.keepMounted()) {
194
+ if (visible) {
188
195
  return undefined;
189
196
  }
190
197
  return this.rootContext.hiddenUntilFound() ? 'until-found' : '';
@@ -195,7 +202,24 @@ class RdxCollapsiblePanelDirective {
195
202
  */
196
203
  this.isFirstMeasure = true;
197
204
  const unregister = this.rootContext.registerTransitionElement(this.elementRef.nativeElement);
198
- inject(DestroyRef).onDestroy(unregister);
205
+ this.destroyRef.onDestroy(unregister);
206
+ this.insertMarker();
207
+ const unlistenBeforeMatch = this.renderer.listen(this.elementRef.nativeElement, 'beforematch', (event) => {
208
+ this.rootContext.setOpen(true, 'none', event);
209
+ });
210
+ this.destroyRef.onDestroy(() => {
211
+ unlistenBeforeMatch();
212
+ this.removeMarker();
213
+ });
214
+ effect(() => {
215
+ this.rootContext.setPanelIdState(this.id());
216
+ });
217
+ this.destroyRef.onDestroy(() => {
218
+ this.rootContext.setPanelIdState(undefined);
219
+ });
220
+ effect(() => {
221
+ this.syncRenderedState();
222
+ });
199
223
  // Forward the Panel inputs into the shared context, but only when the consumer actually
200
224
  // sets them — so Accordion's context writes are never clobbered by the Panel defaults.
201
225
  effect(() => {
@@ -219,6 +243,38 @@ class RdxCollapsiblePanelDirective {
219
243
  this.updateDimensions();
220
244
  });
221
245
  }
246
+ insertMarker() {
247
+ const host = this.elementRef.nativeElement;
248
+ const parent = this.renderer.parentNode(host);
249
+ if (!parent) {
250
+ return;
251
+ }
252
+ this.parentNode = parent;
253
+ this.renderer.insertBefore(parent, this.marker, host);
254
+ }
255
+ removeMarker() {
256
+ const parent = this.renderer.parentNode(this.marker);
257
+ if (parent) {
258
+ this.renderer.removeChild(parent, this.marker);
259
+ }
260
+ }
261
+ syncRenderedState() {
262
+ const parent = this.parentNode;
263
+ if (!parent) {
264
+ return;
265
+ }
266
+ const host = this.elementRef.nativeElement;
267
+ const shouldRender = this.shouldRender();
268
+ if (shouldRender && !this.isAttached) {
269
+ this.renderer.insertBefore(parent, host, this.renderer.nextSibling(this.marker));
270
+ this.isAttached = true;
271
+ return;
272
+ }
273
+ if (!shouldRender && this.isAttached) {
274
+ this.renderer.removeChild(parent, host);
275
+ this.isAttached = false;
276
+ }
277
+ }
222
278
  updateDimensions() {
223
279
  const node = this.elementRef.nativeElement;
224
280
  if (!node)
@@ -246,7 +302,7 @@ class RdxCollapsiblePanelDirective {
246
302
  this.isFirstMeasure = false;
247
303
  }
248
304
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollapsiblePanelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
249
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxCollapsiblePanelDirective, isStandalone: true, selector: "[rdxCollapsiblePanel]", inputs: { keepMounted: { classPropertyName: "keepMounted", publicName: "keepMounted", isSignal: true, isRequired: false, transformFunction: null }, hiddenUntilFound: { classPropertyName: "hiddenUntilFound", publicName: "hiddenUntilFound", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "rootContext.panelId()", "attr.data-open": "rootContext.open() ? \"\" : undefined", "attr.data-closed": "rootContext.open() ? undefined : \"\"", "attr.data-disabled": "rootContext.disabled() ? \"\" : undefined", "attr.data-starting-style": "rootContext.transitionStatus() === \"starting\" ? \"\" : undefined", "attr.data-ending-style": "rootContext.transitionStatus() === \"ending\" ? \"\" : undefined", "attr.hidden": "hidden()", "style.--collapsible-panel-width.px": "width()", "style.--collapsible-panel-height.px": "height()" } }, ngImport: i0 }); }
305
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxCollapsiblePanelDirective, isStandalone: true, selector: "[rdxCollapsiblePanel]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, keepMounted: { classPropertyName: "keepMounted", publicName: "keepMounted", isSignal: true, isRequired: false, transformFunction: null }, hiddenUntilFound: { classPropertyName: "hiddenUntilFound", publicName: "hiddenUntilFound", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "rootContext.panelId()", "attr.data-open": "rootContext.open() ? \"\" : undefined", "attr.data-closed": "rootContext.open() ? undefined : \"\"", "attr.data-disabled": "rootContext.disabled() ? \"\" : undefined", "attr.data-starting-style": "rootContext.transitionStatus() === \"starting\" ? \"\" : undefined", "attr.data-ending-style": "rootContext.transitionStatus() === \"ending\" ? \"\" : undefined", "attr.hidden": "hidden()", "style.--collapsible-panel-width.px": "width()", "style.--collapsible-panel-height.px": "height()" } }, ngImport: i0 }); }
250
306
  }
251
307
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollapsiblePanelDirective, decorators: [{
252
308
  type: Directive,
@@ -264,48 +320,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
264
320
  '[style.--collapsible-panel-height.px]': 'height()'
265
321
  }
266
322
  }]
267
- }], ctorParameters: () => [], propDecorators: { keepMounted: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepMounted", required: false }] }], hiddenUntilFound: [{ type: i0.Input, args: [{ isSignal: true, alias: "hiddenUntilFound", required: false }] }] } });
323
+ }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], keepMounted: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepMounted", required: false }] }], hiddenUntilFound: [{ type: i0.Input, args: [{ isSignal: true, alias: "hiddenUntilFound", required: false }] }] } });
268
324
 
269
325
  /**
270
326
  * A button that opens and closes the collapsible panel.
271
327
  */
272
328
  class RdxCollapsibleTriggerDirective {
273
329
  constructor() {
330
+ this.elementRef = inject(ElementRef);
274
331
  this.rootContext = injectCollapsibleRootContext();
275
332
  }
333
+ handleClick(event) {
334
+ this.rootContext.toggle(event, this.elementRef.nativeElement);
335
+ }
276
336
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollapsibleTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
277
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxCollapsibleTriggerDirective, isStandalone: true, selector: "[rdxCollapsibleTrigger]", host: { listeners: { "click": "rootContext.toggle()" }, properties: { "attr.aria-controls": "rootContext.panelId()", "attr.aria-expanded": "rootContext.open()", "attr.data-panel-open": "rootContext.open() ? \"\" : undefined", "attr.data-disabled": "rootContext.disabled() ? \"\" : undefined", "attr.disabled": "rootContext.disabled() || undefined" } }, ngImport: i0 }); }
337
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxCollapsibleTriggerDirective, isStandalone: true, selector: "[rdxCollapsibleTrigger]", host: { listeners: { "click": "handleClick($event)" }, properties: { "attr.aria-controls": "rootContext.open() ? rootContext.panelId() : undefined", "attr.aria-expanded": "rootContext.open()", "attr.data-panel-open": "rootContext.open() ? \"\" : undefined", "attr.data-disabled": "rootContext.disabled() ? \"\" : undefined", "attr.aria-disabled": "rootContext.disabled() ? \"true\" : undefined" } }, ngImport: i0 }); }
278
338
  }
279
339
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollapsibleTriggerDirective, decorators: [{
280
340
  type: Directive,
281
341
  args: [{
282
342
  selector: '[rdxCollapsibleTrigger]',
283
343
  host: {
284
- '[attr.aria-controls]': 'rootContext.panelId()',
344
+ '[attr.aria-controls]': 'rootContext.open() ? rootContext.panelId() : undefined',
285
345
  '[attr.aria-expanded]': 'rootContext.open()',
286
346
  '[attr.data-panel-open]': 'rootContext.open() ? "" : undefined',
287
347
  '[attr.data-disabled]': 'rootContext.disabled() ? "" : undefined',
288
- '[attr.disabled]': 'rootContext.disabled() || undefined',
289
- '(click)': 'rootContext.toggle()'
348
+ '[attr.aria-disabled]': 'rootContext.disabled() ? "true" : undefined',
349
+ '(click)': 'handleClick($event)'
290
350
  }
291
351
  }]
292
352
  }] });
293
353
 
294
- const _imports = [
295
- RdxCollapsiblePanelDirective,
296
- RdxCollapsibleRootDirective,
297
- RdxCollapsibleTriggerDirective,
298
- RdxCollapsiblePanelPresenceDirective
299
- ];
354
+ const _imports = [RdxCollapsiblePanelDirective, RdxCollapsibleRootDirective, RdxCollapsibleTriggerDirective];
300
355
  class RdxCollapsibleModule {
301
356
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollapsibleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
302
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: RdxCollapsibleModule, imports: [RdxCollapsiblePanelDirective,
303
- RdxCollapsibleRootDirective,
304
- RdxCollapsibleTriggerDirective,
305
- RdxCollapsiblePanelPresenceDirective], exports: [RdxCollapsiblePanelDirective,
306
- RdxCollapsibleRootDirective,
307
- RdxCollapsibleTriggerDirective,
308
- RdxCollapsiblePanelPresenceDirective] }); }
357
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: RdxCollapsibleModule, imports: [RdxCollapsiblePanelDirective, RdxCollapsibleRootDirective, RdxCollapsibleTriggerDirective], exports: [RdxCollapsiblePanelDirective, RdxCollapsibleRootDirective, RdxCollapsibleTriggerDirective] }); }
309
358
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollapsibleModule }); }
310
359
  }
311
360
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollapsibleModule, decorators: [{
@@ -320,5 +369,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
320
369
  * Generated bundle index. Do not edit.
321
370
  */
322
371
 
323
- export { RdxCollapsibleModule, RdxCollapsiblePanelDirective, RdxCollapsiblePanelPresenceDirective, RdxCollapsibleRootDirective, RdxCollapsibleTriggerDirective, injectCollapsibleRootContext, provideCollapsibleRootContext };
372
+ export { RdxCollapsibleModule, RdxCollapsiblePanelDirective, RdxCollapsibleRootDirective, RdxCollapsibleTriggerDirective, injectCollapsibleRootContext, provideCollapsibleRootContext };
324
373
  //# sourceMappingURL=radix-ng-primitives-collapsible.mjs.map