{"version":3,"file":"IconProvider.cjs","names":[],"sources":["../../src/icons/IconProvider.tsx"],"sourcesContent":["import { type ReactNode, useMemo } from \"react\";\n\nimport { IconContext, type IconContextValue, type IconRegistry } from \"./icon-context\";\n\nexport interface IconProviderProps {\n    /**\n     * Icons resolved with zero extra requests.\n     *\n     * Pass `staticIcons` from the `virtual:tempest-icons` module the\n     * `tempestIcons()` Vite plugin generates, or a table built by\n     * `createIconRegistry`. Slugs found here never trigger a shard fetch.\n     */\n    registry?: IconRegistry;\n    /** Default `size` for every `<Icon>` below. Lucide's own default is `24`. */\n    size?: number | string;\n    /** Default `strokeWidth` for every `<Icon>` below. Lucide's own default is `2`. */\n    strokeWidth?: number;\n    children: ReactNode;\n}\n\nconst EMPTY_REGISTRY: IconRegistry = {};\n\n/**\n * Provide a static icon registry and shared `<Icon>` defaults to a subtree.\n *\n * Entirely optional: without it `<Icon>` still resolves any of lucide's ~2000\n * slugs by fetching the shard that owns it. What the provider buys is the\n * zero-request path for the slugs an app actually uses, plus one place to set\n * `size`/`strokeWidth` instead of repeating them at every call site.\n *\n * @example\n * import { IconProvider } from \"tempest-react-sdk/icons\";\n * import { staticIcons } from \"virtual:tempest-icons\";\n *\n * <IconProvider registry={staticIcons} size={18}>\n *     <App />\n * </IconProvider>\n */\nexport function IconProvider({\n    registry = EMPTY_REGISTRY,\n    size,\n    strokeWidth,\n    children,\n}: IconProviderProps): ReactNode {\n    const value = useMemo<IconContextValue>(\n        () => ({ registry, size, strokeWidth }),\n        [registry, size, strokeWidth],\n    );\n    return <IconContext.Provider value={value}>{children}</IconContext.Provider>;\n}\n"],"mappings":"4FAoBA,IAAM,EAA+B,CAAC,EAkBtC,SAAgB,EAAa,CACzB,WAAW,EACX,OACA,cACA,YAC6B,CAC7B,IAAM,GAAA,EAAQ,EAAA,QAAA,MACH,CAAE,WAAU,OAAM,aAAY,GACrC,CAAC,EAAU,EAAM,CAAW,CAChC,EACA,OAAO,EAAA,EAAA,IAAA,CAAC,EAAA,YAAY,SAAb,CAA6B,QAAQ,UAA+B,CAAA,CAC/E"}