@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
1 lines • 1.3 kB
Source Map (JSON)
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/Icon/components/utils.ts"],"sourcesContent":["import { isNumber } from 'es-toolkit/compat';\n\nimport type { IconSize } from '../type';\n\nexport const calcSize = (iconSize?: IconSize) => {\n if (isNumber(iconSize)) {\n return { size: iconSize };\n }\n\n let size: number | string;\n let strokeWidth: number | string;\n\n switch (iconSize) {\n case 'large': {\n size = 24;\n strokeWidth = 2;\n break;\n }\n case 'middle': {\n size = 20;\n strokeWidth = 2;\n break;\n }\n case 'small': {\n size = 14;\n strokeWidth = 2;\n break;\n }\n default: {\n if (iconSize) {\n size = iconSize?.size || 24;\n strokeWidth = iconSize?.strokeWidth || 2;\n } else {\n size = '1em';\n strokeWidth = 2;\n }\n break;\n }\n }\n return { size, strokeWidth };\n};\n"],"mappings":";;AAIA,MAAa,YAAY,aAAwB;CAC/C,IAAI,SAAS,QAAQ,GACnB,OAAO,EAAE,MAAM,SAAS;CAG1B,IAAI;CACJ,IAAI;CAEJ,QAAQ,UAAR;EACE,KAAK;GACH,OAAO;GACP,cAAc;GACd;EAEF,KAAK;GACH,OAAO;GACP,cAAc;GACd;EAEF,KAAK;GACH,OAAO;GACP,cAAc;GACd;EAEF;GACE,IAAI,UAAU;IACZ,OAAO,UAAU,QAAQ;IACzB,cAAc,UAAU,eAAe;GACzC,OAAO;IACL,OAAO;IACP,cAAc;GAChB;GACA;CAEJ;CACA,OAAO;EAAE;EAAM;CAAY;AAC7B"}