UNPKG

@razorpay/blade

Version:

The Design System that powers Razorpay

48 lines (45 loc) 2.02 kB
import { checkboxIconColors, checkboxSizes } from '../checkboxTokens.js'; import getIn from '../../../utils/lodashButBetter/get.js'; import '../../../utils/makeSpace/index.js'; import '../../../utils/makeSize/index.js'; import '../../../utils/makeBorderSize/index.js'; import '../../../tokens/global/index.js'; import { makeSpace } from '../../../utils/makeSpace/makeSpace.js'; import { makeBorderSize } from '../../../utils/makeBorderSize/makeBorderSize.js'; import { makeSize } from '../../../utils/makeSize/makeSize.js'; import { size } from '../../../tokens/global/size.js'; var getCheckboxIconWrapperStyles = function getCheckboxIconWrapperStyles(_ref) { var theme = _ref.theme, isChecked = _ref.isChecked, isDisabled = _ref.isDisabled, isNegative = _ref.isNegative, isIndeterminate = _ref.isIndeterminate, size$1 = _ref.size; var variant = 'default'; if (isDisabled) variant = 'disabled'; if (isNegative) variant = 'negative'; var checked = isChecked ? 'checked' : 'unchecked'; var background = checkboxIconColors.variants[variant].background[checked]; var border = checkboxIconColors.variants[variant].border[checked]; var backgroundColor = getIn(theme, background); var borderColor = getIn(theme, border); var _borderWidth = size$1 === 'large' ? theme.border.width.thicker : theme.border.width.thick; return { position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0, width: makeSpace(checkboxSizes.icon[size$1].width), height: makeSpace(checkboxSizes.icon[size$1].height), borderWidth: makeBorderSize(_borderWidth), borderStyle: 'solid', margin: makeSpace(theme.spacing[1]), borderRadius: makeSize(theme.border.radius.xsmall), backgroundColor: backgroundColor, borderColor: borderColor, paddingTop: size$1 === 'small' && !isIndeterminate ? makeSize(size['1']) : 0 }; }; export { getCheckboxIconWrapperStyles }; //# sourceMappingURL=CheckboxIconWrapperStyles.js.map