import React, { useState } from 'react'; import { View, Text, StyleSheet, ScrollView, TouchableOpacity } from 'react-native'; import { useUx4gTheme } from '../theme/Ux4gThemeContext'; import { Ux4gDatePicker, DateRange } from '../components/date-picker'; import { Ux4gInputFieldStatus } from '../components/input-field'; export const DatePickerShowcase: React.FC = () => { const { colors, typography, isDark, toggleTheme } = useUx4gTheme(); const [singleDate, setSingleDate] = useState(undefined); const [rangeDate, setRangeDate] = useState(undefined); const [statusDate, setStatusDate] = useState(undefined); const [status, setStatus] = useState('error'); const formatDateStr = (d?: Date) => { if (!d) return 'None'; return `${String(d.getDate()).padStart(2, '0')}/${String(d.getMonth() + 1).padStart(2, '0')}/${d.getFullYear()}`; }; return ( Ux4gDatePicker Showcase Single & Range date selection modes with exact design variants and validation statuses. Toggle Theme ({isDark ? 'Dark' : 'Light'}) {/* Card 1: Single Date Picker */} Single Date Picker setSingleDate(d)} /> {singleDate && ( Selected Date: {formatDateStr(singleDate)} )} {/* Card 2: Date Range Picker */} Date Range Picker setRangeDate(r)} /> {rangeDate && ( Selected Range: {formatDateStr(rangeDate?.start)} – {formatDateStr(rangeDate?.end)} )} {/* Card 3: Validation Statuses */} Validation Statuses {(['defaultStatus', 'error', 'warning', 'success'] as Ux4gInputFieldStatus[]).map((st) => ( setStatus(st)} style={[ styles.statusChip, { backgroundColor: status === st ? colors.primary : `${colors.onSurface}1A`, }, ]} > {st} ))} setStatusDate(d)} /> {/* Card 4: Date Bounds & Disabled State */} Date Bounds & Disabled State ); }; const styles = StyleSheet.create({ container: { flex: 1, padding: 16, }, header: { marginBottom: 20, }, title: { fontSize: 22, fontWeight: 'bold', marginBottom: 6, }, subtitle: { fontSize: 14, marginBottom: 12, }, themeButton: { paddingHorizontal: 14, paddingVertical: 8, borderRadius: 6, alignSelf: 'flex-start', }, themeButtonText: { fontSize: 13, fontWeight: '600', }, card: { padding: 16, borderRadius: 12, borderWidth: 1, marginBottom: 16, }, cardHeaderTitle: { fontSize: 18, fontWeight: '700', marginBottom: 14, }, stateContainer: { marginTop: 12, padding: 8, borderRadius: 6, backgroundColor: 'rgba(74, 43, 194, 0.08)', }, stateText: { fontSize: 13, fontWeight: '600', }, statusButtonsRow: { flexDirection: 'row', flexWrap: 'wrap', marginBottom: 12, }, statusChip: { paddingHorizontal: 10, paddingVertical: 6, borderRadius: 16, marginRight: 8, marginBottom: 6, }, statusChipText: { fontSize: 12, fontWeight: '600', }, subFieldMargin: { marginBottom: 14, }, });