1 line
14 KiB
JSON
1 line
14 KiB
JSON
|
{"ast":null,"code":"import { unit } from '@ant-design/cssinjs';\nimport { genRoundedArrow } from './roundedArrow';\nexport const MAX_VERTICAL_CONTENT_RADIUS = 8;\nexport function getArrowOffsetToken(options) {\n const {\n contentRadius,\n limitVerticalRadius\n } = options;\n const arrowOffset = contentRadius > 12 ? contentRadius + 2 : 12;\n const arrowOffsetVertical = limitVerticalRadius ? MAX_VERTICAL_CONTENT_RADIUS : arrowOffset;\n return {\n arrowOffsetHorizontal: arrowOffset,\n arrowOffsetVertical\n };\n}\nfunction isInject(valid, code) {\n if (!valid) {\n return {};\n }\n return code;\n}\nexport default function getArrowStyle(token, colorBg, options) {\n const {\n componentCls,\n boxShadowPopoverArrow,\n arrowOffsetVertical,\n arrowOffsetHorizontal\n } = token;\n const {\n arrowDistance = 0,\n arrowPlacement = {\n left: true,\n right: true,\n top: true,\n bottom: true\n }\n } = options || {};\n return {\n [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign({\n // ============================ Basic ============================\n [`${componentCls}-arrow`]: [Object.assign(Object.assign({\n position: 'absolute',\n zIndex: 1,\n display: 'block'\n }, genRoundedArrow(token, colorBg, boxShadowPopoverArrow)), {\n '&:before': {\n background: colorBg\n }\n })]\n }, isInject(!!arrowPlacement.top, {\n [[`&-placement-top > ${componentCls}-arrow`, `&-placement-topLeft > ${componentCls}-arrow`, `&-placement-topRight > ${componentCls}-arrow`].join(',')]: {\n bottom: arrowDistance,\n transform: 'translateY(100%) rotate(180deg)'\n },\n [`&-placement-top > ${componentCls}-arrow`]: {\n left: {\n _skip_check_: true,\n value: '50%'\n },\n transform: 'translateX(-50%) translateY(100%) rotate(180deg)'\n },\n '&-placement-topLeft': {\n '--arrow-offset-horizontal': arrowOffsetHorizontal,\n [`> ${componentCls}-arrow`]: {\n left: {\n _skip_check_: true,\n value: arrowOffsetHorizontal\n }\n }\n },\n '&-placement-topRight': {\n '--arrow-offset-horizontal': `calc(100% - ${unit(arrowOffsetHorizontal)})`,\n [`> ${componentCls}-arrow`]: {\n right: {\n _skip_check_: true,\n value: arrowOffsetHorizontal\n }\n }\n }\n })), isInject(!!arrowPlacement.bottom, {\n [[`&-placement-bottom > ${componentCls}-arrow`, `&-placement-bottomLeft > ${componentCls}-arrow`, `&-placement-bottomRight > ${componentCls}-arrow`].join(',')]: {\n top: arrowDistance,\n transform: `translateY(-100%)`\n },\n [`&-placement-bottom > ${componentCls}-arrow`]: {\n left: {\n _skip_check_: true,\n value: '50%'\n },\n transform: `translateX(-50%) translateY(-100%)`\n },\n '&-placement-bottomLeft': {\n '--arrow-offset-horizontal': arrowOffsetHorizontal,\n [`> ${componentCls}-arrow`]: {\n left: {\n _skip_check_: true,\n value: arrowOffsetHorizontal\n }\n }\n },\n '&-placement-bottomRight': {\n '--arrow-offset-horizontal': `calc(100% - ${unit(arrowOffsetHorizontal)})`,\n [`> ${componentCls}-arrow`]: {\n right: {\n _skip_check_: true,\n value: arrowOffsetHorizontal\n }\n }\n }\n })), isInject(!!arrowPlacement.left, {\n [[`&-placement-left > ${componentCls}-arrow`, `&-placement-leftTop > ${componentCls}-arrow`, `&-placement-leftBottom > ${componentCls}-arrow`].join(',')]: {\n right: {\n _skip_check_: true,\n value: arrowDistance\n },\n transform: 'translateX(100%) rotate(90deg)'\n },\n [`&-placement-left > ${componentCls}-arrow`]: {\n top: {\n _skip_check_: true,\n value: '50%'\n },\n transform: 'translateY(-50%) tra
|