@ozen-ui/kit
Version:
React component library
18 lines (17 loc) • 1.17 kB
JavaScript
import { __assign, __rest } from "tslib";
import './FormGroup.css';
import React from 'react';
import { useThemeProps } from '../../hooks/useThemeProps';
import { cn } from '../../utils/classname';
import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
import { FORM_GROUP_DEFAULT_AS, FORM_GROUP_DEFAULT_DIRECTION, FORM_GROUP_DEFAULT_SIZE, } from './constants';
export var cnFormGroup = cn('FormGroup');
export var FormGroup = polymorphicComponentWithRef(function (inProps, ref) {
var props = useThemeProps({
props: inProps,
name: 'FormGroup',
});
var _a = props.direction, direction = _a === void 0 ? FORM_GROUP_DEFAULT_DIRECTION : _a, _b = props.as, Tag = _b === void 0 ? FORM_GROUP_DEFAULT_AS : _b, _c = props.size, size = _c === void 0 ? FORM_GROUP_DEFAULT_SIZE : _c, children = props.children, className = props.className, other = __rest(props, ["direction", "as", "size", "children", "className"]);
return (React.createElement(Tag, __assign({ className: cnFormGroup({ direction: direction, size: size }, [className]) }, other, { ref: ref }), children));
});
FormGroup.displayName = 'FormGroup';