import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; /** Consumer `aria-label`, `aria-labelledby` and `aria-describedby` go to the input. */ type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Current value of the input. * @default "" */ value?: string; /** * Specify a custom id for the input. * @default uniqueId() */ id?: string; /** * Screen-reader label for the input. */ labelText: string; /** * Label for the edit button. */ editLabel: string; /** * Label for the save button. */ saveLabel: string; /** * Label for the cancel button. */ cancelLabel: string; /** * By default the edit button is shown on hover only. * @default false */ editAlwaysVisible?: boolean; /** * Set to `true` to have the input inherit the container's font settings. * `size` still clamps the input's vertical size. * @default false */ inheritTypography?: boolean; /** * Set to `true` to indicate an invalid state. * @default false */ invalid?: boolean; /** * Specify the invalid state text. * @default "" */ invalidText?: string; /** * Specify the input placeholder text. */ placeholder?: string | undefined; /** * Set to `true` to select the input's text when entering edit mode. * @default false */ selectTextOnFocus?: boolean; /** * Set to `true` to disable the field entirely: no edit affordance, not * focusable. Use `readonly` instead to keep the field visible and * focusable while explaining why it can't be edited. * @default false */ disabled?: boolean; /** * Set to `true` to disable editing. * @default false */ readonly?: boolean; /** * Label for the "edit off" icon shown in readonly mode. Defaults to * `"Edit off"`. */ readonlyLabel?: string | undefined; /** * Toggletip text shown in readonly mode, explaining why the field can't * be edited. Defaults to `"This field is read-only and cannot be edited"`. */ readonlyToggletipText?: string | undefined; /** * Vertical size of the control: 24px (`"xs"`), 40px (`"sm"`), 48px (`"md"`) * or 64px (`"lg"`). In a DataTable cell, `"xs"` fits a `compact` row. * @default "sm" */ size?: "xs" | "sm" | "md" | "lg"; /** * Obtain a reference to the outer HTML element. * @default null */ ref?: null | HTMLDivElement; [key: `data-${string}`]: unknown; }; export type InlineEditProps = Omit<$RestProps, keyof $Props> & $Props; export default class InlineEdit extends SvelteComponentTyped< InlineEditProps, { /** Forwarded after the auto-save/auto-cancel decision runs. */ blur: CustomEvent; /** Fires on the cancel button, or on blur/Escape with no real change. */ cancel: CustomEvent; /** Fires on the save button, or on blur/Enter with a changed value. */ save: CustomEvent; }, Record > {}