UNPKG

flowbite-react-icons

Version:
1 lines 2.04 kB
{"version":3,"file":"base-icon.mjs","sources":["../../../src/components/base-icon.tsx"],"sourcesContent":["import { forwardRef, useMemo } from \"react\";\nimport { getStore } from \"../store\";\nimport type { FlowbiteIconProps } from \"../types\";\n\nexport const BaseIcon = forwardRef<SVGSVGElement, FlowbiteIconProps>(\n (props, ref) => {\n const {\n width,\n height,\n // custom\n size,\n // rest\n ...otherProps\n } = props;\n\n const theme = getStore();\n\n const mergedProps = useMemo(() => {\n const _props: typeof otherProps = { ...otherProps };\n\n for (const _key in theme) {\n const key = _key as keyof typeof theme;\n\n if (key === \"size\") continue;\n\n // @ts-expect-error: too complex to represent\n _props[key] = _props[key] ?? theme[key];\n }\n\n return _props;\n }, [otherProps, theme]);\n\n return (\n <svg\n ref={ref}\n width={width ?? size ?? theme.width ?? theme.size}\n height={height ?? size ?? theme.height ?? theme.size}\n {...mergedProps}\n />\n );\n },\n);\n"],"names":[],"mappings":";;;;AAIY,MAAC,QAAQ,GAAG,UAAU;AAClC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK;AAClB,IAAI,MAAM;AACV,MAAM,KAAK;AACX,MAAM,MAAM;AACZ;AACA,MAAM,IAAI;AACV;AACA,MAAM,GAAG,UAAU;AACnB,KAAK,GAAG,KAAK,CAAC;AACd,IAAI,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AAC7B,IAAI,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM;AACtC,MAAM,MAAM,MAAM,GAAG,EAAE,GAAG,UAAU,EAAE,CAAC;AACvC,MAAM,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;AAChC,QAAQ,MAAM,GAAG,GAAG,IAAI,CAAC;AACzB,QAAQ,IAAI,GAAG,KAAK,MAAM,EAAE,SAAS;AACrC,QAAQ,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AAChD,OAAO;AACP,MAAM,OAAO,MAAM,CAAC;AACpB,KAAK,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;AAC5B,IAAI,uBAAuB,GAAG;AAC9B,MAAM,KAAK;AACX,MAAM;AACN,QAAQ,GAAG;AACX,QAAQ,KAAK,EAAE,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI;AACzD,QAAQ,MAAM,EAAE,MAAM,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI;AAC5D,QAAQ,GAAG,WAAW;AACtB,OAAO;AACP,KAAK,CAAC;AACN,GAAG;AACH;;;;"}