"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextArea = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("@chakra-ui/react");
/**
 * TextArea component using Chakra UI's Textarea with BFUI theme customizations
 */
const TextArea = ({ label, error, helperText, size = 'md', isRequired = false, maxRows, minRows = 3, isResizable = true, id, placeholder, ...rest }) => {
    const inputId = id || label?.toLowerCase().replace(/\s+/g, '-');
    const bg = (0, react_1.useColorModeValue)('white', 'gray.800');
    const borderColor = (0, react_1.useColorModeValue)('gray.200', 'gray.600');
    // Calculate rows based on minRows and maxRows
    const rows = maxRows ? Math.min(Math.max(minRows, maxRows), maxRows) : minRows;
    return ((0, jsx_runtime_1.jsxs)(react_1.FormControl, { isInvalid: !!error, isRequired: isRequired, children: [label && (0, jsx_runtime_1.jsx)(react_1.FormLabel, { htmlFor: inputId, children: label }), (0, jsx_runtime_1.jsx)(react_1.Textarea, { id: inputId, size: size, bg: bg, borderColor: borderColor, rows: rows, resize: isResizable ? 'vertical' : 'none', placeholder: placeholder, _hover: {
                    borderColor: (0, react_1.useColorModeValue)('gray.300', 'gray.500'),
                }, _focus: {
                    borderColor: 'blue.500',
                    boxShadow: 'outline',
                }, ...rest }), error ? ((0, jsx_runtime_1.jsx)(react_1.FormErrorMessage, { children: error })) : helperText ? ((0, jsx_runtime_1.jsx)(react_1.FormHelperText, { children: helperText })) : null] }));
};
exports.TextArea = TextArea;
exports.default = exports.TextArea;
//# sourceMappingURL=TextArea.js.map