import { jsx, jsxs } from 'react/jsx-runtime';
import { Field, FieldLabel, FieldContent, FieldError, FieldDescription } from './primitives/Field.js';

function SelectFieldWrapper({ id, label, error, helpText, errorId, helpTextId, isDisabled, required, testIdPrefix, labelProps, className, children, }) {
    const hasField = !!(label || error || helpText);
    if (!hasField) {
        return (jsx("div", { className: className, ...(testIdPrefix
                ? { "data-testid": `${testIdPrefix}-select-container-wrapper` }
                : {}), children: children }));
    }
    return (jsxs(Field, { "data-disabled": isDisabled || undefined, "data-invalid": !!error || undefined, className: className, ...(testIdPrefix
            ? { "data-testid": `${testIdPrefix}-select-container-wrapper` }
            : {}), children: [label && (jsxs(FieldLabel, { htmlFor: id, ...labelProps, ...(testIdPrefix
                    ? { "data-testid": `${testIdPrefix}-input-label` }
                    : {}), children: [label, required && (jsx("span", { "aria-hidden": "true", className: "text-destructive", children: "*" }))] })), jsxs(FieldContent, { children: [children, !!error && (jsx(FieldError, { id: errorId, ...(testIdPrefix
                            ? { "data-testid": `${testIdPrefix}-select-error` }
                            : {}), children: error })), helpText && (jsx(FieldDescription, { id: helpTextId, ...(testIdPrefix
                            ? { "data-testid": `${testIdPrefix}-select-help-text` }
                            : {}), children: helpText }))] })] }));
}

export { SelectFieldWrapper as S };
//# sourceMappingURL=SelectFieldWrapper-BJzq9aCY.js.map
