'use strict';

var jsxRuntime = require('../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
var index = require('../node_modules/.pnpm/class-variance-authority@0.6.0_typescript@5.4.3/node_modules/class-variance-authority/dist/index.cjs');
var React = require('react');
var flex = require('../flex/flex.cjs');
var textfield_module = require('./textfield.module.css.cjs');

const textfield = index.cva(textfield_module.default.textfield, {
    variants: {
        size: {
            small: textfield_module.default["textfield-sm"],
            medium: textfield_module.default["textfield-md"],
        },
        state: {
            invalid: textfield_module.default["textfield-invalid"],
            valid: textfield_module.default["textfield-valid"],
        },
        hasLeadingElement: {
            true: textfield_module.default["textfield-leading"],
        },
        hasTrailingElement: {
            true: textfield_module.default["textfield-trailing"],
        },
    },
    defaultVariants: {
        size: "small",
    },
});
const TextField = React.forwardRef(({ leading, trailing, className, src, size, state, style, iconClass, ...props }, ref) => {
    const hasLeadingElement = Boolean(leading);
    const hasTrailingElement = Boolean(trailing);
    return (jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { align: "center", style: { position: "relative", width: "100%" }, children: [hasLeadingElement ? (jsxRuntime.jsxRuntimeExports.jsx(flex.Flex, { style: { left: "8px" }, className: index.cx(textfield_module.default.leadingIcon, iconClass?.leadingIcon), children: leading })) : null, jsxRuntime.jsxRuntimeExports.jsx("input", { className: index.cx(textfield({
                    size,
                    state,
                    className,
                    hasLeadingElement,
                    hasTrailingElement,
                })), ...props, ref: ref }), hasTrailingElement ? (jsxRuntime.jsxRuntimeExports.jsx(flex.Flex, { style: { right: "8px" }, className: index.cx(textfield_module.default.trailingIcon, iconClass?.trailingIcon), children: trailing })) : null] }));
});
TextField.displayName = "TextField";

exports.TextField = TextField;
//# sourceMappingURL=textfield.cjs.map
