From 56ed528b4e3d1c01da2d22cf8e054aefeae48983 Mon Sep 17 00:00:00 2001 From: Richard Ward Date: Tue, 30 Dec 2025 12:59:35 +0000 Subject: [PATCH] code: fakemui,tsx,radiogroup (6 files) --- fakemui/fakemui/inputs/ButtonGroup.tsx | 2 +- fakemui/fakemui/inputs/FormControl.tsx | 2 +- fakemui/fakemui/inputs/NativeSelect.tsx | 2 +- fakemui/fakemui/inputs/RadioGroup.tsx | 2 +- fakemui/fakemui/surfaces/Card.tsx | 34 +++++++++++++++++++ .../src/components/get-component-icon.tsx | 16 ++++----- 6 files changed, 46 insertions(+), 12 deletions(-) diff --git a/fakemui/fakemui/inputs/ButtonGroup.tsx b/fakemui/fakemui/inputs/ButtonGroup.tsx index 80f44f8f9..eb6ba4414 100644 --- a/fakemui/fakemui/inputs/ButtonGroup.tsx +++ b/fakemui/fakemui/inputs/ButtonGroup.tsx @@ -4,7 +4,7 @@ import React, { forwardRef, Children, cloneElement, isValidElement } from 'react * Props for ButtonGroup component */ export interface ButtonGroupProps extends React.HTMLAttributes { - children: React.ReactNode + children?: React.ReactNode /** Button size to apply to all children */ size?: 'sm' | 'md' | 'lg' /** Button variant to apply to all children */ diff --git a/fakemui/fakemui/inputs/FormControl.tsx b/fakemui/fakemui/inputs/FormControl.tsx index b43a64b52..5cd6d138a 100644 --- a/fakemui/fakemui/inputs/FormControl.tsx +++ b/fakemui/fakemui/inputs/FormControl.tsx @@ -23,7 +23,7 @@ export const useFormControl = () => useContext(FormControlContext) * Props for FormControl component */ export interface FormControlProps extends React.HTMLAttributes { - children: React.ReactNode + children?: React.ReactNode /** Whether the field is required */ required?: boolean /** Whether the field is disabled */ diff --git a/fakemui/fakemui/inputs/NativeSelect.tsx b/fakemui/fakemui/inputs/NativeSelect.tsx index 913cd2653..f6e016426 100644 --- a/fakemui/fakemui/inputs/NativeSelect.tsx +++ b/fakemui/fakemui/inputs/NativeSelect.tsx @@ -5,7 +5,7 @@ import { useFormControl } from './FormControl' * Props for NativeSelect component */ export interface NativeSelectProps extends React.SelectHTMLAttributes { - children: React.ReactNode + children?: React.ReactNode /** Visual variant */ variant?: 'standard' | 'outlined' | 'filled' /** Icon component to use for dropdown indicator */ diff --git a/fakemui/fakemui/inputs/RadioGroup.tsx b/fakemui/fakemui/inputs/RadioGroup.tsx index 58f5836c0..5e2d97f5b 100644 --- a/fakemui/fakemui/inputs/RadioGroup.tsx +++ b/fakemui/fakemui/inputs/RadioGroup.tsx @@ -20,7 +20,7 @@ export const useRadioGroup = () => useContext(RadioGroupContext) * Props for RadioGroup component */ export interface RadioGroupProps extends Omit, 'onChange'> { - children: React.ReactNode + children?: React.ReactNode /** Name attribute for all radio buttons */ name?: string /** Currently selected value */ diff --git a/fakemui/fakemui/surfaces/Card.tsx b/fakemui/fakemui/surfaces/Card.tsx index 4f4537bca..35eb6f571 100644 --- a/fakemui/fakemui/surfaces/Card.tsx +++ b/fakemui/fakemui/surfaces/Card.tsx @@ -80,3 +80,37 @@ export const CardMedia: React.FC = ({ image, alt = '', height, c aria-label={alt} /> ) + +// Additional Card subcomponents for Lua package compatibility +export interface CardTitleProps extends React.HTMLAttributes { + children?: React.ReactNode + text?: string +} + +export const CardTitle: React.FC = ({ children, text, className = '', ...props }) => ( +

+ {text || children} +

+) + +export interface CardDescriptionProps extends React.HTMLAttributes { + children?: React.ReactNode + text?: string +} + +export const CardDescription: React.FC = ({ children, text, className = '', ...props }) => ( +

+ {text || children} +

+) + +export interface CardFooterProps extends React.HTMLAttributes { + children?: React.ReactNode +} + +export const CardFooter: React.FC = ({ children, className = '', ...props }) => ( +
+ {children} +
+) + diff --git a/frontends/nextjs/src/components/get-component-icon.tsx b/frontends/nextjs/src/components/get-component-icon.tsx index e0fdfd82c..111fb5011 100644 --- a/frontends/nextjs/src/components/get-component-icon.tsx +++ b/frontends/nextjs/src/components/get-component-icon.tsx @@ -3,14 +3,14 @@ import { Article, Autorenew, Chat, - CheckBox, + Checkbox, CropFree, CropPortrait, FormatAlignLeft, GridView, LocalOffer, LooksOne, - Remove, + Minus, TableChart, TextFields, ToggleOn, @@ -20,21 +20,21 @@ import { ViewColumn, ViewStream, WarningAmber, -} from '@mui/icons-material' -import type { SvgIconProps } from '@mui/material/SvgIcon' + type IconProps, +} from '@/fakemui/icons' import type { ComponentType, ReactElement } from 'react' -const iconMap: Record> = { +const iconMap: Record> = { Article, Card: CropPortrait, Chat, - CheckSquare: CheckBox, + CheckSquare: Checkbox, CircleNotch: Autorenew, Columns: ViewColumn, CursorClick: TouchApp, FrameCorners: CropFree, GridFour: GridView, - Minus: Remove, + Minus, Seal: Verified, SlidersHorizontal: Tune, Stack: ViewStream, @@ -48,7 +48,7 @@ const iconMap: Record> = { Warning: WarningAmber, } -export function getComponentIcon(iconName: string, props?: SvgIconProps): ReactElement | null { +export function getComponentIcon(iconName: string, props?: IconProps): ReactElement | null { const Icon = iconMap[iconName] return Icon ? : null }