Update radio buttons

This commit is contained in:
2026-02-14 16:55:54 -05:00
parent 6c86fdd58b
commit 1743ed6ce4
11 changed files with 33 additions and 99 deletions

View File

@@ -1,25 +1,19 @@
import type { RadioButtonProps } from "$/types/InputTypes"; import type { RadioButtonProps } from "$/types/InputTypes";
import clsx from "clsx"; import clsx from "clsx";
import { forwardRef } from "react";
import RadioButton from "./RadioButton"; import RadioButton from "./RadioButton";
const DangerRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({ export default function DangerRadioButton({
className, className,
...props ...props
}, ref ) => { }: Readonly<RadioButtonProps>){
return ( return (
<RadioButton <RadioButton
className={clsx( className={clsx(
"group-data-checked:bg-danger", "group-data-checked:bg-danger",
className className
)} )}
ref={ref}
{...props} {...props}
/> />
); );
}); }
DangerRadioButton.displayName = "DangerRadioButton";
export default DangerRadioButton;

View File

@@ -1,25 +1,19 @@
import type { RadioButtonProps } from "$/types/InputTypes"; import type { RadioButtonProps } from "$/types/InputTypes";
import clsx from "clsx"; import clsx from "clsx";
import { forwardRef } from "react";
import RadioButton from "./RadioButton"; import RadioButton from "./RadioButton";
const DarkRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({ export default function DarkRadioButton({
className, className,
...props ...props
}, ref ) => { }: Readonly<RadioButtonProps>){
return ( return (
<RadioButton <RadioButton
className={clsx( className={clsx(
"group-data-checked:bg-dark", "group-data-checked:bg-dark",
className className
)} )}
ref={ref}
{...props} {...props}
/> />
); );
}); }
DarkRadioButton.displayName = "DarkRadioButton";
export default DarkRadioButton;

View File

@@ -1,25 +1,19 @@
import type { RadioButtonProps } from "$/types/InputTypes"; import type { RadioButtonProps } from "$/types/InputTypes";
import clsx from "clsx"; import clsx from "clsx";
import { forwardRef } from "react";
import RadioButton from "./RadioButton"; import RadioButton from "./RadioButton";
const InfoRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({ export default function InfoRadioButton({
className, className,
...props ...props
}, ref ) => { }: Readonly<RadioButtonProps>){
return ( return (
<RadioButton <RadioButton
className={clsx( className={clsx(
"group-data-checked:bg-cyan-500", "group-data-checked:bg-cyan-500",
className className
)} )}
ref={ref}
{...props} {...props}
/> />
); );
}); }
InfoRadioButton.displayName = "InfoRadioButton";
export default InfoRadioButton;

View File

@@ -1,25 +1,19 @@
import type { RadioButtonProps } from "$/types/InputTypes"; import type { RadioButtonProps } from "$/types/InputTypes";
import clsx from "clsx"; import clsx from "clsx";
import { forwardRef } from "react";
import RadioButton from "./RadioButton"; import RadioButton from "./RadioButton";
const LightRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({ export default function LightRadioButton({
className, className,
...props ...props
}, ref ) => { }: Readonly<RadioButtonProps>){
return ( return (
<RadioButton <RadioButton
className={clsx( className={clsx(
"group-data-checked:bg-light", "group-data-checked:bg-light",
className className
)} )}
ref={ref}
{...props} {...props}
/> />
); );
}); }
LightRadioButton.displayName = "LightRadioButton";
export default LightRadioButton;

View File

@@ -1,25 +1,19 @@
import type { RadioButtonProps } from "$/types/InputTypes"; import type { RadioButtonProps } from "$/types/InputTypes";
import clsx from "clsx"; import clsx from "clsx";
import { forwardRef } from "react";
import RadioButton from "./RadioButton"; import RadioButton from "./RadioButton";
const MoltenRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({ export default function MoltenRadioButton({
className, className,
...props ...props
}, ref ) => { }: Readonly<RadioButtonProps>){
return ( return (
<RadioButton <RadioButton
className={clsx( className={clsx(
"group-data-checked:bg-molten", "group-data-checked:bg-molten",
className className
)} )}
ref={ref}
{...props} {...props}
/> />
); );
}); }
MoltenRadioButton.displayName = "MoltenRadioButton";
export default MoltenRadioButton;

View File

@@ -1,25 +1,19 @@
import type { RadioButtonProps } from "$/types/InputTypes"; import type { RadioButtonProps } from "$/types/InputTypes";
import clsx from "clsx"; import clsx from "clsx";
import { forwardRef } from "react";
import RadioButton from "./RadioButton"; import RadioButton from "./RadioButton";
const PrimaryRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({ export default function PrimaryRadioButton({
className, className,
...props ...props
}, ref ) => { }: Readonly<RadioButtonProps>){
return ( return (
<RadioButton <RadioButton
className={clsx( className={clsx(
"group-data-checked:bg-primary", "group-data-checked:bg-primary",
className className
)} )}
ref={ref}
{...props} {...props}
/> />
); );
}); }
PrimaryRadioButton.displayName = "PrimaryRadioButton";
export default PrimaryRadioButton;

View File

@@ -1,10 +1,9 @@
import type { RadioButtonProps } from "$/types/InputTypes"; import type { RadioButtonProps } from "$/types/InputTypes";
import { Radio } from "@headlessui/react"; import { Radio } from "@headlessui/react";
import clsx from "clsx"; import clsx from "clsx";
import { forwardRef } from "react";
const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({ export default function RadioButton({
id = crypto.randomUUID().replaceAll("-", ""), id = crypto.randomUUID().replaceAll("-", ""),
className, className,
labelClassName, labelClassName,
@@ -12,7 +11,7 @@ const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
value, value,
disabled, disabled,
children children
}, ref ) => { }: Readonly<RadioButtonProps>){
return ( return (
<Radio <Radio
id={id} id={id}
@@ -28,7 +27,6 @@ const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
)} )}
disabled={disabled} disabled={disabled}
aria-labelledby={`${id}Label`} aria-labelledby={`${id}Label`}
ref={ref}
> >
<div <div
className={clsx( className={clsx(
@@ -55,8 +53,4 @@ const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
} }
</Radio> </Radio>
); );
}); }
RadioButton.displayName = "RadioButton";
export default RadioButton;

View File

@@ -1,25 +1,19 @@
import type { RadioButtonProps } from "$/types/InputTypes"; import type { RadioButtonProps } from "$/types/InputTypes";
import clsx from "clsx"; import clsx from "clsx";
import { forwardRef } from "react";
import RadioButton from "./RadioButton"; import RadioButton from "./RadioButton";
const SecondaryRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({ export default function SecondaryRadioButton({
className, className,
...props ...props
}, ref ) => { }: Readonly<RadioButtonProps>){
return ( return (
<RadioButton <RadioButton
className={clsx( className={clsx(
"group-data-checked:bg-secondary", "group-data-checked:bg-secondary",
className className
)} )}
ref={ref}
{...props} {...props}
/> />
); );
}); }
SecondaryRadioButton.displayName = "SecondaryRadioButton";
export default SecondaryRadioButton;

View File

@@ -1,25 +1,19 @@
import type { RadioButtonProps } from "$/types/InputTypes"; import type { RadioButtonProps } from "$/types/InputTypes";
import clsx from "clsx"; import clsx from "clsx";
import { forwardRef } from "react";
import RadioButton from "./RadioButton"; import RadioButton from "./RadioButton";
const SuccessRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({ export default function SuccessRadioButton({
className, className,
...props ...props
}, ref ) => { }: Readonly<RadioButtonProps>){
return ( return (
<RadioButton <RadioButton
className={clsx( className={clsx(
"group-data-checked:bg-green-600", "group-data-checked:bg-green-600",
className className
)} )}
ref={ref}
{...props} {...props}
/> />
); );
}); }
SuccessRadioButton.displayName = "SuccessRadioButton";
export default SuccessRadioButton;

View File

@@ -1,25 +1,19 @@
import type { RadioButtonProps } from "$/types/InputTypes"; import type { RadioButtonProps } from "$/types/InputTypes";
import clsx from "clsx"; import clsx from "clsx";
import { forwardRef } from "react";
import RadioButton from "./RadioButton"; import RadioButton from "./RadioButton";
const TertiaryRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({ export default function TertiaryRadioButton({
className, className,
...props ...props
}, ref ) => { }: Readonly<RadioButtonProps>){
return ( return (
<RadioButton <RadioButton
className={clsx( className={clsx(
"group-data-checked:bg-tertiary", "group-data-checked:bg-tertiary",
className className
)} )}
ref={ref}
{...props} {...props}
/> />
); );
}); }
TertiaryRadioButton.displayName = "TertiaryRadioButton";
export default TertiaryRadioButton;

View File

@@ -1,25 +1,19 @@
import type { RadioButtonProps } from "$/types/InputTypes"; import type { RadioButtonProps } from "$/types/InputTypes";
import clsx from "clsx"; import clsx from "clsx";
import { forwardRef } from "react";
import RadioButton from "./RadioButton"; import RadioButton from "./RadioButton";
const WarningRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({ export default function WarningRadioButton({
className, className,
...props ...props
}, ref ) => { }: Readonly<RadioButtonProps>){
return ( return (
<RadioButton <RadioButton
className={clsx( className={clsx(
"group-data-checked:bg-warning", "group-data-checked:bg-warning",
className className
)} )}
ref={ref}
{...props} {...props}
/> />
); );
}); }
WarningRadioButton.displayName = "WarningRadioButton";
export default WarningRadioButton;