UNPKG

@carbon/ibm-products

Version:

Carbon for IBM Products

106 lines (105 loc) 3.09 kB
/** * Copyright IBM Corp. 2022, 2022 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import React, { PropsWithChildren } from 'react'; type Size = 'sm' | 'md' | 'lg'; type AlignPropType = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right'; type Shape = { cancel: AlignPropType; edit: AlignPropType; save: AlignPropType; }; export interface EditInplaceProps extends PropsWithChildren { /** * label for cancel button */ cancelLabel: string; /** * By default the edit icon is shown on hover only. */ editAlwaysVisible?: boolean; /** * label for edit button */ editLabel: string; /** * Specify a custom id for the input */ id: string; /** * inheritTypography - causes the text entry field to inherit typography settings * assigned to the container. This is useful when editing titles for instance. * * NOTE: The size property limits the vertical size of the input element. * Inherited font's should be selected to fit within the size selected. */ inheritTypography?: boolean; /** * determines if the input is invalid */ invalid?: boolean; /** * text that is displayed if the input is invalid */ invalidText?: string; /** * Provide the text that will be read by a screen reader when visiting this control */ labelText: string; /** * handler to add custom onBlur event */ onBlur?: (value: string) => void; /** * handler that is called when the cancel button is pressed or when the user removes focus from the input and there is no new value */ onCancel: (value: string) => void; /** * handler that is called when the input is updated */ onChange: (value: string) => void; /** * handler that is called when the save button is pressed or when the user removes focus from the input if it has a new value */ onSave: () => void; /** * determines if the input is in readOnly mode */ /** * label for the edit button that displays when in read only mode */ /** * label for save button */ saveLabel: string; /** * vertical size of control */ size?: Size; /** * tooltipAlignment from the standard tooltip. Default center. * * Can be passed either as one of tooltip options or as an object specifying cancel, edit and save separately */ tooltipAlignment?: AlignPropType | Shape; /** * current value of the input */ value: string; /** * placeholder for the input */ placeholder?: string; } export declare let EditInPlace: React.ForwardRefExoticComponent<EditInplaceProps & React.RefAttributes<HTMLDivElement>>; export declare const deprecatedProps: { /** * **Deprecated** * invalidLabel was misnamed, using invalidText to match Carbon */ invalidText: any; }; export {};