For example, I've implemented a slightly modified custom Avatar component using Mantine components (like MantineAvatar and ThemeIcon) and packaged it into a shared npm package. When I try to use this component in my Next.js project, I'm getting this error:
"@mantine/core: MantineProvider was not found in component tree, make sure you have it in your app"
This happens despite having MantineProvider at the root layout of my application. However, when I use Mantine components directly (without the wrapper from my shared package), everything works fine.
What's the proper way to structure components in a shared package that depend on Mantine's context, so they can be used seamlessly across projects and in Storybook without requiring additional provider wrappers in each usage location?
quick realization:https://jsfiddle.net/fdxb92vg/
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.