// ORIGINAL WINDOWS NAME: GROUPBOX import React from 'react'; import { StyleSheet, View, StyleProp, ViewStyle } from 'react-native'; import type { Theme } from '../../types'; import { withTheme } from '../../core/theming'; import { Border } from '../../styles/styleElements'; import { Text } from '../..'; export const testId = 'fieldset'; type Props = React.ComponentPropsWithRef & { children?: React.ReactNode; disabled?: boolean; label?: React.ReactNode; labelStyle?: StyleProp; style?: StyleProp; theme: Theme; variant?: 'default' | 'flat'; }; const Fieldset = ({ children, disabled, label, labelStyle = {}, style = {}, theme, variant = 'default', ...rest }: Props) => { return ( {variant === 'flat' ? ( ) : ( <> )} {label && ( {label} )} {children} ); }; const styles = StyleSheet.create({ wrapper: { position: 'relative', marginVertical: 12, padding: 20, }, label: { position: 'absolute', top: 0, left: 8, // TODO: how to properly center the label? transform: [{ translateY: -8 }], paddingHorizontal: 8, fontSize: 16, lineHeight: 16, }, border: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, }, }); export default withTheme(Fieldset);