@ozen-ui/kit
Version:
React component library
17 lines (16 loc) • 1.34 kB
JavaScript
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, LIST_DEFAULT_COLOR, } 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, _d = props.color, color = _d === void 0 ? LIST_DEFAULT_COLOR : _d, other = __rest(props, ["as", "size", "disablePadding", "children", "className", "color"]);
return (React.createElement(ListContext.Provider, { value: { size: size } },
React.createElement(Tag, __assign({ className: cnList({ size: size, disablePadding: disablePadding, color: color }, [className]) }, other, { ref: ref }), children)));
});
List.displayName = 'List';