zmp-react
Version:
Build full featured iOS & Android apps using ZMP & React
45 lines (42 loc) • 1.27 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import React, { useRef, forwardRef, useImperativeHandle } from 'react';
import Radio from '../components/radio';
import { classNames } from '../shared/utils';
/* dts-props
id?: string | number;
className?: string;
style?: React.CSSProperties;
checked? : boolean
name? : number | string
value? : number | string | boolean
disabled? : boolean
readonly? : boolean
label?: string
defaultChecked? : boolean
COLOR_PROPS
onChange? : (event?: any) => void
ref?: React.MutableRefObject<{el: HTMLElement | null}>;
CHILDREN_PROP
*/
var ZMPRadio = /*#__PURE__*/forwardRef(function (props, ref) {
var elRef = useRef(null);
var label = props.label,
children = props.children,
className = props.className;
useImperativeHandle(ref, function () {
return elRef.current;
});
var radioLabel = null;
if (label) {
radioLabel = /*#__PURE__*/React.createElement("span", {
className: "zmp-radio-label"
}, label);
}
var classes = classNames(className, 'no-ripple');
return /*#__PURE__*/React.createElement(Radio, _extends({}, props, {
ref: elRef,
className: classes
}), radioLabel, children);
});
ZMPRadio.displayName = 'zmp-radio';
export default ZMPRadio;