UNPKG

hoda-react

Version:

<div align="center"> <h1>:construction: flowbite-react (unreleased) :construction:</h1> <p> <a href="https://flowbite-react.com"> <img alt="Flowbite - Tailwind CSS components" width="350" src=".github/assets/flowbite-react-github.png"> <

12 lines (11 loc) 1.53 kB
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import classNames from 'classnames'; import { forwardRef } from 'react'; import { mergeDeep } from '../../helpers/mergeDeep'; import { useTheme } from '../Flowbite/ThemeContext'; import { HelperText } from '../HelperText'; export const TextInput = forwardRef(({ sizing = 'md', shadow, helperText, addon, icon: Icon, rightIcon: RightIcon, color = 'gray', className, theme: customTheme = {}, ...props }, ref) => { const theme = mergeDeep(useTheme().theme.textInput, customTheme); return (_jsxs(_Fragment, { children: [_jsxs("div", { className: classNames(theme.base, className), children: [addon && _jsx("span", { className: theme.addon, children: addon }), _jsxs("div", { className: theme.field.base, children: [Icon && (_jsx("div", { className: theme.field.icon.base, children: _jsx(Icon, { className: theme.field.icon.svg }) })), RightIcon && (_jsx("div", { "data-testid": "right-icon", className: theme.field.rightIcon.base, children: _jsx(RightIcon, { className: theme.field.rightIcon.svg }) })), _jsx("input", { className: classNames(theme.field.input.base, theme.field.input.colors[color], theme.field.input.withIcon[Icon ? 'on' : 'off'], theme.field.input.withAddon[addon ? 'on' : 'off'], theme.field.input.withShadow[shadow ? 'on' : 'off'], theme.field.input.sizes[sizing]), ...props, ref: ref })] })] }), helperText && _jsx(HelperText, { color: color, children: helperText })] })); }); TextInput.displayName = 'TextInput';