UNPKG

@audira/carbon-react-native

Version:

Build React Native apps with component and shared patterns using Carbon

92 lines (91 loc) 3.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Primary = void 0; var _react = require("react"); var _carbonReactNativeElements = require("@audira/carbon-react-native-elements"); var _index = require("../../../carbon-style-sheet/index.js"); var _index2 = require("../../../contexts/index.js"); var _index3 = require("../base-color/index.js"); var _jsxRuntime = require("react/jsx-runtime"); const Primary = exports.Primary = /*#__PURE__*/(0, _react.forwardRef)(function Primary(props, ref) { const themeContext = (0, _react.useContext)(_index2.ThemeContext); return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.BaseColor, { ...props, ref: ref, android_rippleEffectColor: mapAndroidRippleEffectColor[themeContext.colorScheme], colorStateStyle: { background: { default: backgroundStyleSheet.default, focused: backgroundStyleSheet.focused, hovered: backgroundStyleSheet.hovered, pressed: backgroundStyleSheet.pressed, disabled: backgroundStyleSheet.disabled }, text: { default: textStyleSheet.default, focused: textStyleSheet.focused, hovered: textStyleSheet.hovered, pressed: textStyleSheet.pressed, disabled: textStyleSheet.disabled }, icon: mapIconColor[themeContext.colorScheme] } }); }); const backgroundStyleSheet = _index.CarbonStyleSheet.create({ default: { backgroundColor: _index.CarbonStyleSheet.color.button_primary }, focused: { backgroundColor: _index.CarbonStyleSheet.color.button_primary }, hovered: { backgroundColor: _index.CarbonStyleSheet.color.button_primary_hover }, pressed: { backgroundColor: _index.CarbonStyleSheet.color.button_primary_active }, disabled: { backgroundColor: _index.CarbonStyleSheet.color.button_disabled } }), textStyleSheet = _index.CarbonStyleSheet.create({ default: { color: _index.CarbonStyleSheet.color.text_on_color }, focused: { color: _index.CarbonStyleSheet.color.text_on_color }, hovered: { color: _index.CarbonStyleSheet.color.text_on_color }, pressed: { color: _index.CarbonStyleSheet.color.text_on_color }, disabled: { color: _index.CarbonStyleSheet.color.text_on_color_disabled } }), mapIconColor = { gray_10: { default: _carbonReactNativeElements.Color.Token.gray_10.icon_on_color, focused: _carbonReactNativeElements.Color.Token.gray_10.icon_on_color, hovered: _carbonReactNativeElements.Color.Token.gray_10.icon_on_color, pressed: _carbonReactNativeElements.Color.Token.gray_10.icon_on_color, disabled: _carbonReactNativeElements.Color.Token.gray_10.icon_on_color_disabled }, gray_100: { default: _carbonReactNativeElements.Color.Token.gray_100.icon_on_color, focused: _carbonReactNativeElements.Color.Token.gray_100.icon_on_color, hovered: _carbonReactNativeElements.Color.Token.gray_100.icon_on_color, pressed: _carbonReactNativeElements.Color.Token.gray_100.icon_on_color, disabled: _carbonReactNativeElements.Color.Token.gray_100.icon_on_color_disabled } }, mapAndroidRippleEffectColor = { gray_10: _carbonReactNativeElements.Color.Token.gray_10.button_primary_active, gray_100: _carbonReactNativeElements.Color.Token.gray_100.button_primary_active }; //# sourceMappingURL=Primary.js.map