UNPKG

@ozen-ui/kit

Version:

React component library

20 lines (19 loc) 1.24 kB
import { __assign, __rest } from "tslib"; import React from 'react'; import { useThemeProps } from '../../../../hooks/useThemeProps'; import { cn } from '../../../../utils/classname'; import { polymorphicComponentWithRef } from '../../../../utils/polymorphicComponentWithRef'; import { File } from '../../../FileNext'; import { useFileUploaderContext } from '../../context'; import { FILE_UPLOADER_LIST_ITEM_DEFAULT_TAG, FILE_UPLOADER_SIZE_TO_LIST_FILE_SIZE, } from './constants'; export var cnFileUploaderListItem = cn('FileUploaderListItem'); export var FileUploaderListItem = polymorphicComponentWithRef(function (inProps, ref) { var props = useThemeProps({ props: inProps, name: 'FileUploaderListItem', }); var _a = props.as, as = _a === void 0 ? FILE_UPLOADER_LIST_ITEM_DEFAULT_TAG : _a, className = props.className, children = props.children, other = __rest(props, ["as", "className", "children"]); var size = useFileUploaderContext().size; return (React.createElement(File, __assign({}, other, { as: as, ref: ref, className: cnFileUploaderListItem('', [className]), size: FILE_UPLOADER_SIZE_TO_LIST_FILE_SIZE[size] }), children)); }); FileUploaderListItem.displayName = 'FileUploaderListItem';