Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(radio): radio with tailwind forms #46

Merged
merged 16 commits into from
Feb 1, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: radio types cleanup
  • Loading branch information
anuraghazra committed Jan 27, 2021
commit 8986b373e454234c5577de4de927fe814bee05be
10 changes: 6 additions & 4 deletions src/radio/useRadioState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,26 @@ import {
useCompositeState,
} from "reakit";

type StateType = string | number | undefined;

export type RadioState = CompositeState & {
/**
* The `value` attribute of the current checked radio.
*/
state: string | number | undefined;
state: StateType;
};

export type RadioActions = CompositeActions & {
/**
* Sets `state`.
*/
setState: React.Dispatch<React.SetStateAction<string | number | undefined>>;
setState: React.Dispatch<React.SetStateAction<StateType>>;
};

export type RadioInitialState = CompositeInitialState &
Partial<Pick<RadioState, "state">> & {
defaultState?: RadioState["state"];
onStateChange?: (v: RadioState["state"]) => void;
defaultState?: StateType;
onStateChange?: (v: StateType) => void;
};

export type RadioStateReturn = RadioState & RadioActions;
Expand Down