UNPKG

@ozen-ui/kit

Version:

React component library

28 lines (27 loc) 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ListCardItemLeadingRadio = exports.cnListCardItemLeadingRadio = void 0; var tslib_1 = require("tslib"); var react_1 = tslib_1.__importStar(require("react")); var useThemeProps_1 = require("../../../../hooks/useThemeProps"); var classname_1 = require("../../../../utils/classname"); var RadioNext_1 = require("../../../RadioNext"); var hooks_1 = require("../../hooks"); var ListCardItemContext_1 = require("../../ListCardItemContext"); var ListCardItemLeadingItem_1 = require("../ListCardItemLeadingItem"); var constants_1 = require("./constants"); exports.cnListCardItemLeadingRadio = (0, classname_1.cn)('ListCardItemLeadingRadio'); exports.ListCardItemLeadingRadio = (0, react_1.forwardRef)(function (inProps, ref) { var props = (0, useThemeProps_1.useThemeProps)({ props: inProps, name: 'ListCardItemLeadingRadio', }); var className = props.className, disabled = props.disabled, dataTestid = props["data-testid"], other = tslib_1.__rest(props, ["className", "disabled", 'data-testid']); var size = (0, ListCardItemContext_1.useListCardItemContext)().size; var radioSize = constants_1.LIST_CARD_ITEM_SIZE_TO_LEADING_RADIO_SIZE[size]; var radioRef = (0, react_1.useRef)(null); (0, hooks_1.useListCardItemAsInteractiveModule)(radioRef, !disabled); return (react_1.default.createElement(ListCardItemLeadingItem_1.ListCardItemLeadingItem, { ref: ref, className: (0, exports.cnListCardItemLeadingRadio)('', [className]), "data-testid": dataTestid }, react_1.default.createElement(RadioNext_1.Radio, tslib_1.__assign({}, other, { ref: radioRef, size: radioSize, disabled: disabled })))); }); exports.ListCardItemLeadingRadio.displayName = 'ListCardItemLeadingRadio';