UNPKG

@audira/carbon-react-native

Version:

Build React Native apps with component and shared patterns using Carbon

83 lines (82 loc) 3.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useError = useError; var _react = require("react"); var _carbonReactNativeElements = require("@audira/carbon-react-native-elements"); var _errorFilled = _interopRequireDefault(require("@carbon/icons/svg/32/error--filled.svg")); var _index = require("../../../../carbon-style-sheet/index.js"); var _index2 = require("../../../../contexts/index.js"); var _index3 = require("../_base/index.js"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } function useError({ color, transparentBorderColor }) { const themeContext = (0, _react.useContext)(_index2.ThemeContext), data = (0, _index3.useBase)({ color, transparentBorderColor, style: statusStyle, titleStyle, leftBarStyle, iconColor: mapIconColor[themeContext.colorScheme], iconCloseColor: mapIconCloseColor[themeContext.colorScheme] }); return { ...data, Icon: _errorFilled.default }; } const statusStyle = _index.CarbonStyleSheet.create({ low_contrast: { backgroundColor: _index.CarbonStyleSheet.color.notification_error_background, borderTopColor: _index.CarbonStyleSheet.color.notification_error_border, borderRightColor: _index.CarbonStyleSheet.color.notification_error_border, borderBottomColor: _index.CarbonStyleSheet.color.notification_error_border }, high_contrast: { backgroundColor: _index.CarbonStyleSheet.color.background_inverse, borderTopColor: _index.CarbonStyleSheet.color.background_inverse, borderRightColor: _index.CarbonStyleSheet.color.background_inverse, borderBottomColor: _index.CarbonStyleSheet.color.background_inverse } }), titleStyle = _index.CarbonStyleSheet.create({ low_contrast: { color: _index.CarbonStyleSheet.color.text_primary }, high_contrast: { color: _index.CarbonStyleSheet.color.text_inverse } }), leftBarStyle = _index.CarbonStyleSheet.create({ low_contrast: { backgroundColor: _index.CarbonStyleSheet.color.support_error }, high_contrast: { backgroundColor: _index.CarbonStyleSheet.color.support_error_inverse } }), mapIconColor = { gray_10: { low_contrast: _carbonReactNativeElements.Color.Token.gray_10.support_error, high_contrast: _carbonReactNativeElements.Color.Token.gray_10.support_error_inverse }, gray_100: { low_contrast: _carbonReactNativeElements.Color.Token.gray_100.support_error, high_contrast: _carbonReactNativeElements.Color.Token.gray_100.support_error_inverse } }, mapIconCloseColor = { gray_10: { low_contrast: _carbonReactNativeElements.Color.Token.gray_10.icon_primary, high_contrast: _carbonReactNativeElements.Color.Token.gray_10.icon_inverse }, gray_100: { low_contrast: _carbonReactNativeElements.Color.Token.gray_100.icon_primary, high_contrast: _carbonReactNativeElements.Color.Token.gray_100.icon_inverse } }; //# sourceMappingURL=useError.js.map