"use client";
'use strict';

var jsxRuntime = require('react/jsx-runtime');
var reactIcons_esm = require('../../node_modules/.pnpm/@radix-ui_react-icons@1.3.2_react@19.2.1/node_modules/@radix-ui/react-icons/dist/react-icons.esm.cjs');
var index = require('../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.cjs');
var React = require('react');
var tooltip = require('../tooltip/tooltip.cjs');
var chip = require('../chip/chip.cjs');
var inputField_module = require('./input-field.module.css.cjs');

// Todo: Add a dropdown support
const inputWrapper = index.cva(inputField_module.default.inputWrapper, {
    variants: {
        size: {
            small: inputField_module.default['size-small'],
            large: inputField_module.default['size-large']
        },
        variant: {
            default: inputField_module.default['variant-default'],
            borderless: inputField_module.default['variant-borderless']
        }
    },
    defaultVariants: {
        size: 'large',
        variant: 'default'
    }
});
const InputField = React.forwardRef(({ className, disabled, label, helperText, placeholder, error, leadingIcon, trailingIcon, optional, prefix, suffix, width, chips, maxChipsVisible = 2, size, infoTooltip, variant = 'default', ...props }, ref) => {
    return (jsxRuntime.jsxs("div", { className: inputField_module.default.container, style: { width: width || '100%' }, children: [label && (jsxRuntime.jsxs("div", { className: inputField_module.default.labelContainer, children: [jsxRuntime.jsxs("label", { className: index.cx(inputField_module.default.label, disabled && inputField_module.default['label-disabled']), children: [label, optional && jsxRuntime.jsx("span", { className: inputField_module.default.optional, children: "(optional)" })] }), infoTooltip && (jsxRuntime.jsx(tooltip.Tooltip, { message: infoTooltip, side: 'right', children: jsxRuntime.jsx("span", { className: inputField_module.default.helpIcon, children: jsxRuntime.jsx(reactIcons_esm.InfoCircledIcon, {}) }) }))] })), jsxRuntime.jsxs("div", { className: index.cx(inputWrapper({ size, variant, className }), error && inputField_module.default['input-error-wrapper'], disabled && inputField_module.default['input-disabled-wrapper'], chips?.length && inputField_module.default['has-chips']), children: [leadingIcon && (jsxRuntime.jsx("div", { className: inputField_module.default['leading-icon'], children: leadingIcon })), prefix && jsxRuntime.jsx("div", { className: inputField_module.default.prefix, children: prefix }), jsxRuntime.jsxs("div", { className: inputField_module.default['chip-input-container'], children: [chips?.slice(0, maxChipsVisible).map((chip$1, index) => (jsxRuntime.jsx(chip.Chip, { variant: 'outline', isDismissible: !!chip$1.onRemove, onDismiss: chip$1.onRemove, className: inputField_module.default.chip, children: chip$1.label }, index))), chips && chips.length > maxChipsVisible && (jsxRuntime.jsxs("span", { className: inputField_module.default['chip-overflow'], children: ["+", chips.length - maxChipsVisible] })), jsxRuntime.jsx("input", { ref: ref, className: index.cx(inputField_module.default['input-field'], leadingIcon && inputField_module.default['has-leading-icon'], trailingIcon && inputField_module.default['has-trailing-icon'], prefix && inputField_module.default['has-prefix'], suffix && inputField_module.default['has-suffix'], error && inputField_module.default['input-error'], disabled && inputField_module.default['input-disabled'], className), "aria-invalid": !!error, placeholder: placeholder, disabled: disabled, ...props })] }), suffix && jsxRuntime.jsx("div", { className: inputField_module.default.suffix, children: suffix }), trailingIcon && (jsxRuntime.jsx("div", { className: inputField_module.default['trailing-icon'], children: trailingIcon }))] }), (error || helperText) && (jsxRuntime.jsx("span", { className: index.cx(inputField_module.default['helper-text'], error && inputField_module.default['helper-text-error'], disabled && inputField_module.default['helper-text-disabled']), children: error || helperText }))] }));
});
InputField.displayName = 'InputField';

exports.InputField = InputField;
//# sourceMappingURL=input-field.cjs.map
