import * as i0 from '@angular/core';
import { OnInit, InputSignal, InputSignalWithTransform, Signal, ModelSignal, OutputEmitterRef } from '@angular/core';
/** Sort direction — three states */
type SortDirection = 'asc' | 'desc' | undefined;
/** Configures the three-state sort cycle */
type SortCycle = SortDirection[];
/** Emitted when sort state changes */
interface SortEvent {
/** The active column id, or undefined if unsorted */
active: string | undefined;
/** The sort direction */
direction: SortDirection;
}
/**
* @tokens `--color-foreground`, `--color-muted-foreground`
*/
declare const sortHeaderVariants: (props?: {
sortable?: boolean;
active?: boolean;
disabled?: boolean;
}) => string;
/**
* @tokens `--color-foreground`, `--color-muted-foreground`
*/
declare const sortIconVariants: (props?: {
size?: 'sm' | 'md' | 'lg';
state?: 'asc' | 'desc' | 'unsorted' | 'hidden';
}) => string;
/**
* Sortable header component — child of [comSort] directive.
*
* Apply to table headers, div columns, or any clickable element that should trigger sorting.
*
* @tokens `--color-foreground`, `--color-muted-foreground`, `--color-disabled-foreground`
*
* @example Basic usage
* ```html
*
* | Name |
* Age |
*
* ```
*
* @example Arrow placement
* ```html
* Name |
* ```
*/
declare class ComSortHeader implements OnInit {
private readonly sort;
private readonly destroyRef;
private readonly elementRef;
/** The column id — aliased from the selector */
readonly id: InputSignal;
/** Disable sorting for this specific header */
readonly sortHeaderDisabled: InputSignalWithTransform;
/** Override parent's sortShowIndicator for this header */
readonly sortHeaderShowIndicator: InputSignal;
/** Arrow placement relative to content */
readonly sortHeaderArrowPosition: InputSignal<'before' | 'after'>;
/** Whether this header is the currently active sort column */
readonly isActive: Signal;
/** Current direction if active, undefined otherwise */
readonly direction: Signal;
/** Whether this header is sorted (active + has direction) */
readonly isSorted: Signal;
/** Whether to show the muted indicator when unsorted */
readonly showUnsortedIndicator: Signal;
/** Whether sorting is disabled for this header */
readonly isDisabled: Signal;
/** Role — only set on non- elements (th has implicit columnheader role) */
readonly hostRole: Signal<'columnheader' | null>;
/** aria-sort attribute value */
readonly ariaSort: Signal<'ascending' | 'descending' | 'none'>;
/** CVA-generated host classes */
readonly hostClasses: Signal;
constructor();
ngOnInit(): void;
protected onClick(): void;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵcmp: i0.ɵɵComponentDeclaration;
}
/**
* Parent directive that manages sort state for a group of sortable headers.
*
* Apply to a container element (e.g., ``, ``) that contains `[comSortHeader]` children.
* Children inject this directive via DI and read its signals directly.
*
* @tokens `--color-foreground`, `--color-muted-foreground`
*
* @example Basic usage
* ```html
*
* | Name |
* Age |
*
* ```
*
* @example Two-way binding
* ```html
*
* | Name |
*
* ```
*/
declare class ComSort {
/** Currently active sort column id — two-way via model() */
readonly sortActive: ModelSignal;
/** Current sort direction — two-way via model() */
readonly sortDirection: ModelSignal;
/** Disables all sorting in this container */
readonly sortDisabled: InputSignalWithTransform;
/** Customize the click cycle (e.g., ['asc', 'desc'] to skip unsorted) */
readonly sortCycle: InputSignal;
/** Show a muted arrow on unsorted headers */
readonly sortShowIndicator: InputSignalWithTransform;
/** Emitted when active column or direction changes */
readonly sortChange: OutputEmitterRef;
private readonly headers;
/** Register a sort header with this parent */
register(header: ComSortHeader): void;
/** Deregister a sort header */
deregister(id: string): void;
/** Programmatically sort by a column */
sort(id: string): void;
/** Returns the next direction in the cycle for a given column */
getNextDirection(id: string): SortDirection;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵdir: i0.ɵɵDirectiveDeclaration;
}
export { ComSort, ComSortHeader, sortHeaderVariants, sortIconVariants };
export type { SortCycle, SortDirection, SortEvent };
|