lucide-react
Version:
A Lucide icon library package for React applications.
1 lines • 1.18 kB
Source Map (JSON)
{"version":3,"file":"context.mjs","sources":["../../src/context.ts"],"sourcesContent":["'use client';\n\nimport { createContext, createElement, type ReactNode, useContext, useMemo } from 'react';\nimport { LucideProps } from './types';\n\ntype LucideConfig = {\n size: number;\n color: string;\n strokeWidth: number;\n absoluteStrokeWidth: boolean;\n className: string;\n};\n\nconst LucideContext = createContext<LucideProps>({});\n\ntype LucideProviderProps = {\n children: ReactNode;\n} & Partial<LucideConfig>;\n\nexport function LucideProvider({\n children,\n size,\n color,\n strokeWidth,\n absoluteStrokeWidth,\n className,\n}: LucideProviderProps) {\n const value = useMemo(\n () => ({\n size,\n color,\n strokeWidth,\n absoluteStrokeWidth,\n className,\n }),\n [size, color, strokeWidth, absoluteStrokeWidth, className],\n );\n\n return createElement(LucideContext.Provider, { value }, children);\n}\n\nexport const useLucideContext = () => useContext(LucideContext);\n"],"names":[],"mappings":";;;;;;;;;;;AAaA;AAMO;AAAwB;AAC7B;AACA;AACA;AACA;AACA;AAEF;AACE;AAAc;AACL;AACL;AACA;AACA;AACA;AACA;AACF;AACyD;AAG3D;AACF;AAEO;;"}