context.ts 842 B

12345678910111213141516171819202122232425
  1. import React from 'react';
  2. import { RadioChangeEvent } from '@douyinfe/semi-foundation/radio/radioInnerFoundation';
  3. import { strings } from '@douyinfe/semi-foundation/radio/constants';
  4. import { ArrayElement } from '../_base/base';
  5. export type RadioGroupButtonSize = ArrayElement<typeof strings.BUTTON_SIZE>;
  6. export type RadioMode = ArrayElement<typeof strings.MODE>;
  7. export interface RadioContextValue {
  8. mode?: RadioMode;
  9. radioGroup?: {
  10. value?: string | number;
  11. isButtonRadio?: any;
  12. disabled?: boolean;
  13. prefixCls?: string;
  14. name?: string;
  15. onChange?: (e: RadioChangeEvent) => void;
  16. buttonSize?: RadioGroupButtonSize;
  17. isCardRadio?: boolean;
  18. isPureCardRadio?: boolean;
  19. };
  20. }
  21. const Context = React.createContext<RadioContextValue>(null);
  22. export default Context;