@audira/carbon-react-native
Version:
Build React Native apps with component and shared patterns using Carbon
78 lines (77 loc) • 2.48 kB
JavaScript
"use strict";
import { forwardRef, useContext } from 'react';
import { StyleSheet } from 'react-native';
import { Color } from '@audira/carbon-react-native-elements';
import { CarbonStyleSheet } from "../../../carbon-style-sheet/index.js";
import { ThemeContext } from "../../../contexts/index.js";
import { BaseColor } from "../base-color/index.js";
import { jsx as _jsx } from "react/jsx-runtime";
export const GhostIcon = /*#__PURE__*/forwardRef(function GhostIcon(props, ref) {
const themeContext = useContext(ThemeContext);
return /*#__PURE__*/_jsx(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: style.text,
focused: style.text,
hovered: style.text,
pressed: style.text,
disabled: style.text
},
icon: mapIconColor[themeContext.colorScheme]
}
});
});
const backgroundStyleSheet = CarbonStyleSheet.create({
default: {
backgroundColor: 'transparent'
},
focused: {
borderWidth: 1,
borderColor: CarbonStyleSheet.color.focus
},
hovered: {
backgroundColor: CarbonStyleSheet.color.background_hover
},
pressed: {
backgroundColor: CarbonStyleSheet.color.background_active
},
disabled: {
backgroundColor: 'transparent'
}
}),
style = StyleSheet.create({
text: {
color: 'transparent'
}
}),
mapIconColor = {
gray_10: {
default: Color.Token.gray_10.icon_primary,
focused: Color.Token.gray_10.icon_primary,
hovered: Color.Token.gray_10.icon_primary,
pressed: Color.Token.gray_10.icon_primary,
disabled: Color.Token.gray_10.icon_disabled
},
gray_100: {
default: Color.Token.gray_100.icon_primary,
focused: Color.Token.gray_100.icon_primary,
hovered: Color.Token.gray_100.icon_primary,
pressed: Color.Token.gray_100.icon_primary,
disabled: Color.Token.gray_100.icon_disabled
}
},
mapAndroidRippleEffectColor = {
gray_10: Color.Token.gray_10.background_active,
gray_100: Color.Token.gray_100.background_active
};
//# sourceMappingURL=GhostIcon.js.map