@audira/carbon-react-native
Version:
Build React Native apps with component and shared patterns using Carbon
85 lines (84 loc) • 3.53 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TextAreaFluid = void 0;
var _react = require("react");
var _reactNative = require("react-native");
var _carbonReactNativeElements = require("@audira/carbon-react-native-elements");
var _warningAltFilled = _interopRequireDefault(require("@carbon/icons/svg/32/warning--alt--filled.svg"));
var _warningFilled = _interopRequireDefault(require("@carbon/icons/svg/32/warning--filled.svg"));
var _index = require("../../_internal/style-sheets/index.js");
var _index2 = require("../../contexts/index.js");
var _index3 = require("../form-helper-text/index.js");
var _index4 = require("../form-label/index.js");
var _index5 = require("../text-area-field/index.js");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const TextAreaFluid = exports.TextAreaFluid = /*#__PURE__*/(0, _react.forwardRef)(function TextAreaFluid({
label,
helperText,
interactiveState,
style,
textInputStyle,
...textInputFieldProps
}, ref) {
const themeContext = (0, _react.useContext)(_index2.ThemeContext);
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index5.TextAreaField, {
ref: ref,
...textInputFieldProps,
interactiveState: interactiveState,
hideInteractiveStateIcon: true,
blockStartNode: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index4.FormLabel, {
label: label,
style: styleSheet.label
}),
blockEndNode: !!helperText?.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.FormHelperText, {
text: helperText,
style: [_index.FlexStyleSheet.flex_initial, styleSheet.helperText],
textTrailing: interactiveState === 'invalid' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_warningFilled.default, {
width: 16,
height: 16,
fill: mapIconInvalidColor[themeContext.colorScheme]
}) : interactiveState === 'warning' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_warningAltFilled.default, {
width: 16,
height: 16,
fill: mapIconWarningColor[themeContext.colorScheme]
}) : undefined
}),
style: [styleSheet.textAreaFluid, style],
textInputStyle: [helperText?.length ? styleSheet.rnTextInputNoBorderBottom : undefined, textInputStyle]
});
});
const styleSheet = _reactNative.StyleSheet.create({
textAreaFluid: {
paddingTop: 13,
minHeight: 64 + 11
},
label: {
paddingLeft: _carbonReactNativeElements.Spacing.spacing_05,
paddingRight: _carbonReactNativeElements.Spacing.spacing_05
},
rnTextInputNoBorderBottom: {
marginLeft: _carbonReactNativeElements.Spacing.spacing_05,
marginRight: _carbonReactNativeElements.Spacing.spacing_05,
paddingLeft: 0,
paddingRight: 0
},
helperText: {
justifyContent: 'space-between',
paddingTop: _carbonReactNativeElements.Spacing.spacing_03,
paddingBottom: _carbonReactNativeElements.Spacing.spacing_03,
paddingLeft: _carbonReactNativeElements.Spacing.spacing_05,
paddingRight: _carbonReactNativeElements.Spacing.spacing_05
}
}),
mapIconInvalidColor = {
gray_10: _carbonReactNativeElements.Color.Token.gray_10.support_error,
gray_100: _carbonReactNativeElements.Color.Token.gray_100.support_error
},
mapIconWarningColor = {
gray_10: _carbonReactNativeElements.Color.Token.gray_10.support_warning,
gray_100: _carbonReactNativeElements.Color.Token.gray_100.support_warning
};
//# sourceMappingURL=TextAreaFluid.js.map