UNPKG

@ozen-ui/kit

Version:

React component library

20 lines (19 loc) 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.List = exports.cnList = void 0; var tslib_1 = require("tslib"); require("./List.css"); var react_1 = tslib_1.__importDefault(require("react")); var useThemeProps_1 = require("../../hooks/useThemeProps"); var classname_1 = require("../../utils/classname"); var polymorphicComponentWithRef_1 = require("../../utils/polymorphicComponentWithRef"); var constants_1 = require("./constants"); var ListContext_1 = require("./ListContext"); exports.cnList = (0, classname_1.cn)('List'); exports.List = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) { var props = (0, useThemeProps_1.useThemeProps)({ props: inProps, name: 'List' }); var _a = props.as, Tag = _a === void 0 ? constants_1.LIST_DEFAULT_TAG : _a, _b = props.size, size = _b === void 0 ? constants_1.LIST_DEFAULT_SIZE : _b, _c = props.disablePadding, disablePadding = _c === void 0 ? constants_1.LIST_DEFAULT_DISABLE_PADDING : _c, children = props.children, className = props.className, other = tslib_1.__rest(props, ["as", "size", "disablePadding", "children", "className"]); return (react_1.default.createElement(ListContext_1.ListContext.Provider, { value: { size: size } }, react_1.default.createElement(Tag, tslib_1.__assign({ className: (0, exports.cnList)({ size: size, disablePadding: disablePadding }, [className]) }, other, { ref: ref }), children))); }); exports.List.displayName = 'List';