/** * EDC Sort Controls Component * * Reusable sort controls with dropdown and direction toggle. * * @customElement edc-sort-controls */ import { css, html, LitElement } from 'lit'; import { customElement, property } from 'lit/decorators.js'; export interface SortOption { value: string; label: string; } export type SortDirection = 'asc' | 'desc'; @customElement('edc-sort-controls') export class EdcSortControls extends LitElement { @property({ type: Array }) options: SortOption[] = []; @property({ type: String }) value: string = ''; @property({ type: String }) direction: SortDirection = 'asc'; private handleSortChange(e: Event) { const select = e.target as HTMLSelectElement; this.dispatchEvent(new CustomEvent('sort-change', { detail: { value: select.value, direction: this.direction }, bubbles: true, composed: true })); } private toggleDirection() { const newDirection: SortDirection = this.direction === 'asc' ? 'desc' : 'asc'; this.dispatchEvent(new CustomEvent('sort-change', { detail: { value: this.value, direction: newDirection }, bubbles: true, composed: true })); } render() { return html`