import React, { createContext, useContext } from "react";
import nb from "../utils/i18n/locales/nb.js";
export const ProviderContext = createContext({
    locale: nb,
});
export const useProvider = () => useContext(ProviderContext);
/**
 * Provides added context to the component tree.
 *
 * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/provider)
 * @see 🏷️ {@link ProviderProps}
 *
 * @example
 * <Provider rootElement={rootElement}>
 *   {app}
 * </Provider>
 */
export const Provider = ({ children, rootElement, locale, translations, }) => {
    const parentContext = useProvider();
    return (React.createElement(ProviderContext.Provider, { value: {
            rootElement: rootElement || parentContext.rootElement,
            locale: locale || parentContext.locale || nb,
            translations: translations || parentContext.translations,
        } }, children));
};
export default Provider;
//# sourceMappingURL=Provider.js.map