/**
 * TyDropdown Web Component
 * PORTED FROM: clj/ty/components/dropdown.cljs
 *
 * A semantic dropdown component with:
 * - Desktop mode with smart positioning
 * - Mobile mode with full-screen modal
 * - Search and filtering capabilities
 * - Keyboard navigation
 * - Form association for native form submission
 * - Rich option support (option, ty-option, ty-tag)
 *
 * @example
 * ```html
 * <!-- Basic dropdown -->
 * <ty-dropdown label="Country" placeholder="Select country" required>
 *   <option value="us">United States</option>
 *   <option value="uk">United Kingdom</option>
 *   <option value="ca">Canada</option>
 * </ty-dropdown>
 *
 * <!-- With rich options -->
 * <ty-dropdown label="User" searchable>
 *   <ty-option value="1">
 *     <div class="flex items-center gap-2">
 *       <img src="avatar1.jpg" class="w-8 h-8 rounded-full" />
 *       <span>John Doe</span>
 *     </div>
 *   </ty-option>
 * </ty-dropdown>
 *
 * <!-- Not searchable (external search) -->
 * <ty-dropdown label="Search API" not-searchable>
 *   <option value="1">Result 1</option>
 * </ty-dropdown>
 * ```
 */
import type { Flavor, Size } from '../types/common.js';
import { TyComponent } from '../base/ty-component.js';
import type { PropertyChange } from '../utils/property-manager.js';
/**
 * Option data structure
 */
interface OptionData {
    value: string;
    text: string;
    element: HTMLElement;
}
/**
 * Component state structure
 */
interface DropdownState {
    open: boolean;
    search: string;
    highlightedIndex: number;
    filteredOptions: OptionData[];
    currentValue: string | null;
    mode: 'desktop' | 'mobile';
}
/**
 * Ty Dropdown Component
 */
export declare class TyDropdown extends TyComponent<DropdownState> {
    protected static properties: {
        value: {
            type: "string";
            visual: boolean;
            formValue: boolean;
            emitChange: boolean;
            default: string;
        };
        name: {
            type: "string";
            default: string;
        };
        placeholder: {
            type: "string";
            visual: boolean;
            default: string;
        };
        label: {
            type: "string";
            visual: boolean;
            default: string;
        };
        disabled: {
            type: "boolean";
            visual: boolean;
            default: boolean;
        };
        readonly: {
            type: "boolean";
            visual: boolean;
            default: boolean;
        };
        required: {
            type: "boolean";
            visual: boolean;
            default: boolean;
        };
        searchable: {
            type: "boolean";
            visual: boolean;
            default: boolean;
            aliases: {
                'not-searchable': boolean;
            };
        };
        clearable: {
            type: "boolean";
            visual: boolean;
            default: boolean;
            aliases: {
                'not-clearable': boolean;
            };
        };
        size: {
            type: "string";
            visual: boolean;
            default: string;
            validate: (v: any) => boolean;
            coerce: (v: any) => any;
        };
        flavor: {
            type: "string";
            visual: boolean;
            default: string;
            validate: (v: any) => boolean;
            coerce: (v: any) => any;
        };
        delay: {
            type: "number";
            default: number;
            validate: (v: any) => boolean;
            coerce: (v: any) => number;
        };
    };
    private _value;
    private _name;
    private _placeholder;
    private _label;
    private _disabled;
    private _readonly;
    private _required;
    private _searchable;
    private _clearable;
    private _size;
    private _flavor;
    private _state;
    private _scrollLockId;
    private _stubClickHandler;
    private _outsideClickHandler;
    private _optionClickHandler;
    private _searchInputHandler;
    private _searchBlurHandler;
    private _blockSearchClick;
    private _keyboardHandler;
    private _clearClickHandler;
    private _delay;
    private _searchDebounceTimer;
    constructor();
    render(): void;
    /**
     * Called when component is connected to DOM
     * TyComponent handles property capture automatically
     */
    protected onConnect(): void;
    /**
     * Called when component is disconnected from DOM
     * Clean up event listeners and timers
     */
    protected onDisconnect(): void;
    /**
     * Called when properties change
     * Handle state synchronization BEFORE render
     */
    protected onPropertiesChanged(changes: PropertyChange[]): void;
    /**
     * Get the form value for this component
     * TyComponent calls this automatically when formValue property changes
     */
    protected getFormValue(): FormDataEntryValue | null;
    /**
     * Parse dropdown value (single string)
     */
    private parseValue;
    /**
     * Validate flavor attribute
     */
    private validateFlavor;
    /**
     * Initialize component state from attributes
     */
    private initializeState;
    /**
     * Update placeholder text in existing rendered HTML
     * Called when placeholder changes after initial render
     */
    private updatePlaceholderInDOM;
    /**
     * Update form value via ElementInternals
     */
    /**
     * Get all option elements from slot
     * Supports: <option>, <ty-option>, <ty-tag>
     */
    private getOptions;
    /**
     * Extract value and text from option element
     */
    private getOptionData;
    /**
     * Clear all selections
     */
    private clearSelection;
    /**
     * Select an option
     */
    private selectOption;
    /**
     * Sync selected option based on current value
     */
    private syncSelectedOption;
    /**
     * Update component value attribute for consistency
     */
    private updateComponentValue;
    /**
     * Update selection display (show/hide placeholder)
     */
    private updateSelectionDisplay;
    private updateClearButton;
    /**
     * Dispatch change event
     */
    private dispatchChangeEvent;
    private filterOptions;
    private updateOptionVisibility;
    /**
     * Clear all option highlights
     */
    private clearHighlights;
    private highlightOption;
    /**
     * Setup event listeners
     */
    private setupDesktopEventListeners;
    /**
     * Lock scroll with consistent ID generation
     */
    private lockDropdownScroll;
    /**
     * Unlock scroll using stored ID
     */
    private unlockDropdownScroll;
    /**
     * Initialize options state when opening dropdown/modal
     * @param highlightSelected - Whether to highlight the currently selected option
     */
    private initializeOptionsState;
    /**
     * Base stub click handler - validates state then calls open callback
     * @param e - Click event
     * @param openCallback - Function to call to open (desktop or mobile)
     */
    private handleStubClickBase;
    /**
     * Base option click handler - finds option, selects it, then calls close callback
     * @param e - Click event
     * @param closeCallback - Function to call to close (desktop or mobile)
     */
    private handleOptionClickBase;
    /**
     * Base clear click handler - clears selection and optionally closes
     * @param e - Click event
     * @param closeCallback - Optional function to call to close (mobile only)
     */
    private handleClearClickBase;
    /**
     * Calculate and set dropdown position with smart direction detection
     */
    private calculateDesktopPosition;
    /**
     * Open dropdown dialog
     */
    private openDesktopDropdown;
    /**
     * Close dropdown dialog
     */
    private closeDesktopDropdown;
    /**
     * Handle outside click to close dropdown
     */
    private handleDesktopOutsideClick;
    /**
     * Handle search input changes
     */
    private handleSearchInput;
    /**
     * Handle search blur - DISABLED
     * Previously caused race conditions with option clicks.
     * Search reset now handled in closeDesktopDropdown() instead.
     */
    private handleSearchBlur;
    /**
     * Block search input click from bubbling
     * Prevents search input clicks from triggering outside click handler
     */
    private blockSearchClick;
    /**
     * Dispatch search event for external search handling
     * With optional delay/debounce support
     */
    private dispatchSearchEvent;
    /**
     * Fire the actual search event
     */
    private fireSearchEvent;
    /**
     * Handle keyboard navigation
     */
    private handleDesktopKeyboard;
    /**
     * Handle stub click - open dropdown
     */
    private handleDesktopStubClick;
    /**
     * Handle option click - select option and close
     */
    private handleDesktopOptionClick;
    /**
     * Handle clear button click - clear selection
     * CRITICAL: Must prevent dropdown from opening!
     */
    private handleDesktopClearClick;
    /**
     * Build CSS class list for stub
     */
    private buildStubClasses;
    /**
     * Render desktop mode with dialog
     */
    private renderDesktop;
    /**
     * Render mobile mode with full-screen modal
     */
    private renderMobile;
    /**
     * Setup event listeners for mobile mode
     */
    private setupMobileEventListeners;
    /**
     * Handle mobile stub click - open modal
     */
    private handleMobileStubClick;
    /**
     * Handle mobile option click - select and close
     */
    private handleMobileOptionClick;
    /**
     * Handle mobile keyboard navigation
     */
    private handleMobileKeyboard;
    /**
     * Handle clear click in mobile modal
     */
    private handleMobileClearClick;
    /**
       * Open mobile modal
       */
    private openMobileModal;
    /**
     * Close mobile modal
     */
    private closeMobileModal;
    get value(): string;
    set value(v: string);
    get name(): string;
    set name(v: string);
    get placeholder(): string;
    set placeholder(v: string);
    get label(): string;
    set label(v: string);
    get disabled(): boolean;
    set disabled(v: boolean);
    get readonly(): boolean;
    set readonly(v: boolean);
    get required(): boolean;
    set required(v: boolean);
    get searchable(): boolean;
    set searchable(v: boolean);
    get clearable(): boolean;
    set clearable(v: boolean);
    get size(): Size;
    set size(v: Size);
    get flavor(): Flavor;
    set flavor(v: Flavor);
    get delay(): number;
    set delay(v: number);
    get form(): HTMLFormElement | null;
}
export {};
//# sourceMappingURL=dropdown.d.ts.map