From 1e8e0d3138089fe4c0ff6810ca8abd03589a1729 Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Thu, 12 Feb 2026 20:59:24 -0500 Subject: [PATCH] Update radio button with input suggestions --- .../input/checkbox/MattrixwvCheckbox.tsx | 11 ++--- lib/component/input/radio/RadioButton.tsx | 20 +++++++-- lib/types/InputTypes.ts | 2 +- src/util/InputUtils.tsx | 44 +++++++++---------- 4 files changed, 45 insertions(+), 32 deletions(-) diff --git a/lib/component/input/checkbox/MattrixwvCheckbox.tsx b/lib/component/input/checkbox/MattrixwvCheckbox.tsx index 317b6ae..22899a6 100644 --- a/lib/component/input/checkbox/MattrixwvCheckbox.tsx +++ b/lib/component/input/checkbox/MattrixwvCheckbox.tsx @@ -5,7 +5,7 @@ import { forwardRef } from "react"; const MattrixwvCheckbox = forwardRef(({ - id, + id = crypto.randomUUID().replaceAll("-", ""), className, labelClassName, name, @@ -17,7 +17,6 @@ const MattrixwvCheckbox = forwardRef(({ strokeWidth = 2, value, disabled, - ariaLabel, children }, ref ) => { return ( @@ -26,6 +25,7 @@ const MattrixwvCheckbox = forwardRef(({ className={clsx( "group", "flex flex-row items-center justify-start gap-x-2", + "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2", { "cursor-pointer": !disabled, "cursor-not-allowed": disabled @@ -37,7 +37,7 @@ const MattrixwvCheckbox = forwardRef(({ onChange={onChange} value={value} disabled={disabled} - aria-label={ariaLabel} + aria-labelledby={`${id}Label`} ref={ref} > {/* Checkbox */} @@ -73,11 +73,12 @@ const MattrixwvCheckbox = forwardRef(({ {/* Label */} { children && -
{children} -
+ } ); diff --git a/lib/component/input/radio/RadioButton.tsx b/lib/component/input/radio/RadioButton.tsx index 605382e..583835f 100644 --- a/lib/component/input/radio/RadioButton.tsx +++ b/lib/component/input/radio/RadioButton.tsx @@ -5,18 +5,29 @@ import { forwardRef } from "react"; const RadioButton = forwardRef(({ - id, + id = crypto.randomUUID().replaceAll("-", ""), className, labelClassName, size = "sm", value, + disabled, children }, ref ) => { return (
(({ /> { children && -
{children} -
+ } ); diff --git a/lib/types/InputTypes.ts b/lib/types/InputTypes.ts index a395eb0..cc41190 100644 --- a/lib/types/InputTypes.ts +++ b/lib/types/InputTypes.ts @@ -137,7 +137,6 @@ export interface CheckboxProps { strokeWidth?: number; value?: string; disabled?: boolean; - ariaLabel: string; children?: React.ReactNode; } @@ -149,6 +148,7 @@ export interface RadioButtonProps { labelClassName?: string; size?: RadioButtonSize; value: string; + disabled?: boolean; children?: React.ReactNode; } diff --git a/src/util/InputUtils.tsx b/src/util/InputUtils.tsx index f3676a7..f50d951 100644 --- a/src/util/InputUtils.tsx +++ b/src/util/InputUtils.tsx @@ -687,32 +687,32 @@ export function CheckboxContent(){ >
- Default - Primary - Secondary - Tertiary - Info - Success - Warning - Danger - Molten - Light - Dark + Default + Primary + Secondary + Tertiary + Info + Success + Warning + Danger + Molten + Light + Dark
- Default - Primary - Secondary - Tertiary - Info - Success - Warning - Danger - Molten - Light - Dark + Default + Primary + Secondary + Tertiary + Info + Success + Warning + Danger + Molten + Light + Dark