{"version":3,"sources":["input-group/input-group.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,oBAAY,eAAe,GAAG;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,GAAG,eAAe,CAAC;IAE1C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC;IAChE,SAAS,CAAC,EAAE;;;;;;iBAA2B;IAEvC,MAAM;CA2CT;;AAED,wBAAkE","file":"input-group.d.ts","sourcesContent":["/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n\nimport createFragment from 'react-addons-create-fragment';\nimport React from 'react';\nimport { createCn } from 'bem-react-classname';\nimport { withTheme } from '../cn';\n\nexport type InputGroupProps = {\n    /**\n     * Управление возможностью компонента занимать всю ширину родителя\n     */\n    width?: 'default' | 'available';\n\n    /**\n     * Дочерние элементы `InputGroup`, как правило, компоненты `Input`\n     */\n    children?: React.ReactNode;\n\n    /**\n     * Тема компонента\n     */\n    theme?: 'alfa-on-color' | 'alfa-on-white';\n\n    /**\n     * Дополнительный класс\n     */\n    className?: string;\n\n    /**\n     * Идентификатор компонента в DOM\n     */\n    id?: string;\n\n    /**\n     * Идентификатор для систем автоматизированного тестирования\n     */\n    'data-test-id'?: string;\n};\n\n/**\n * Компонент группы полей для текстового ввода.\n */\nexport class InputGroup extends React.PureComponent<InputGroupProps> {\n    protected cn = createCn('input-group');\n\n    render() {\n        let children = null;\n        const inputGroupParts = {};\n\n        if (this.props.children) {\n            children = (\n                (this.props.children as React.ReactNode[]).length\n                    ? this.props.children\n                    : [this.props.children]\n            );\n        }\n\n        if (children) {\n            React.Children.forEach(children, (input, index) => {\n                input = React.cloneElement(input, {\n                    width: this.props.width,\n                });\n\n                inputGroupParts[`input-${index}`] = (\n                    <span\n                        className={ this.cn('input-case', {\n                            invalid: !!input.props.error,\n                            disabled: input.props.disabled,\n                        }) }\n                    >\n                        { input }\n                    </span>\n                );\n            });\n        }\n\n        return (\n            <span\n                className={ `${this.cn({ width: this.props.width })} control-group` }\n                id={ this.props.id }\n                role=\"group\"\n                tabIndex={ -1 }\n                data-test-id={ this.props['data-test-id'] }\n            >\n                { createFragment(inputGroupParts) }\n            </span>\n        );\n    }\n}\n\nexport default withTheme<InputGroupProps, InputGroup>(InputGroup);\n"]}