@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.
107 lines (106 loc) • 7.21 kB
JavaScript
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _orbitDesignTokens = require("@kiwicom/orbit-design-tokens");
var _consts = require("../consts");
const getButtonTypeToken = ({
name,
type,
theme
}) => {
const tokens = {
[]: {
[]: theme.orbit.backgroundButtonPrimary,
[]: theme.orbit.backgroundButtonSecondary,
[]: theme.orbit.backgroundButtonCritical,
[]: theme.orbit.backgroundButtonWhite,
[]: theme.orbit.backgroundButtonPrimarySubtle,
[]: theme.orbit.backgroundButtonCriticalSubtle,
[]: theme.orbit.backgroundButtonBundleBasic,
[]: theme.orbit.backgroundButtonBundleMedium,
[]: theme.orbit.backgroundButtonBundleTop
},
[]: {
[]: theme.orbit.backgroundButtonPrimaryHover,
[]: theme.orbit.backgroundButtonSecondaryHover,
[]: theme.orbit.backgroundButtonCriticalHover,
[]: theme.orbit.backgroundButtonWhiteHover,
[]: theme.orbit.backgroundButtonPrimarySubtleHover,
[]: theme.orbit.backgroundButtonCriticalSubtleHover,
[]: theme.orbit.backgroundButtonBundleBasicHover,
[]: theme.orbit.backgroundButtonBundleMediumHover,
[]: theme.orbit.backgroundButtonBundleTopHover
},
[]: {
[]: theme.orbit.backgroundButtonPrimaryActive,
[]: theme.orbit.backgroundButtonSecondaryActive,
[]: theme.orbit.backgroundButtonCriticalActive,
[]: theme.orbit.backgroundButtonWhiteActive,
[]: theme.orbit.backgroundButtonPrimarySubtleActive,
[]: theme.orbit.backgroundButtonCriticalSubtleActive,
[]: theme.orbit.backgroundButtonBundleBasicActive,
[]: theme.orbit.backgroundButtonBundleMediumActive,
[]: theme.orbit.backgroundButtonBundleTopActive
},
[]: {
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteProductNormal, 10),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteInkNormal, 10),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteRedNormal, 10),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteWhite, 20),
[]: theme.orbit.backgroundButtonPrimarySubtleFocus,
[]: theme.orbit.backgroundButtonCriticalSubtleFocus,
[]: theme.orbit.backgroundButtonBundleBasic,
[]: theme.orbit.backgroundButtonBundleMedium,
[]: theme.orbit.backgroundButtonBundleTop
},
[]: {
[]: theme.orbit.colorTextButtonPrimary,
[]: theme.orbit.colorTextButtonSecondary,
[]: theme.orbit.colorTextButtonCritical,
[]: theme.orbit.colorTextButtonWhite,
[]: theme.orbit.colorTextButtonPrimarySubtle,
[]: theme.orbit.colorTextButtonCriticalSubtle,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite
},
[]: {
[]: theme.orbit.colorTextButtonPrimaryHover,
[]: theme.orbit.colorTextButtonSecondaryHover,
[]: theme.orbit.colorTextButtonCriticalHover,
[]: theme.orbit.colorTextButtonWhiteHover,
[]: theme.orbit.colorTextButtonPrimarySubtleHover,
[]: theme.orbit.colorTextButtonCriticalSubtleHover,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite
},
[]: {
[]: theme.orbit.colorTextButtonPrimaryActive,
[]: theme.orbit.colorTextButtonSecondaryActive,
[]: theme.orbit.colorTextButtonCriticalActive,
[]: theme.orbit.colorTextButtonWhiteActive,
[]: theme.orbit.colorTextButtonPrimarySubtleActive,
[]: theme.orbit.colorTextButtonCriticalSubtleActive,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite
},
[]: {
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteProductNormal, 50),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteInkNormal, 30),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteRedNormal, 50),
// because it's not possible to see outline on the white bg, we use active token
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteWhiteActive, 50),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteProductNormal, 50),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteRedNormal, 50),
// TODO: currently we do not have tokens for these colors
[]: (0, _orbitDesignTokens.convertHexToRgba)(`
[]: (0, _orbitDesignTokens.convertHexToRgba)(`
[]: (0, _orbitDesignTokens.convertHexToRgba)(`
}
};
return tokens[name][type];
};
var _default = getButtonTypeToken;
exports.default = _default;