{"version":3,"file":"Text-Cu_ZXfQr.js","sources":["../../Client/legacy/Components/FormGroups/Text.tsx"],"sourcesContent":["import { Value } from '@webkit/index';\r\nimport * as React from 'react';\r\nimport { InlineError } from '../../FormFields';\r\nimport { FormGroup, IFormGroupProps } from './Base';\r\n\r\nexport interface ITextFormGroupProps extends IFormGroupProps {\r\n    /** The change handler to return the text value to the caller. */\r\n    onChange?: (e: any) => void;\r\n\r\n    /** The handler for the underlying input's blur event. */\r\n    onBlur?: (value: string) => void;\r\n\r\n    /** The handler for the underlying input's focus event. */\r\n    onFocus?: (value: string) => void;\r\n\r\n    /** The value containing input properties and validation state. */\r\n    value: Value<string>;\r\n\r\n    /** Optional. A text change handler that returns the current text value of the input. */\r\n    onTextChange?: (value: string) => void;\r\n\r\n    /** An optional placeholder string for the input field. */\r\n    placeholder?: string;\r\n\r\n    /** An optional CSS class for the input field. */\r\n    inputClassName?: string;\r\n\r\n    /** A flag indicating whether the input should be a multiline textarea. Defaults to false. */\r\n    multiline?: boolean;\r\n\r\n    /** A flag indicating whether errors should be suppressed.  */\r\n    error?: boolean;\r\n\r\n    /** The type of the input. Defaults to 'text'. */\r\n    type?: string;\r\n\r\n    /** Optional prop to turn the tooltip off for errors, but still show the error icon. */\r\n    hideToolTip?: boolean;\r\n\r\n    /** Optional. The value to set for the underlying input's autocomplete attribute. */\r\n    autoComplete?: string;\r\n\r\n    /** Optional, turn into Homeowners style input if true. */\r\n    homeownersStyle?: boolean;\r\n\r\n    /** Optional, add a max-length of characters to the field. */\r\n    maxLength?: number;\r\n\r\n    /** Optional. A flag indicating whether or not the field is disabled. Defaults to false. */\r\n    disabled?: boolean;\r\n\r\n    /** Optional. Set to true to remove all styles. Defaults to false. */\r\n    unstyled?: boolean;\r\n}\r\n\r\n/**\r\n * @deprecated The `TextFormGroup` component should no longer be used. Instead, use `Text` from @webkit for new development.\r\n */\r\nexport class TextFormGroup extends React.Component<ITextFormGroupProps, {}> {\r\n    private inputRef: HTMLInputElement | HTMLTextAreaElement | null;\r\n\r\n    constructor(props: ITextFormGroupProps) {\r\n        super(props);\r\n    }\r\n\r\n    render() {\r\n        const { id, ...p } = this.props,\r\n            inputProps = {\r\n                placeholder: p.placeholder,\r\n                onChange: e => {\r\n                    if (p.onChange) p.onChange(e);\r\n\r\n                    if (p.onTextChange) p.onTextChange(e.currentTarget.value);\r\n                },\r\n                onBlur: e => p.onBlur && p.onBlur(e.target.value),\r\n                onFocus: e => p.onFocus && p.onFocus(e.target.value),\r\n                value: p.value.content,\r\n                className: this.getInputClassName(),\r\n                tabIndex: p.tabIndex,\r\n                id,\r\n                type: p.type || 'text',\r\n                autoComplete: this.props.autoComplete ? this.props.autoComplete : 'false',\r\n                maxLength: this.props.maxLength,\r\n                disabled: p.disabled === undefined ? false : p.disabled,\r\n                name: this.props.id,\r\n            };\r\n\r\n        if (p.multiline)\r\n            p.className = (p.className || '') + ` form-group-multiline-cp${p.label ? '' : ' no-multiline-label-cp'}`;\r\n\r\n        return (\r\n            <FormGroup {...p}>\r\n                {p.multiline ? (\r\n                    <textarea\r\n                        {...inputProps}\r\n                        ref={c => {\r\n                            this.inputRef = c;\r\n                        }}\r\n                    />\r\n                ) : (\r\n                    <input\r\n                        {...inputProps}\r\n                        ref={c => {\r\n                            this.inputRef = c;\r\n                        }}\r\n                    />\r\n                )}\r\n                {(p.error === undefined || p.error) && (\r\n                    <InlineError\r\n                        error={p.value.error}\r\n                        noToolTip={p.hideToolTip ? p.hideToolTip : false}\r\n                        homeownerStyle={this.props.homeownersStyle}\r\n                    />\r\n                )}\r\n            </FormGroup>\r\n        );\r\n    }\r\n\r\n    focus() {\r\n        if (this.inputRef) this.inputRef.focus();\r\n    }\r\n\r\n    getInputClassName() {\r\n        if (this.props.unstyled) return '';\r\n\r\n        let className = 'form-group-input-cp';\r\n\r\n        if (this.props.homeownersStyle) className = 'ho-input-cp';\r\n        if (this.props.inputClassName) className += ` ${this.props.inputClassName}`;\r\n        if (this.props.error || this.props.value.error) className += ' form-group-input-error-cp';\r\n\r\n        if (this.props.multiline) {\r\n            if (this.props.homeownersStyle) className += ' ho-input-multiline-cp';\r\n            else className += ' form-group-input-multiline-cp';\r\n        }\r\n\r\n        return className;\r\n    }\r\n}\r\n"],"names":["TextFormGroup","React.Component","props","__publicField","id","p","inputProps","e","jsxs","FormGroup","jsx","c","InlineError","className"],"mappings":"uSA0Da,MAAAA,UAAsBC,EAAAA,SAAyC,CAGxE,YAAYC,EAA4B,CACpC,MAAMA,CAAK,EAHPC,EAAA,gBAGO,CAGf,QAAS,CACL,KAAM,CAAE,GAAAC,EAAI,GAAGC,CAAM,EAAA,KAAK,MACtBC,EAAa,CACT,YAAaD,EAAE,YACf,SAAeE,GAAA,CACPF,EAAE,UAAYA,EAAA,SAASE,CAAC,EAExBF,EAAE,cAAcA,EAAE,aAAaE,EAAE,cAAc,KAAK,CAC5D,EACA,UAAaF,EAAE,QAAUA,EAAE,OAAOE,EAAE,OAAO,KAAK,EAChD,WAAcF,EAAE,SAAWA,EAAE,QAAQE,EAAE,OAAO,KAAK,EACnD,MAAOF,EAAE,MAAM,QACf,UAAW,KAAK,kBAAkB,EAClC,SAAUA,EAAE,SACZ,GAAAD,EACA,KAAMC,EAAE,MAAQ,OAChB,aAAc,KAAK,MAAM,aAAe,KAAK,MAAM,aAAe,QAClE,UAAW,KAAK,MAAM,UACtB,SAAUA,EAAE,WAAa,OAAY,GAAQA,EAAE,SAC/C,KAAM,KAAK,MAAM,EACrB,EAEJ,OAAIA,EAAE,YACAA,EAAA,WAAaA,EAAE,WAAa,IAAM,2BAA2BA,EAAE,MAAQ,GAAK,wBAAwB,IAGtGG,EAAA,KAACC,EAAW,CAAA,GAAGJ,EACV,SAAA,CAAAA,EAAE,UACCK,EAAA,IAAC,WAAA,CACI,GAAGJ,EACJ,IAAUK,GAAA,CACN,KAAK,SAAWA,CAAA,CACpB,CAAA,EAGJD,EAAA,IAAC,QAAA,CACI,GAAGJ,EACJ,IAAUK,GAAA,CACN,KAAK,SA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