@audira/carbon-react-native
Version:
Build React Native apps with component and shared patterns using Carbon
107 lines (106 loc) • 3.92 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Tertiary = 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 Tertiary = exports.Tertiary = /*#__PURE__*/(0, _react.forwardRef)(function Tertiary({
style,
...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]
},
style: [baseStyle.tertiary, style]
});
});
const baseStyle = _reactNative.StyleSheet.create({
tertiary: {
borderWidth: 1
}
}),
backgroundStyleSheet = _index.CarbonStyleSheet.create({
default: {
backgroundColor: 'transparent',
borderColor: _index.CarbonStyleSheet.color.button_tertiary
},
focused: {
backgroundColor: _index.CarbonStyleSheet.color.button_tertiary_hover,
borderColor: _index.CarbonStyleSheet.color.focus
},
hovered: {
backgroundColor: _index.CarbonStyleSheet.color.button_tertiary_hover,
borderColor: _index.CarbonStyleSheet.color.button_tertiary_hover
},
pressed: {
backgroundColor: _index.CarbonStyleSheet.color.button_tertiary_active,
borderColor: _index.CarbonStyleSheet.color.button_tertiary_active
},
disabled: {
backgroundColor: 'transparent',
borderColor: _index.CarbonStyleSheet.color.button_disabled
}
}),
textStyleSheet = _index.CarbonStyleSheet.create({
default: {
color: _index.CarbonStyleSheet.color.button_tertiary
},
focused: {
color: _index.CarbonStyleSheet.color.button_tertiary
},
hovered: {
color: _index.CarbonStyleSheet.color.text_inverse
},
pressed: {
color: _index.CarbonStyleSheet.color.text_inverse
},
disabled: {
color: _index.CarbonStyleSheet.color.text_disabled
}
}),
mapIconColor = {
gray_10: {
default: _carbonReactNativeElements.Color.Token.gray_10.button_tertiary,
focused: _carbonReactNativeElements.Color.Token.gray_10.button_tertiary,
hovered: _carbonReactNativeElements.Color.Token.gray_10.icon_inverse,
pressed: _carbonReactNativeElements.Color.Token.gray_10.icon_inverse,
disabled: _carbonReactNativeElements.Color.Token.gray_10.icon_disabled
},
gray_100: {
default: _carbonReactNativeElements.Color.Token.gray_100.button_tertiary,
focused: _carbonReactNativeElements.Color.Token.gray_100.button_tertiary,
hovered: _carbonReactNativeElements.Color.Token.gray_100.icon_inverse,
pressed: _carbonReactNativeElements.Color.Token.gray_100.icon_inverse,
disabled: _carbonReactNativeElements.Color.Token.gray_100.icon_disabled
}
},
mapAndroidRippleEffectColor = {
gray_10: _carbonReactNativeElements.Color.Token.gray_10.button_tertiary_active,
gray_100: _carbonReactNativeElements.Color.Token.gray_100.button_tertiary_active
};
//# sourceMappingURL=Tertiary.js.map