import * as React from 'react'; import * as TextControlBase from '@tesseract-design/web-base-textcontrol'; export type UrlInputProps = Omit, 'size' | 'style'> & { /** * Short textual description indicating the nature of the component's value. */ label?: React.ReactNode, /** * Short textual description as guidelines for valid input values. */ hint?: React.ReactNode, /** * Size of the component. */ size?: TextControlBase.TextControlSize, /** * Additional description, usually graphical, indicating the nature of the component's value. */ indicator?: React.ReactNode, /** * Should the component display a border? */ border?: boolean, /** * Should the component occupy the whole width of its parent? */ block?: boolean, /** * Style of the component. */ style?: TextControlBase.TextControlStyle, /** * Is the label hidden? */ hiddenLabel?: boolean, } /** * Component for inputting URL values. */ export const UrlInput = React.forwardRef( ( { label = '', hint = '', indicator = null, size = TextControlBase.TextControlSize.MEDIUM, border = false, block = false, style = TextControlBase.TextControlStyle.DEFAULT, hiddenLabel = false, type: _type, className: _className, placeholder: _placeholder, as: _as, ...etcProps }: UrlInputProps, ref, ) => { const styleArgs = React.useMemo(() => ({ block, border, size, indicator: Boolean(indicator), style, resizable: false, predefinedValues: false, }), [block, border, size, indicator, style]); return (
{ border && ( ) } { label && !hiddenLabel && (
{label}
) } {hint && (
{hint}
)} {indicator && (
{indicator}
)}
); } ); UrlInput.displayName = 'UrlInput';