@kiwicom/orbit-components
Version:
Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.
12 lines (9 loc) • 6.54 kB
JavaScript
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import convertHexToRgba from "@kiwicom/orbit-design-tokens/lib/convertHexToRgba";
import { TOKENS, TYPE_OPTIONS } from "../consts";
var getButtonTypeToken = function getButtonTypeToken(name, type, theme) {
var _TOKENS$backgroundBut, _TOKENS$backgroundBut2, _TOKENS$backgroundBut3, _TOKENS$backgroundBut4, _TOKENS$colorTextButt, _TOKENS$colorTextButt2, _TOKENS$colorTextButt3, _TOKENS$borderColorBu, _tokens;
var tokens = (_tokens = {}, _defineProperty(_tokens, TOKENS.backgroundButton, (_TOKENS$backgroundBut = {}, _defineProperty(_TOKENS$backgroundBut, TYPE_OPTIONS.PRIMARY, theme.orbit.backgroundButtonPrimary), _defineProperty(_TOKENS$backgroundBut, TYPE_OPTIONS.SECONDARY, theme.orbit.backgroundButtonSecondary), _defineProperty(_TOKENS$backgroundBut, TYPE_OPTIONS.CRITICAL, theme.orbit.backgroundButtonCritical), _defineProperty(_TOKENS$backgroundBut, TYPE_OPTIONS.WHITE, theme.orbit.backgroundButtonWhite), _defineProperty(_TOKENS$backgroundBut, TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductLight), _defineProperty(_TOKENS$backgroundBut, TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedLight), _TOKENS$backgroundBut)), _defineProperty(_tokens, TOKENS.backgroundButtonHover, (_TOKENS$backgroundBut2 = {}, _defineProperty(_TOKENS$backgroundBut2, TYPE_OPTIONS.PRIMARY, theme.orbit.backgroundButtonPrimaryHover), _defineProperty(_TOKENS$backgroundBut2, TYPE_OPTIONS.SECONDARY, theme.orbit.backgroundButtonSecondaryHover), _defineProperty(_TOKENS$backgroundBut2, TYPE_OPTIONS.CRITICAL, theme.orbit.backgroundButtonCriticalHover), _defineProperty(_TOKENS$backgroundBut2, TYPE_OPTIONS.WHITE, theme.orbit.backgroundButtonWhiteHover), _defineProperty(_TOKENS$backgroundBut2, TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductLightHover), _defineProperty(_TOKENS$backgroundBut2, TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedLightHover), _TOKENS$backgroundBut2)), _defineProperty(_tokens, TOKENS.backgroundButtonActive, (_TOKENS$backgroundBut3 = {}, _defineProperty(_TOKENS$backgroundBut3, TYPE_OPTIONS.PRIMARY, theme.orbit.backgroundButtonPrimaryActive), _defineProperty(_TOKENS$backgroundBut3, TYPE_OPTIONS.SECONDARY, theme.orbit.backgroundButtonSecondaryActive), _defineProperty(_TOKENS$backgroundBut3, TYPE_OPTIONS.CRITICAL, theme.orbit.backgroundButtonCriticalActive), _defineProperty(_TOKENS$backgroundBut3, TYPE_OPTIONS.WHITE, theme.orbit.backgroundButtonWhiteActive), _defineProperty(_TOKENS$backgroundBut3, TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductLightActive), _defineProperty(_TOKENS$backgroundBut3, TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedLightActive), _TOKENS$backgroundBut3)), _defineProperty(_tokens, TOKENS.backgroundButtonFocus, (_TOKENS$backgroundBut4 = {}, _defineProperty(_TOKENS$backgroundBut4, TYPE_OPTIONS.PRIMARY, convertHexToRgba(theme.orbit.paletteProductNormal, 10)), _defineProperty(_TOKENS$backgroundBut4, TYPE_OPTIONS.SECONDARY, convertHexToRgba(theme.orbit.paletteInkLight, 10)), _defineProperty(_TOKENS$backgroundBut4, TYPE_OPTIONS.CRITICAL, convertHexToRgba(theme.orbit.paletteRedNormal, 10)), _defineProperty(_TOKENS$backgroundBut4, TYPE_OPTIONS.WHITE, convertHexToRgba(theme.orbit.paletteWhite, 20)), _defineProperty(_TOKENS$backgroundBut4, TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductLight), _defineProperty(_TOKENS$backgroundBut4, TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedLight), _TOKENS$backgroundBut4)), _defineProperty(_tokens, TOKENS.colorTextButton, (_TOKENS$colorTextButt = {}, _defineProperty(_TOKENS$colorTextButt, TYPE_OPTIONS.PRIMARY, theme.orbit.colorTextButtonPrimary), _defineProperty(_TOKENS$colorTextButt, TYPE_OPTIONS.SECONDARY, theme.orbit.colorTextButtonSecondary), _defineProperty(_TOKENS$colorTextButt, TYPE_OPTIONS.CRITICAL, theme.orbit.colorTextButtonCritical), _defineProperty(_TOKENS$colorTextButt, TYPE_OPTIONS.WHITE, theme.orbit.colorTextButtonWhite), _defineProperty(_TOKENS$colorTextButt, TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductNormal), _defineProperty(_TOKENS$colorTextButt, TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedNormal), _TOKENS$colorTextButt)), _defineProperty(_tokens, TOKENS.colorTextButtonHover, (_TOKENS$colorTextButt2 = {}, _defineProperty(_TOKENS$colorTextButt2, TYPE_OPTIONS.PRIMARY, theme.orbit.colorTextButtonPrimaryHover), _defineProperty(_TOKENS$colorTextButt2, TYPE_OPTIONS.SECONDARY, theme.orbit.colorTextButtonSecondaryHover), _defineProperty(_TOKENS$colorTextButt2, TYPE_OPTIONS.CRITICAL, theme.orbit.colorTextButtonCriticalHover), _defineProperty(_TOKENS$colorTextButt2, TYPE_OPTIONS.WHITE, theme.orbit.colorTextButtonWhiteHover), _defineProperty(_TOKENS$colorTextButt2, TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductDark), _defineProperty(_TOKENS$colorTextButt2, TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedDark), _TOKENS$colorTextButt2)), _defineProperty(_tokens, TOKENS.colorTextButtonActive, (_TOKENS$colorTextButt3 = {}, _defineProperty(_TOKENS$colorTextButt3, TYPE_OPTIONS.PRIMARY, theme.orbit.colorTextButtonPrimaryActive), _defineProperty(_TOKENS$colorTextButt3, TYPE_OPTIONS.SECONDARY, theme.orbit.colorTextButtonSecondaryActive), _defineProperty(_TOKENS$colorTextButt3, TYPE_OPTIONS.CRITICAL, theme.orbit.colorTextButtonCriticalActive), _defineProperty(_TOKENS$colorTextButt3, TYPE_OPTIONS.WHITE, theme.orbit.colorTextButtonWhiteActive), _defineProperty(_TOKENS$colorTextButt3, TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductDark), _defineProperty(_TOKENS$colorTextButt3, TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedDark), _TOKENS$colorTextButt3)), _defineProperty(_tokens, TOKENS.borderColorButtonFocus, (_TOKENS$borderColorBu = {}, _defineProperty(_TOKENS$borderColorBu, TYPE_OPTIONS.PRIMARY, convertHexToRgba(theme.orbit.paletteProductNormal, 50)), _defineProperty(_TOKENS$borderColorBu, TYPE_OPTIONS.SECONDARY, convertHexToRgba(theme.orbit.paletteInkLight, 30)), _defineProperty(_TOKENS$borderColorBu, TYPE_OPTIONS.CRITICAL, convertHexToRgba(theme.orbit.paletteRedNormal, 50)), _defineProperty(_TOKENS$borderColorBu, TYPE_OPTIONS.WHITE, convertHexToRgba(theme.orbit.paletteWhite, 50)), _defineProperty(_TOKENS$borderColorBu, TYPE_OPTIONS.PRIMARY_SUBTLE, convertHexToRgba(theme.orbit.paletteProductNormal, 50)), _defineProperty(_TOKENS$borderColorBu, TYPE_OPTIONS.CRITICAL_SUBTLE, convertHexToRgba(theme.orbit.paletteRedNormal, 50)), _TOKENS$borderColorBu)), _tokens);
return tokens[name][type];
};
export default getButtonTypeToken;