UNPKG

@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.

24 lines (16 loc) 8.18 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _convertHexToRgba = _interopRequireDefault(require("@kiwicom/orbit-design-tokens/lib/convertHexToRgba")); var _consts = require("../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 = {}, (0, _defineProperty2.default)(_tokens, _consts.TOKENS.backgroundButton, (_TOKENS$backgroundBut = {}, (0, _defineProperty2.default)(_TOKENS$backgroundBut, _consts.TYPE_OPTIONS.PRIMARY, theme.orbit.backgroundButtonPrimary), (0, _defineProperty2.default)(_TOKENS$backgroundBut, _consts.TYPE_OPTIONS.SECONDARY, theme.orbit.backgroundButtonSecondary), (0, _defineProperty2.default)(_TOKENS$backgroundBut, _consts.TYPE_OPTIONS.CRITICAL, theme.orbit.backgroundButtonCritical), (0, _defineProperty2.default)(_TOKENS$backgroundBut, _consts.TYPE_OPTIONS.WHITE, theme.orbit.backgroundButtonWhite), (0, _defineProperty2.default)(_TOKENS$backgroundBut, _consts.TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductLight), (0, _defineProperty2.default)(_TOKENS$backgroundBut, _consts.TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedLight), _TOKENS$backgroundBut)), (0, _defineProperty2.default)(_tokens, _consts.TOKENS.backgroundButtonHover, (_TOKENS$backgroundBut2 = {}, (0, _defineProperty2.default)(_TOKENS$backgroundBut2, _consts.TYPE_OPTIONS.PRIMARY, theme.orbit.backgroundButtonPrimaryHover), (0, _defineProperty2.default)(_TOKENS$backgroundBut2, _consts.TYPE_OPTIONS.SECONDARY, theme.orbit.backgroundButtonSecondaryHover), (0, _defineProperty2.default)(_TOKENS$backgroundBut2, _consts.TYPE_OPTIONS.CRITICAL, theme.orbit.backgroundButtonCriticalHover), (0, _defineProperty2.default)(_TOKENS$backgroundBut2, _consts.TYPE_OPTIONS.WHITE, theme.orbit.backgroundButtonWhiteHover), (0, _defineProperty2.default)(_TOKENS$backgroundBut2, _consts.TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductLightHover), (0, _defineProperty2.default)(_TOKENS$backgroundBut2, _consts.TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedLightHover), _TOKENS$backgroundBut2)), (0, _defineProperty2.default)(_tokens, _consts.TOKENS.backgroundButtonActive, (_TOKENS$backgroundBut3 = {}, (0, _defineProperty2.default)(_TOKENS$backgroundBut3, _consts.TYPE_OPTIONS.PRIMARY, theme.orbit.backgroundButtonPrimaryActive), (0, _defineProperty2.default)(_TOKENS$backgroundBut3, _consts.TYPE_OPTIONS.SECONDARY, theme.orbit.backgroundButtonSecondaryActive), (0, _defineProperty2.default)(_TOKENS$backgroundBut3, _consts.TYPE_OPTIONS.CRITICAL, theme.orbit.backgroundButtonCriticalActive), (0, _defineProperty2.default)(_TOKENS$backgroundBut3, _consts.TYPE_OPTIONS.WHITE, theme.orbit.backgroundButtonWhiteActive), (0, _defineProperty2.default)(_TOKENS$backgroundBut3, _consts.TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductLightActive), (0, _defineProperty2.default)(_TOKENS$backgroundBut3, _consts.TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedLightActive), _TOKENS$backgroundBut3)), (0, _defineProperty2.default)(_tokens, _consts.TOKENS.backgroundButtonFocus, (_TOKENS$backgroundBut4 = {}, (0, _defineProperty2.default)(_TOKENS$backgroundBut4, _consts.TYPE_OPTIONS.PRIMARY, (0, _convertHexToRgba.default)(theme.orbit.paletteProductNormal, 10)), (0, _defineProperty2.default)(_TOKENS$backgroundBut4, _consts.TYPE_OPTIONS.SECONDARY, (0, _convertHexToRgba.default)(theme.orbit.paletteInkLight, 10)), (0, _defineProperty2.default)(_TOKENS$backgroundBut4, _consts.TYPE_OPTIONS.CRITICAL, (0, _convertHexToRgba.default)(theme.orbit.paletteRedNormal, 10)), (0, _defineProperty2.default)(_TOKENS$backgroundBut4, _consts.TYPE_OPTIONS.WHITE, (0, _convertHexToRgba.default)(theme.orbit.paletteWhite, 20)), (0, _defineProperty2.default)(_TOKENS$backgroundBut4, _consts.TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductLight), (0, _defineProperty2.default)(_TOKENS$backgroundBut4, _consts.TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedLight), _TOKENS$backgroundBut4)), (0, _defineProperty2.default)(_tokens, _consts.TOKENS.colorTextButton, (_TOKENS$colorTextButt = {}, (0, _defineProperty2.default)(_TOKENS$colorTextButt, _consts.TYPE_OPTIONS.PRIMARY, theme.orbit.colorTextButtonPrimary), (0, _defineProperty2.default)(_TOKENS$colorTextButt, _consts.TYPE_OPTIONS.SECONDARY, theme.orbit.colorTextButtonSecondary), (0, _defineProperty2.default)(_TOKENS$colorTextButt, _consts.TYPE_OPTIONS.CRITICAL, theme.orbit.colorTextButtonCritical), (0, _defineProperty2.default)(_TOKENS$colorTextButt, _consts.TYPE_OPTIONS.WHITE, theme.orbit.colorTextButtonWhite), (0, _defineProperty2.default)(_TOKENS$colorTextButt, _consts.TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductNormal), (0, _defineProperty2.default)(_TOKENS$colorTextButt, _consts.TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedNormal), _TOKENS$colorTextButt)), (0, _defineProperty2.default)(_tokens, _consts.TOKENS.colorTextButtonHover, (_TOKENS$colorTextButt2 = {}, (0, _defineProperty2.default)(_TOKENS$colorTextButt2, _consts.TYPE_OPTIONS.PRIMARY, theme.orbit.colorTextButtonPrimaryHover), (0, _defineProperty2.default)(_TOKENS$colorTextButt2, _consts.TYPE_OPTIONS.SECONDARY, theme.orbit.colorTextButtonSecondaryHover), (0, _defineProperty2.default)(_TOKENS$colorTextButt2, _consts.TYPE_OPTIONS.CRITICAL, theme.orbit.colorTextButtonCriticalHover), (0, _defineProperty2.default)(_TOKENS$colorTextButt2, _consts.TYPE_OPTIONS.WHITE, theme.orbit.colorTextButtonWhiteHover), (0, _defineProperty2.default)(_TOKENS$colorTextButt2, _consts.TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductDark), (0, _defineProperty2.default)(_TOKENS$colorTextButt2, _consts.TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedDark), _TOKENS$colorTextButt2)), (0, _defineProperty2.default)(_tokens, _consts.TOKENS.colorTextButtonActive, (_TOKENS$colorTextButt3 = {}, (0, _defineProperty2.default)(_TOKENS$colorTextButt3, _consts.TYPE_OPTIONS.PRIMARY, theme.orbit.colorTextButtonPrimaryActive), (0, _defineProperty2.default)(_TOKENS$colorTextButt3, _consts.TYPE_OPTIONS.SECONDARY, theme.orbit.colorTextButtonSecondaryActive), (0, _defineProperty2.default)(_TOKENS$colorTextButt3, _consts.TYPE_OPTIONS.CRITICAL, theme.orbit.colorTextButtonCriticalActive), (0, _defineProperty2.default)(_TOKENS$colorTextButt3, _consts.TYPE_OPTIONS.WHITE, theme.orbit.colorTextButtonWhiteActive), (0, _defineProperty2.default)(_TOKENS$colorTextButt3, _consts.TYPE_OPTIONS.PRIMARY_SUBTLE, theme.orbit.paletteProductDark), (0, _defineProperty2.default)(_TOKENS$colorTextButt3, _consts.TYPE_OPTIONS.CRITICAL_SUBTLE, theme.orbit.paletteRedDark), _TOKENS$colorTextButt3)), (0, _defineProperty2.default)(_tokens, _consts.TOKENS.borderColorButtonFocus, (_TOKENS$borderColorBu = {}, (0, _defineProperty2.default)(_TOKENS$borderColorBu, _consts.TYPE_OPTIONS.PRIMARY, (0, _convertHexToRgba.default)(theme.orbit.paletteProductNormal, 50)), (0, _defineProperty2.default)(_TOKENS$borderColorBu, _consts.TYPE_OPTIONS.SECONDARY, (0, _convertHexToRgba.default)(theme.orbit.paletteInkLight, 30)), (0, _defineProperty2.default)(_TOKENS$borderColorBu, _consts.TYPE_OPTIONS.CRITICAL, (0, _convertHexToRgba.default)(theme.orbit.paletteRedNormal, 50)), (0, _defineProperty2.default)(_TOKENS$borderColorBu, _consts.TYPE_OPTIONS.WHITE, (0, _convertHexToRgba.default)(theme.orbit.paletteWhiteActive, 50)), (0, _defineProperty2.default)(_TOKENS$borderColorBu, _consts.TYPE_OPTIONS.PRIMARY_SUBTLE, (0, _convertHexToRgba.default)(theme.orbit.paletteProductNormal, 50)), (0, _defineProperty2.default)(_TOKENS$borderColorBu, _consts.TYPE_OPTIONS.CRITICAL_SUBTLE, (0, _convertHexToRgba.default)(theme.orbit.paletteRedNormal, 50)), _TOKENS$borderColorBu)), _tokens); return tokens[name][type]; }; var _default = getButtonTypeToken; exports.default = _default;