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.

31 lines (23 loc) 1.45 kB
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; var _opacity; import { convertHexToRgba } from "@kiwicom/orbit-design-tokens"; import { TOKENS, TYPE_OPTIONS } from "../consts"; import { BUTTON_STATES } from "../../../primitives/ButtonPrimitive/common/consts"; import getAlertButtonTypeToken from "./getAlertButtonTypeToken"; var opacity = (_opacity = {}, _defineProperty(_opacity, TYPE_OPTIONS.INFO, 15), _defineProperty(_opacity, TYPE_OPTIONS.SUCCESS, 15), _defineProperty(_opacity, TYPE_OPTIONS.WARNING, 15), _defineProperty(_opacity, TYPE_OPTIONS.CRITICAL, 15), _defineProperty(_opacity, TYPE_OPTIONS.INFO_SUBTLE, 8), _defineProperty(_opacity, TYPE_OPTIONS.SUCCESS_SUBTLE, 8), _defineProperty(_opacity, TYPE_OPTIONS.WARNING_SUBTLE, 8), _defineProperty(_opacity, TYPE_OPTIONS.CRITICAL_SUBTLE, 8), _opacity); var getAlertButtonBoxShadow = function getAlertButtonBoxShadow(state, disabled, theme, type) { var wrappedButtonTypeToken = function wrappedButtonTypeToken(name) { return getAlertButtonTypeToken(name, type, theme); }; if (disabled) { return null; } if (state === BUTTON_STATES.ACTIVE) { return "inset 0 0 6px 3px ".concat(convertHexToRgba(theme.orbit.paletteInkNormal, opacity[type]), ";"); } if (state === BUTTON_STATES.FOCUS) { return "0 0 0 3px ".concat(wrappedButtonTypeToken(TOKENS.borderColorButtonFocus)); } return null; }; export default getAlertButtonBoxShadow;