UNPKG

@audira/carbon-react-native

Version:

Build React Native apps with component and shared patterns using Carbon

112 lines (111 loc) 3.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Ghost = void 0; var _react = require("react"); var _reactNative = require("react-native"); 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 Ghost = exports.Ghost = /*#__PURE__*/(0, _react.forwardRef)(function Ghost({ text, iconProps, ...props }, ref) { const themeContext = (0, _react.useContext)(_index2.ThemeContext); return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.BaseColor, { ...props, ref: ref, text: text, 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] }, iconProps: { ...iconProps, style: [mapIconPLByText[`${!!text}`], iconProps?.style] } }); }); const backgroundStyleSheet = _index.CarbonStyleSheet.create({ default: { backgroundColor: 'transparent' }, focused: { borderWidth: 1, borderColor: _index.CarbonStyleSheet.color.focus }, hovered: { backgroundColor: _index.CarbonStyleSheet.color.background_hover }, pressed: { backgroundColor: _index.CarbonStyleSheet.color.background_active }, disabled: { backgroundColor: 'transparent' } }), textStyleSheet = _index.CarbonStyleSheet.create({ default: { color: _index.CarbonStyleSheet.color.link_primary }, focused: { color: _index.CarbonStyleSheet.color.link_primary }, hovered: { color: _index.CarbonStyleSheet.color.link_primary_hover }, pressed: { color: _index.CarbonStyleSheet.color.link_primary }, disabled: { color: _index.CarbonStyleSheet.color.text_disabled } }), style = _reactNative.StyleSheet.create({ iconPL8: { paddingLeft: _carbonReactNativeElements.Spacing.spacing_03 } }), mapIconPLByText = { false: null, true: style.iconPL8 }, mapIconColor = { gray_10: { default: _carbonReactNativeElements.Color.Token.gray_10.link_primary, focused: _carbonReactNativeElements.Color.Token.gray_10.link_primary, hovered: _carbonReactNativeElements.Color.Token.gray_10.link_primary_hover, pressed: _carbonReactNativeElements.Color.Token.gray_10.link_primary, disabled: _carbonReactNativeElements.Color.Token.gray_10.icon_disabled }, gray_100: { default: _carbonReactNativeElements.Color.Token.gray_100.link_primary, focused: _carbonReactNativeElements.Color.Token.gray_100.link_primary, hovered: _carbonReactNativeElements.Color.Token.gray_100.link_primary_hover, pressed: _carbonReactNativeElements.Color.Token.gray_100.link_primary, disabled: _carbonReactNativeElements.Color.Token.gray_100.icon_disabled } }, mapAndroidRippleEffectColor = { gray_10: _carbonReactNativeElements.Color.Token.gray_10.background_active, gray_100: _carbonReactNativeElements.Color.Token.gray_100.background_active }; //# sourceMappingURL=Ghost.js.map