UNPKG

@appbuckets/react-ui

Version:
38 lines (35 loc) 1.15 kB
import { __rest, __assign } from 'tslib'; import * as React from 'react'; import clsx from 'clsx'; import { createShorthandFactory, useElementType, childrenUtils, } from '@appbuckets/react-ui-core'; import { useSharedClassName } from '../utils/customHook.js'; import '../BucketTheme/BucketTheme.js'; import { useWithDefaultProps } from '../BucketTheme/BucketContext.js'; /* -------- * Component Render * -------- */ var Column = function (receivedProps) { var props = useWithDefaultProps('column', receivedProps); var _a = useSharedClassName(props), className = _a.className, _b = _a.rest, children = _b.children, content = _b.content, rest = __rest(_b, ['children', 'content']); var ElementType = useElementType(Column, receivedProps, props); var classes = clsx('column', className); return React.createElement( ElementType, __assign({}, rest, { className: classes }), childrenUtils.isNil(children) ? content : children ); }; Column.displayName = 'Column'; Column.create = createShorthandFactory(Column, function (content) { return { content: content }; }); export { Column as default };