radioButton.js 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. "use client";
  2. var __rest = this && this.__rest || function (s, e) {
  3. var t = {};
  4. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
  5. if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  6. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
  7. }
  8. return t;
  9. };
  10. import * as React from 'react';
  11. import { ConfigContext } from '../config-provider';
  12. import { RadioOptionTypeContextProvider } from './context';
  13. import Radio from './radio';
  14. const RadioButton = (props, ref) => {
  15. const {
  16. getPrefixCls
  17. } = React.useContext(ConfigContext);
  18. const {
  19. prefixCls: customizePrefixCls
  20. } = props,
  21. radioProps = __rest(props, ["prefixCls"]);
  22. const prefixCls = getPrefixCls('radio', customizePrefixCls);
  23. return /*#__PURE__*/React.createElement(RadioOptionTypeContextProvider, {
  24. value: "button"
  25. }, /*#__PURE__*/React.createElement(Radio, Object.assign({
  26. prefixCls: prefixCls
  27. }, radioProps, {
  28. type: "radio",
  29. ref: ref
  30. })));
  31. };
  32. export default /*#__PURE__*/React.forwardRef(RadioButton);