@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
1 lines • 1.35 kB
Source Map (JSON)
{"version":3,"file":"utils.mjs","names":["size: number | string","strokeWidth: number | string"],"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;AAC/C,KAAI,SAAS,SAAS,CACpB,QAAO,EAAE,MAAM,UAAU;CAG3B,IAAIA;CACJ,IAAIC;AAEJ,SAAQ,UAAR;EACE,KAAK;AACH,UAAO;AACP,iBAAc;AACd;EAEF,KAAK;AACH,UAAO;AACP,iBAAc;AACd;EAEF,KAAK;AACH,UAAO;AACP,iBAAc;AACd;EAEF;AACE,OAAI,UAAU;AACZ,WAAO,UAAU,QAAQ;AACzB,kBAAc,UAAU,eAAe;UAClC;AACL,WAAO;AACP,kBAAc;;AAEhB;;AAGJ,QAAO;EAAE;EAAM;EAAa"}