UNPKG

@ozen-ui/kit

Version:

React component library

17 lines (16 loc) 1.23 kB
import { __assign, __rest } from "tslib"; import './List.css'; import React from 'react'; import { useThemeProps } from '../../hooks/useThemeProps'; import { cn } from '../../utils/classname'; import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef'; import { LIST_DEFAULT_SIZE, LIST_DEFAULT_TAG, LIST_DEFAULT_DISABLE_PADDING, } from './constants'; import { ListContext } from './ListContext'; export var cnList = cn('List'); export var List = polymorphicComponentWithRef(function (inProps, ref) { var props = useThemeProps({ props: inProps, name: 'List' }); var _a = props.as, Tag = _a === void 0 ? LIST_DEFAULT_TAG : _a, _b = props.size, size = _b === void 0 ? LIST_DEFAULT_SIZE : _b, _c = props.disablePadding, disablePadding = _c === void 0 ? LIST_DEFAULT_DISABLE_PADDING : _c, children = props.children, className = props.className, other = __rest(props, ["as", "size", "disablePadding", "children", "className"]); return (React.createElement(ListContext.Provider, { value: { size: size } }, React.createElement(Tag, __assign({ className: cnList({ size: size, disablePadding: disablePadding }, [className]) }, other, { ref: ref }), children))); }); List.displayName = 'List';