UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

1 lines 1.55 kB
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/ActionIcon/components/utils.ts"],"sourcesContent":["import { isNumber } from 'es-toolkit/compat';\n\nimport type { ActionIconSize } from '@/ActionIcon';\n\nexport const calcSize = (iconSize?: ActionIconSize) => {\n let blockSize: number | string;\n let borderRadius: number | string;\n\n if (isNumber(iconSize)) {\n const blockSize = iconSize * 1.8;\n return {\n blockSize,\n borderRadius: Math.floor(blockSize / 6),\n };\n }\n\n switch (iconSize) {\n case 'large': {\n blockSize = 44;\n borderRadius = 8;\n break;\n }\n case 'middle': {\n blockSize = 36;\n borderRadius = 6;\n break;\n }\n case 'small': {\n blockSize = 24;\n borderRadius = 4;\n break;\n }\n default: {\n if (iconSize) {\n blockSize = iconSize?.blockSize || 36;\n borderRadius = iconSize?.borderRadius || 6;\n } else {\n blockSize = '1.8em';\n borderRadius = '0.3em';\n }\n\n break;\n }\n }\n\n return {\n blockSize,\n borderRadius,\n };\n};\n"],"mappings":";;AAIA,MAAa,YAAY,aAA8B;CACrD,IAAI;CACJ,IAAI;CAEJ,IAAI,SAAS,QAAQ,GAAG;EACtB,MAAM,YAAY,WAAW;EAC7B,OAAO;GACL;GACA,cAAc,KAAK,MAAM,YAAY,CAAC;EACxC;CACF;CAEA,QAAQ,UAAR;EACE,KAAK;GACH,YAAY;GACZ,eAAe;GACf;EAEF,KAAK;GACH,YAAY;GACZ,eAAe;GACf;EAEF,KAAK;GACH,YAAY;GACZ,eAAe;GACf;EAEF;GACE,IAAI,UAAU;IACZ,YAAY,UAAU,aAAa;IACnC,eAAe,UAAU,gBAAgB;GAC3C,OAAO;IACL,YAAY;IACZ,eAAe;GACjB;GAEA;CAEJ;CAEA,OAAO;EACL;EACA;CACF;AACF"}