UNPKG

@audira/carbon-react-native

Version:

Build React Native apps with component and shared patterns using Carbon

49 lines (48 loc) 1.59 kB
"use strict"; import { forwardRef, useContext } from 'react'; import { StyleSheet, View } from 'react-native'; import { GlobalConfigContext } from "../../_internal/contexts/index.js"; import { CommonStyleSheet, FlexStyleSheet } from "../../_internal/style-sheets/index.js"; import { CarbonStyleSheet } from "../../carbon-style-sheet/index.js"; import { ThemeContext } from "../../contexts/index.js"; import { Text } from "../text/index.js"; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; export const FormHelperText = /*#__PURE__*/forwardRef(function FormHelperText({ error, text, textLeading, textTrailing, textProps, style, dir, ...props }, ref) { useContext(ThemeContext); const globalConfigContext = useContext(GlobalConfigContext); return /*#__PURE__*/_jsxs(View, { ...props, ref: ref, dir: dir ?? globalConfigContext.rtl ? 'rtl' : undefined, style: [FlexStyleSheet.flex_row, baseStyle.container, globalConfigContext.rtl ? CommonStyleSheet.rtl : undefined, style], children: [textLeading, /*#__PURE__*/_jsx(Text, { ...textProps, type: textProps?.type || 'helper_text_01', style: [error ? carbonStyle.textError : carbonStyle.text, textProps?.style], children: text }), textTrailing] }); }); const baseStyle = StyleSheet.create({ container: { gap: 8 } }), carbonStyle = CarbonStyleSheet.create({ text: { color: CarbonStyleSheet.color.text_primary }, textError: { color: CarbonStyleSheet.color.text_error } }); //# sourceMappingURL=FormHelperText.js.map