import { UiElement } from '../shared/element.js'; import type { Placement } from '../shared/position.js'; import { type EditInPlaceSize } from '../../core/edit-in-place.js'; import '../icon-button/icon-button.js'; import '../popover/popover.js'; export type { EditInPlaceSize } from '../../core/edit-in-place.js'; /** * Carbon for IBM Products `EditInPlace`: a value shown as plain text that is edited right where it is. Hovered, it * gets the field fill and an "Edit" button; focused (a click, Tab), it is a field with "Cancel" and "Save" buttons * (enabled once the value changed; a valid change can be saved). Enter saves and keeps editing (with nothing to save it * stops editing, the focus staying); Escape puts the value back; leaving it saves a valid change and otherwise puts the * value back. `invalid` draws the error border, a warning icon and `invalid-text` (described by the field); * `readonly` shows "Edit off", whose high-contrast popover says why. Sizes sm 40 / md 48 / lg 64. * * State on the host for styling: `data-editing` while it is a field (editing). * * @cssstate editing - While it is a field (editing) (also `[data-editing]`) * @fires input - On every keystroke (`value` already updated) * @fires ui-save - detail: { value } a change was saved (Save, Enter, leaving it) * @fires ui-cancel - detail: { value } the value was put back (Cancel, Escape, leaving it without a valid change) * @csspart base - The field box * @csspart input - The `` * @csspart actions - The buttons' box * @csspart invalid-text - The error message */ export declare class UiEditInPlace extends UiElement { static hostStates: readonly string[]; static readonly styles: import("lit").CSSResult; /** The value (as `.value`). */ value: string; /** The field's accessible name (Carbon `labelText`; there is no visible label). */ label: string; placeholder: string; size: EditInPlaceSize; invalid: boolean; invalidText: string; readonly: boolean; /** Show "Edit" without hovering. */ editAlwaysVisible: boolean; /** The field takes the surrounding type (a heading made editable). */ inheritTypography: boolean; /** Where the buttons' tooltips go (Carbon `tooltipAlignment`). */ tooltipPlacement: Placement; /** Where the read-only note goes (Carbon `toggleTipAlignment`). */ notePlacement: Placement; /** The buttons' names and the read-only note (defaults: the translation's "Edit", "Save", "Cancel", "Edit off", …). */ editLabel: string; saveLabel: string; cancelLabel: string; readonlyLabel: string; readonlyText: string; private editing; private noteOpen; /** The value when editing started or was last saved. */ private initial; private readonly input; private readonly localize; private readonly ids; connectedCallback(): void; protected willUpdate(changed: Map): void; protected updated(): void; focus(options?: FocusOptions): void; private get state(); private emit; private save; private cancel; /** Back in the field, the caret at the end. */ private refocus; private readonly onFocusIn; /** Focus leaving the whole control (not to one of its buttons): save a valid change, else put the value back. */ private readonly onFocusOut; /** The field's own `input` (composed) goes on to the host, after this listener (the value already updated). */ private readonly onInput; private readonly onKeydown; /** A click in the field (or "Edit") starts editing it; a read-only one shows why it can't be. */ private readonly onFieldClick; /** A press on a button keeps the focus in the field, so leaving isn't triggered on the way. */ private readonly keepFocus; private readonly onCancelClick; private readonly onSaveClick; private renderActions; render(): import("lit-html").TemplateResult<1>; } export interface UiEditInPlaceEventMap extends HTMLElementEventMap { 'ui-save': CustomEvent<{ value: string; }>; 'ui-cancel': CustomEvent<{ value: string; }>; } /** Typed listeners for UiEditInPlace's events (declaration merging with the class). */ export interface UiEditInPlace { addEventListener(type: K, listener: (this: UiEditInPlace, event: UiEditInPlaceEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: UiEditInPlace, event: UiEditInPlaceEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } declare global { interface HTMLElementTagNameMap { 'ui-edit-in-place': UiEditInPlace; } }