import Gtk from "gi://Gtk"; import type { InputPurpose } from "../../../enums/gtk3-index"; import type { GjsContext } from "../../../reconciler/gjs-renderer"; import type { HostContext } from "../../../reconciler/host-context"; import { BaseElement, type GjsElement } from "../../gjs-element"; import { ElementLifecycleController } from "../../utils/element-extenders/element-lifecycle-controller"; import type { SyntheticEvent } from "../../utils/element-extenders/event-handlers"; import { EventHandlers } from "../../utils/element-extenders/event-handlers"; import type { DiffedProps } from "../../utils/element-extenders/map-properties"; import { PropertyMapper } from "../../utils/element-extenders/map-properties"; import type { AlignmentProps } from "../../utils/property-maps-factories/create-alignment-prop-mapper"; import type { ChildPropertiesProps } from "../../utils/property-maps-factories/create-child-props-mapper"; import type { ExpandProps } from "../../utils/property-maps-factories/create-expand-prop-mapper"; import type { MarginProps } from "../../utils/property-maps-factories/create-margin-prop-mapper"; import type { SizeRequestProps } from "../../utils/property-maps-factories/create-size-request-prop-mapper"; import type { StyleProps } from "../../utils/property-maps-factories/create-style-prop-mapper"; import type { TooltipProps } from "../../utils/property-maps-factories/create-tooltip-prop-mapper"; type TextEntryPropsMixin = ChildPropertiesProps & SizeRequestProps & AlignmentProps & MarginProps & ExpandProps & StyleProps & TooltipProps; export type TextEntryElementEvent
= {}> = SyntheticEvent
;
export interface TextEntryProps extends TextEntryPropsMixin {
value?: string;
capsLockWarning?: boolean;
disabled?: boolean;
type?: InputPurpose;
maxLength?: number;
placeholder?: string;
icon?: Rg.IconName;
iconTooltip?: string;
secondaryIcon?: Rg.IconName;
secondaryIconTooltip?: string;
progress?: number;
truncateMultilinePaste?: boolean;
suggestions?: string[];
/**
* The minimum number of characters that must be entered before
* suggestions are shown.
*
* @default 1
*/
suggestionMinInput?: number;
/**
* Whether the input value should be matched against the suggestions
* case sensitively.
*
* @default false
*/
suggestionCaseSensitive?: boolean;
/**
* If false, a phrase will only be considered a match if the input
* value is exactly the same as the beginning of a suggestion.
*
* @default true
*/
suggestionMatchAnywhere?: boolean;
onChange?: (event: TextEntryElementEvent<{
text: string;
}>) => void;
onEnter?: (event: TextEntryElementEvent) => void;
onKeyPress?: (event: TextEntryElementEvent