@audira/carbon-react-native
Version:
Build React Native apps with component and shared patterns using Carbon
53 lines (52 loc) • 1.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.FormHelperText = void 0;
var _react = require("react");
var _reactNative = require("react-native");
var _index = require("../../_internal/contexts/index.js");
var _index2 = require("../../_internal/style-sheets/index.js");
var _index3 = require("../../carbon-style-sheet/index.js");
var _index4 = require("../../contexts/index.js");
var _index5 = require("../text/index.js");
var _jsxRuntime = require("react/jsx-runtime");
const FormHelperText = exports.FormHelperText = /*#__PURE__*/(0, _react.forwardRef)(function FormHelperText({
error,
text,
textLeading,
textTrailing,
textProps,
style,
dir,
...props
}, ref) {
(0, _react.useContext)(_index4.ThemeContext);
const globalConfigContext = (0, _react.useContext)(_index.GlobalConfigContext);
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
...props,
ref: ref,
dir: dir ?? globalConfigContext.rtl ? 'rtl' : undefined,
style: [_index2.FlexStyleSheet.flex_row, baseStyle.container, globalConfigContext.rtl ? _index2.CommonStyleSheet.rtl : undefined, style],
children: [textLeading, /*#__PURE__*/(0, _jsxRuntime.jsx)(_index5.Text, {
...textProps,
type: textProps?.type || 'helper_text_01',
style: [error ? carbonStyle.textError : carbonStyle.text, textProps?.style],
children: text
}), textTrailing]
});
});
const baseStyle = _reactNative.StyleSheet.create({
container: {
gap: 8
}
}),
carbonStyle = _index3.CarbonStyleSheet.create({
text: {
color: _index3.CarbonStyleSheet.color.text_primary
},
textError: {
color: _index3.CarbonStyleSheet.color.text_error
}
});
//# sourceMappingURL=FormHelperText.js.map