import React, { useState } from 'react'; import { View, Text, StyleSheet, ScrollView } from 'react-native'; import { useUx4gTheme } from '../theme/Ux4gThemeContext'; import { UX4GColors } from '../foundation/colors'; import { Ux4gRadioButton } from '../components/radio-button/RadioButton'; import { Ux4gButton } from '../components/button/Button'; export const RadioButtonShowcase: React.FC = () => { const theme = useUx4gTheme(); // Basic Group State const [basicSelection, setBasicSelection] = useState('option-1'); // Sizes State const [sizeSelection, setSizeSelection] = useState('medium'); // Status Group State const [statusSelection, setStatusSelection] = useState('error'); // Description Variants State const [descSelection, setDescSelection] = useState('helper'); // Horizontal Grid State const [horizontalSelection, setHorizontalSelection] = useState('helper'); return ( UX4G RadioButton Showcase Direct port of `radioButton.dart` (`Ux4gRadioButton`) featuring radio groups, sizes, status rings, required mark (`*`), and description variants. {/* 1. Basic Radio Group & Interactive States */} 1. Basic Radio Group Selection Select an option below. Selected: {basicSelection} setBasicSelection(val)} label="Option 1: Individual Plan" description="Access for a single user with standard features" isRequired /> setBasicSelection(val)} label="Option 2: Team Plan" description="Up to 10 users with shared cloud workspaces" /> setBasicSelection(val)} label="Option 3: Enterprise Plan" description="Unlimited users, dedicated support, and SSO" /> {/* 2. Sizes */} 2. Sizes (`small`, `medium`, `large`) Supports small (16pt), medium (20pt), and large (24pt) dimensions. setSizeSelection(val)} label="Small Radio (16pt)" description="Compact spacing and small typography" /> setSizeSelection(val)} label="Medium Radio (20pt - Default)" description="Standard sizing for general UI forms" /> setSizeSelection(val)} label="Large Radio (24pt)" description="Generous touch target and prominent label" /> {/* 3. Status Rings & Colors */} 3. Visual Status Rings (`error`, `warning`, `success`) Ring color driven independently or synced with form status. setStatusSelection(val)} label="Error Status Radio" description="Ring styled with error color palette" /> setStatusSelection(val)} label="Warning Status Radio" description="Ring styled with warning color palette" /> setStatusSelection(val)} label="Success Status Radio" description="Ring styled with success color palette" /> setStatusSelection(val)} label="Custom Direct Color Override" description="Using explicit foundation color (UX4GColors.secondary600)" /> {/* 4. Description Variants */} 4. Description Variants with Icons Helper, Error, Warning, and Success descriptions with status icons. setDescSelection(val)} label="Helper Description" description="This is standard informational text below the label." /> setDescSelection(val)} label="Error Description" description="This selection has a validation conflict that must be fixed." /> setDescSelection(val)} label="Warning Description" description="Proceed with caution if choosing this configuration." /> setDescSelection(val)} label="Success Description" description="Configuration verified and ready for deployment." /> Horizontal Status States (`helper`, `error`, `warning`, `success`) Clean side-by-side comparison of all 4 description variant status icons with check/radio and status rings. setHorizontalSelection(val)} label="Label" description="Default description" descriptionVariant="helper" /> setHorizontalSelection(val)} label="Label" description="Error text" descriptionVariant="error" /> setHorizontalSelection(val)} label="Label" description="Warning text" descriptionVariant="warning" /> setHorizontalSelection(val)} label="Label" description="Success text" descriptionVariant="success" /> {/* 5. Disabled State */} 5. Disabled States (`enabled={false}`) { setBasicSelection('option-1'); setSizeSelection('medium'); setStatusSelection('error'); setDescSelection('helper'); }} /> ); }; const styles = StyleSheet.create({ container: { flex: 1, }, contentContainer: { padding: 20, paddingBottom: 60, }, header: { marginBottom: 24, }, title: { fontSize: 24, fontWeight: '700', marginBottom: 8, }, subtitle: { fontSize: 14, lineHeight: 20, }, section: { marginBottom: 28, }, sectionTitle: { fontSize: 18, fontWeight: '600', marginBottom: 6, }, sectionDesc: { fontSize: 14, marginBottom: 12, }, card: { borderWidth: 1, borderRadius: 12, padding: 16, }, divider: { height: 12, }, footerActions: { marginTop: 8, alignItems: 'flex-start', }, horizontalRowContainer: { flexDirection: 'row', alignItems: 'flex-start', paddingVertical: 4, }, horizontalGridItem: { marginRight: 28, minWidth: 170, }, });