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

fix: Radio, CheckboxのProps型を修正 #1560

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 5 additions & 3 deletions packages/for-ui/src/checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { FC, forwardRef, ReactNode } from 'react';
import { ComponentPropsWithRef, FC, forwardRef, ReactNode } from 'react';
import { MdCheck, MdRemove } from 'react-icons/md';
import MuiCheckbox, { CheckboxProps as MuiCheckboxProps } from '@mui/material/Checkbox';
import { fsx } from '../system/fsx';
import { TextDefaultStyler } from '../system/TextDefaultStyler';
import { Text } from '../text';

export type CheckboxProps = MuiCheckboxProps & {
type InternalCheckboxProps = MuiCheckboxProps & {
label?: ReactNode;
nopadding?: boolean;
className?: string;
Expand All @@ -32,7 +32,7 @@ const Indicator: FC<{ state: 'default' | 'checked' | 'intermediate'; disabled: b
</span>
);

export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
export const Checkbox = forwardRef<HTMLInputElement, InternalCheckboxProps>(
({ label, nopadding = false, disabled, className, ...rest }, ref) => (
<Text as="label" className={fsx(`group inline-flex w-fit flex-row items-center gap-1`, className)}>
<MuiCheckbox
Expand All @@ -58,3 +58,5 @@ export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
</Text>
),
);

export type CheckboxProps = ComponentPropsWithRef<typeof Checkbox>;
8 changes: 5 additions & 3 deletions packages/for-ui/src/radio/Radio.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FC, forwardRef, ReactNode } from 'react';
import { ComponentPropsWithRef, FC, forwardRef, ReactNode } from 'react';
import MuiRadio, { RadioProps as MuiRadioProps } from '@mui/material/Radio';
import { fsx } from '../system/fsx';
import { TextDefaultStyler } from '../system/TextDefaultStyler';
import { Text } from '../text';

export type RadioProps = Omit<MuiRadioProps, 'ref'> & {
type InternalRadioProps = Omit<MuiRadioProps, 'ref'> & {
label?: ReactNode;
nopadding?: boolean;
className?: string;
Expand All @@ -20,7 +20,7 @@ const Indicator: FC<{ checked: boolean; disabled: boolean }> = ({ checked, disab
/>
);

export const Radio = forwardRef<HTMLInputElement, RadioProps>(
export const Radio = forwardRef<HTMLInputElement, InternalRadioProps>(
({ nopadding, label, value, disabled, className, ...rest }, ref) => (
<Text as="label" className={fsx(`inline-flex w-fit flex-row items-center gap-1`, className)}>
<MuiRadio
Expand Down Expand Up @@ -48,3 +48,5 @@ export const Radio = forwardRef<HTMLInputElement, RadioProps>(
</Text>
),
);

export type RadioProps = ComponentPropsWithRef<typeof Radio>;