@audira/carbon-react-native
Version:
Build React Native apps with component and shared patterns using Carbon
41 lines (40 loc) • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.FormLabel = 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("../text/index.js");
var _jsxRuntime = require("react/jsx-runtime");
const FormLabel = exports.FormLabel = /*#__PURE__*/(0, _react.forwardRef)(function FormLabel({
label,
labelLeading,
labelTrailing,
textProps,
style,
dir,
...props
}, ref) {
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.gap, globalConfigContext.rtl ? _index2.CommonStyleSheet.rtl : undefined, style],
children: [labelLeading, /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Text, {
...textProps,
type: textProps?.type || 'label_01',
"aria-label": label,
children: label
}), labelTrailing]
});
});
const baseStyle = _reactNative.StyleSheet.create({
gap: {
columnGap: 8
}
});
//# sourceMappingURL=FormLabel.js.map