wix-style-react
Version:
wix-style-react
90 lines • 4.43 kB
TypeScript
export default FormField;
declare class FormField extends React.Component<any, any, any> {
static displayName: string;
static propTypes: {
/** when function, it receives object with:
* * `setCharactersLeft` - function accepts a number and will display it on top right of `FormField` component
*
* Note that alternatively you can also use `charCount` prop to display character count
* instead of using the render function method.
*/
/** Accept any kind of component as a child element. A child should be a form element like an Input, InputArea, Dropdown or RichTextArea. */
children: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.ReactNodeLike>>;
/** Applies a data-hook HTML attribute that can be used in tests. */
dataHook: PropTypes.Requireable<string>;
/** Input id used for connecting label to the input element using native ```for``` attribute
*
* ```js
* <FormField id="myFormField" label="Hello">
* <Input id="myFormField"/>
* </FormField>
* ```
*/
id: PropTypes.Requireable<string>;
/** Displays a passed info message in a tooltip. Default value is a text string, but it can also be overridden with any other component. */
infoContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
/** Allows control over the tooltip style and behaviour by passed tooltip properties.
* @linkTypeTo components-overlays--tooltip
* @setTypeName TooltipCommonProps
*/
infoTooltipProps: PropTypes.Requireable<PropTypes.InferProps<any>>;
/** Sets a field label. It’s default value is a text string, but it can be overridden with any other component. */
label: PropTypes.Requireable<PropTypes.ReactNodeLike>;
/** Controls the label alignment */
labelAlignment: PropTypes.Requireable<string>;
/** Controls the label placement */
labelPlacement: PropTypes.Requireable<string>;
/** Controls the size of label */
labelSize: PropTypes.Requireable<string>;
/** Marks a field as mandatory with an asterisk (*) at the end of a label. */
required: PropTypes.Requireable<boolean>;
/** Defines whether or not the content (children container) grows when there's space available. Otherwise, it only uses the necessary space. */
stretchContent: PropTypes.Requireable<boolean>;
/** Adds a custom element at the end of the label row (it overrides the charCount in case it's provided). */
suffix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
/** Sets the maximum length for the field value. Character count is displayed in the top right corner of a component. */
charCount: PropTypes.Requireable<number>;
/** Sets the id of the label */
labelId: PropTypes.Requireable<string>;
/** Sets the status message. It is displayed bellow the child component*/
statusMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
/** Sets the type of status message, to give it appropriate colors and icons */
status: PropTypes.Requireable<string>;
};
static defaultProps: {
required: boolean;
stretchContent: boolean;
labelSize: string;
labelPlacement: string;
labelAlignment: string;
};
constructor(props: any);
labelId: any;
statusId: string;
state: {
lengthLeft: undefined;
};
childrenRenderPropInterface: {
setCharactersLeft: (lengthLeft: any) => void;
};
_renderChildren(): any;
_hasCharCounter: () => boolean;
charactersLeft: (lengthLeft: any) => React.JSX.Element;
_renderCharCounter: () => React.JSX.Element | undefined;
_renderInfoIcon: () => any;
_renderLabelWithIndicators: ({ labelSize }: {
labelSize: any;
}) => React.JSX.Element;
_renderSuffix: () => any;
_hasInlineElements: (label: any, labelPlacement: any) => any;
_renderLabel: ({ trimLongText, labelSize }: {
trimLongText: any;
labelSize: any;
}) => React.JSX.Element;
_renderStatusIcon: () => React.JSX.Element;
_renderStatusMessage: () => React.JSX.Element;
render(): React.JSX.Element;
}
import React from 'react';
import PropTypes from 'prop-types';
//# sourceMappingURL=FormField.d.ts.map