@ozen-ui/kit
Version:
React component library
28 lines (27 loc) • 2 kB
JavaScript
import { __assign, __rest } from "tslib";
import './PageListCard.css';
import React from 'react';
import { useThemeProps } from '../../../hooks/useThemeProps';
import { cn } from '../../../utils/classname';
import { polymorphicComponentWithRef } from '../../../utils/polymorphicComponentWithRef';
import { LIST_CARD_DEFAULT_BACKGROUND_COLOR_SCHEME, LIST_CARD_DEFAULT_CONTENT_TRAILING_RATIO, LIST_CARD_DEFAULT_INTERACTIVE, LIST_CARD_DEFAULT_SIZE, LIST_CARD_DEFAULT_TAG, } from '../constants';
import { ListCardContext } from '../ListCardContext';
export var cnPageListCard = cn('PageListCard');
export var PageListCard = polymorphicComponentWithRef(function (inProps, ref) {
var props = useThemeProps({
props: inProps,
name: 'PageListCard',
});
var _a = props.as, Tag = _a === void 0 ? LIST_CARD_DEFAULT_TAG : _a, children = props.children, borderColorScheme = props.borderColorScheme, _b = props.size, size = _b === void 0 ? LIST_CARD_DEFAULT_SIZE : _b, _c = props.contentTrailingRatio, contentTrailingRatio = _c === void 0 ? LIST_CARD_DEFAULT_CONTENT_TRAILING_RATIO : _c, _d = props.interactive, interactive = _d === void 0 ? LIST_CARD_DEFAULT_INTERACTIVE : _d, _e = props.backgroundColorScheme, backgroundColorScheme = _e === void 0 ? LIST_CARD_DEFAULT_BACKGROUND_COLOR_SCHEME : _e, className = props.className, other = __rest(props, ["as", "children", "borderColorScheme", "size", "contentTrailingRatio", "interactive", "backgroundColorScheme", "className"]);
return (React.createElement(ListCardContext.Provider, { value: {
variant: 'onPage',
size: size,
borderColorScheme: borderColorScheme,
backgroundColorScheme: backgroundColorScheme,
interactive: interactive,
contentTrailingRatio: contentTrailingRatio,
} },
React.createElement(Tag, __assign({}, other, { ref: ref, className: cnPageListCard({
size: size,
}, [className]) }), children)));
});