import React, { useState } from 'react'; import { View, Text, ScrollView, StyleSheet } from 'react-native'; import { Ux4gInputField, Ux4gInputFieldSize, Ux4gInputFieldStatus } from '../components/input-field/InputField'; import { useUx4gTheme } from '../theme/Ux4gThemeContext'; import { Ux4gIcons } from '../foundation/icons'; export const InputFieldShowcase: React.FC = () => { const theme = useUx4gTheme(); const colors = theme.colors; const isDark = theme.isDark; // Section 1: Required Email with Helper text (Image 1) const [emailImgVal, setEmailImgVal] = useState(''); // Section 2: Validation Statuses (Image 2) const [errImgVal, setErrImgVal] = useState(''); const [descImgVal, setDescImgVal] = useState(''); const [succImgVal, setSuccImgVal] = useState(''); const [warnImgVal, setWarnImgVal] = useState(''); // Section 3: Leading icon, Trailing icon, Both icons (Image 3) const [leadingSearchVal, setLeadingSearchVal] = useState(''); const [trailingAmountVal, setTrailingAmountVal] = useState(''); const [bothLocationVal, setBothLocationVal] = useState(''); // Section 4: Prefix & Postfix (Image 4) const [amountPrefixVal, setAmountPrefixVal] = useState(''); const [websitePrefixVal, setWebsitePrefixVal] = useState(''); // Section 5: Disabled vs Normal (Image 5) const [appIdVal] = useState('GOV/2025/001'); const [fullNameVal, setFullNameVal] = useState(''); // Section 6 & 7: Extra configurations (Sizes, Password toggle, Multi-line) const [sizeSmall, setSizeSmall] = useState('Small (32px)'); const [sizeMedium, setSizeMedium] = useState('Medium (40px default)'); const [sizeLarge, setSizeLarge] = useState('Large (48px)'); const [sizeXl, setSizeXl] = useState('Extra Large (56px)'); const [passwordText, setPasswordText] = useState('SecretPass123!'); const [multiLineVal, setMultiLineVal] = useState( 'Standardized, accessible, and high-performance UI components across web, mobile, and desktop.' ); 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' }]; const neutralIconColor = isDark ? '#A1A1AA' : '#71717A'; return ( 📝 Input Field Variants (`Ux4gInputField`) Comprehensive demonstration of all input field variants exactly matching every state, icon layout, prefix/postfix format, and status badge. {/* ── SECTION 1: Required Field & Helper Text (Image 1) ─────────────── */} 1. Required Field with Helper Text Shows red `*` indicator next to `Email` and info helper text below. {/* ── SECTION 2: All Validation Statuses (Image 2) ───────────────────── */} 2. Validation Statuses (`error`, `default`, `success`, `warning`) Semantic borders, status icons, and matching helper message colors. {/* Error State */} {/* Default Description State */} {/* Success State */} {/* Warning State */} {/* ── SECTION 3: Leading, Trailing & Both Icons (Image 3) ────────────── */} 3. Icon Configurations (`leadingIcon` & `trailingIcon`) Supporting search icons, currency trailing symbols, and combined location pins. {/* Leading icon */} {/* Trailing icon */} ₹ } /> {/* Both icons */} 📍} trailingIcon={🎯} /> {/* ── SECTION 4: Prefix & Postfix Formatting (Image 4) ──────────────── */} 4. Prefix Text & Postfix Text Formatting Embeds static currency prefixes (`₹ 0`), decimal postfixes (`.00`), and protocol URLs (`https:// `). {/* Amount with prefix & postfix */} {/* Website with prefix */} {/* ── SECTION 5: Disabled vs Normal States (Image 5) ─────────────────── */} 5. Disabled (`enabled = false`) vs Normal State Disabled fields automatically remove border contrast and apply a subtle neutral grey background. {/* Application ID (Disabled) */} {}} enabled={false} /> {/* Full Name (Normal Required) */} {/* ── SECTION 6: Sizes Comparison (`small`, `medium`, `large`, `xl`) ──── */} 6. Field Sizes (`small`, `medium`, `large`, `xl`) Exact height constraints (`small`: 32px, `medium`: 40px default, `large`: 48px, `xl`: 56px). {/* ── SECTION 7: Password Toggle & Multi-Line Text Area ─────────────── */} 7. Secure Password Toggle & Multi-line Text Area Interactive eye icon (`type = 'password'`) and auto-expanding multi-line (`singleLine = false`). ); }; const styles = StyleSheet.create({ container: { flex: 1, }, contentContainer: { padding: 16, paddingBottom: 48, }, header: { marginBottom: 20, }, title: { fontSize: 22, fontWeight: '800', marginBottom: 6, }, card: { borderRadius: 12, borderWidth: 1, padding: 16, marginBottom: 16, }, cardTitle: { fontSize: 16, fontWeight: '700', marginBottom: 4, }, cardSubtitle: { fontSize: 13, marginBottom: 12, }, rowSpacing: { marginTop: 14, }, });