Align props with figma

This commit is contained in:
adilallo
2026-02-04 16:52:03 -07:00
parent ee9784271f
commit af7e2d3e51
53 changed files with 1287 additions and 108 deletions
@@ -3,11 +3,13 @@
import { memo, useCallback, useId } from "react";
import { RadioButtonView } from "./RadioButton.view";
import type { RadioButtonProps } from "./RadioButton.types";
import { normalizeMode, normalizeState } from "../../../lib/propNormalization";
const RadioButtonContainer = ({
checked = false,
mode = "standard",
state = "default", // This state prop is now only for static display in Storybook/Preview
mode: modeProp = "standard",
state: stateProp = "default", // This state prop is now only for static display in Storybook/Preview
indicator = true, // From Figma: whether to show the indicator dot
disabled = false,
label,
onChange,
@@ -17,6 +19,13 @@ const RadioButtonContainer = ({
ariaLabel,
className = "",
}: RadioButtonProps) => {
// Normalize props to handle both PascalCase (Figma) and lowercase (codebase)
const mode = normalizeMode(modeProp);
const state = normalizeState(stateProp);
// If state is "selected", it means checked in Figma terms
const normalizedState = state === "selected" || checked ? "selected" : state;
const isInverse = mode === "inverse";
const isStandard = mode === "standard";
@@ -113,7 +122,7 @@ const RadioButtonContainer = ({
radioId={radioId}
checked={checked}
mode={mode}
state={state} // Passed for static display in Storybook/Preview
state={normalizedState} // Normalized state (handles "selected" from Figma)
disabled={disabled}
label={label}
name={name}