Skip to content

Commit

Permalink
[useRadioGroup] Convert to TypeScript (#29326)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Oct 28, 2021
1 parent 75c7050 commit 5eb4f31
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 23 deletions.
12 changes: 0 additions & 12 deletions packages/mui-material/src/RadioGroup/RadioGroupContext.js

This file was deleted.

18 changes: 18 additions & 0 deletions packages/mui-material/src/RadioGroup/RadioGroupContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as React from 'react';

export interface RadioGroupContextValue {
name: string | undefined;
onChange: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void;
value: any;
}

/**
* @ignore - internal component.
*/
const RadioGroupContext = React.createContext<RadioGroupContextValue | undefined>(undefined);

if (process.env.NODE_ENV !== 'production') {
RadioGroupContext.displayName = 'RadioGroupContext';
}

export default RadioGroupContext;
5 changes: 0 additions & 5 deletions packages/mui-material/src/RadioGroup/useRadioGroup.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/mui-material/src/RadioGroup/useRadioGroup.js

This file was deleted.

8 changes: 8 additions & 0 deletions packages/mui-material/src/RadioGroup/useRadioGroup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as React from 'react';
import RadioGroupContext, { RadioGroupContextValue } from './RadioGroupContext';

export interface RadioGroupState extends RadioGroupContextValue {}

export default function useRadioGroup(): RadioGroupState | undefined {
return React.useContext(RadioGroupContext);
}

0 comments on commit 5eb4f31

Please sign in to comment.