import React, { useState } from 'react'; import { View, Text, StyleSheet, ScrollView } from 'react-native'; import { Ux4gTextArea } from '../components/text-area/TextArea'; import { useUx4gTheme } from '../theme/Ux4gThemeContext'; import { Ux4gIcons } from '../foundation/icons'; /** * **TextAreaShowcase** * * Comprehensive interactive demonstration of the `Ux4gTextArea` component, * covering all configurations (`minHeight`, sizes, statuses, character counters, * and read-only/disabled states). */ export const TextAreaShowcase: React.FC = () => { const { colors, isDark } = useUx4gTheme(); // State values for various text area configurations const [basicVal, setBasicVal] = useState(''); const [maxLengthVal, setMaxLengthVal] = useState( 'This is a sample bio explaining user history and background details.' ); const [smallSizeVal, setSmallSizeVal] = useState('Compact text area entry.'); const [largeSizeVal, setLargeSizeVal] = useState('Spacious text area with large minHeight.'); // Status values const [defaultVal, setDefaultVal] = useState('Standard input behavior.'); const [errorVal, setErrorVal] = useState('Description exceeds allowed limit or contains invalid symbols.'); const [warningVal, setWarningVal] = useState('Please ensure no sensitive personal identification numbers are entered.'); const [successVal, setSuccessVal] = useState('Comments verified and ready for submission.'); // Disabled and ReadOnly const [disabledVal] = useState('This field is locked by administrative permissions.'); const [readOnlyVal] = useState('Read-only terms and conditions review section.'); const cardStyle = [ styles.card, { backgroundColor: colors.surface ?? (isDark ? '#18181B' : '#FFFFFF'), borderColor: isDark ? '#27272A' : '#E4E4E7', }, ]; const titleStyle = [styles.cardTitle, { color: colors.onSurface }]; const subtitleStyle = [ styles.cardSubtitle, { color: isDark ? '#A1A1AA' : '#71717A' }, ]; return ( 📝 Text Area Component (`Ux4gTextArea`) Complete demonstration of multiline text areas (`Ux4gTextArea`) with exact token heights, semantic statuses, character counting, and resize indicators. {/* ── SECTION 1: Basic & Character Counter ────────────────────────────── */} 1. Basic & Character Counting (`maxLength`) Standard text area with required asterisk (`*`), label icons, and built-in character limit counter. {/* ── SECTION 2: Heights & Sizes ──────────────────────────────────────── */} 2. Sizing (`small`, `large`) & Heights (`small`, `medium`, `large`) Scalable content padding (`size`) and minimum container heights (`minHeight`). {/* ── SECTION 3: Validation Statuses ──────────────────────────────────── */} 3. Validation Statuses Semantic borders, status icons, and colored captions (`defaultStatus`, `error`, `warning`, `success`). {/* ── SECTION 4: Read-Only & Disabled States ──────────────────────────── */} 4. Read-Only (`readOnly`) & Disabled (`enabled = false`) Non-editable modes for locked fields or static document review. {}} enabled={false} caption="You do not have permission to modify these notes." /> {}} readOnly={true} caption="Text can be highlighted/copied but cannot be edited." /> ); }; const styles = StyleSheet.create({ container: { flex: 1, }, contentContainer: { padding: 16, paddingBottom: 64, }, header: { marginBottom: 20, }, title: { fontSize: 22, fontWeight: '800', marginBottom: 6, }, card: { borderWidth: 1, borderRadius: 12, padding: 16, marginBottom: 20, }, cardTitle: { fontSize: 16, fontWeight: '700', marginBottom: 4, }, cardSubtitle: { fontSize: 13, marginBottom: 16, lineHeight: 18, }, rowSpacing: { marginBottom: 16, }, });