(
const buttonRef = useRef
(null);
const mergedRef = useMergeRefs(buttonRef, ref);
const [open, setOpen] = useState(false);
- const themeContext = UNSAFE_useAkselTheme(false);
+ const themeContext = useThemeInternal(false);
const translate = useI18n("HelpText");
const titleWithFallback = title || translate("title");
diff --git a/@navikt/core/react/src/internal-header/InternalHeader.tsx b/@navikt/core/react/src/internal-header/InternalHeader.tsx
index bb135378bb..654f7b5166 100644
--- a/@navikt/core/react/src/internal-header/InternalHeader.tsx
+++ b/@navikt/core/react/src/internal-header/InternalHeader.tsx
@@ -1,6 +1,6 @@
import cl from "clsx";
import React, { HTMLAttributes, forwardRef } from "react";
-import { UNSAFE_AkselTheme, UNSAFE_useAkselTheme } from "../provider";
+import { Theme, useThemeInternal } from "../theme/Theme";
import { OverridableComponent } from "../util/types";
import InternalHeaderButton, {
InternalHeaderButtonProps,
@@ -78,20 +78,20 @@ interface InternalHeaderComponent
* ```
*/
export const InternalHeader = forwardRef(({ className, ...rest }, ref) => {
- const themeContext = UNSAFE_useAkselTheme(false);
+ const themeContext = useThemeInternal(false);
/*
* Component is always in "dark" mode, so we manually override global theme.
*/
if (themeContext) {
return (
-
+
-
+
);
}
diff --git a/@navikt/core/react/src/layout/base/BasePrimitive.tsx b/@navikt/core/react/src/layout/base/BasePrimitive.tsx
index 064bd46f44..b679c2e8c8 100644
--- a/@navikt/core/react/src/layout/base/BasePrimitive.tsx
+++ b/@navikt/core/react/src/layout/base/BasePrimitive.tsx
@@ -1,7 +1,7 @@
import cl from "clsx";
import React from "react";
-import { UNSAFE_useAkselTheme } from "../../provider";
import { Slot } from "../../slot/Slot";
+import { useThemeInternal } from "../../theme/Theme";
import { getResponsiveProps, getResponsiveValue } from "../utilities/css";
import { ResponsiveProp, SpacingScale } from "../utilities/types";
@@ -252,7 +252,7 @@ export const BasePrimitive = ({
flexShrink,
gridColumn,
}: BasePrimitiveProps) => {
- const themeContext = UNSAFE_useAkselTheme(false);
+ const themeContext = useThemeInternal(false);
const prefix = themeContext ? "ax" : "a";
const style: React.CSSProperties = {
diff --git a/@navikt/core/react/src/layout/bleed/Bleed.tsx b/@navikt/core/react/src/layout/bleed/Bleed.tsx
index 2aa5b83c73..4d292ff28f 100644
--- a/@navikt/core/react/src/layout/bleed/Bleed.tsx
+++ b/@navikt/core/react/src/layout/bleed/Bleed.tsx
@@ -1,7 +1,7 @@
import cl from "clsx";
import React, { forwardRef } from "react";
-import { UNSAFE_useAkselTheme } from "../../provider";
import { Slot } from "../../slot/Slot";
+import { useThemeInternal } from "../../theme/Theme";
import { getResponsiveProps } from "../utilities/css";
import { ResponsiveProp, SpacingScale } from "../utilities/types";
@@ -81,7 +81,7 @@ export const Bleed = forwardRef(
},
ref,
) => {
- const themeContext = UNSAFE_useAkselTheme(false);
+ const themeContext = useThemeInternal(false);
const prefix = themeContext ? "ax" : "a";
let style: React.CSSProperties = {
diff --git a/@navikt/core/react/src/layout/box/Box.tsx b/@navikt/core/react/src/layout/box/Box.tsx
index 0b79d1e2ab..9f218026aa 100644
--- a/@navikt/core/react/src/layout/box/Box.tsx
+++ b/@navikt/core/react/src/layout/box/Box.tsx
@@ -1,8 +1,8 @@
import cl from "clsx";
import React, { forwardRef } from "react";
import { type BorderRadiusKeys } from "@navikt/ds-tokens/types";
-import { UNSAFE_useAkselTheme } from "../../provider";
import { Slot } from "../../slot/Slot";
+import { useThemeInternal } from "../../theme/Theme";
import { omit } from "../../util";
import { OverridableComponent } from "../../util/types";
import BasePrimitive, {
@@ -109,7 +109,7 @@ export const BoxComponent: OverridableComponent =
},
ref,
) => {
- const themeContext = UNSAFE_useAkselTheme(false);
+ const themeContext = useThemeInternal(false);
if (
process.env.NODE_ENV !== "production" &&
diff --git a/@navikt/core/react/src/layout/grid/HGrid.tsx b/@navikt/core/react/src/layout/grid/HGrid.tsx
index e894968274..9809d80528 100644
--- a/@navikt/core/react/src/layout/grid/HGrid.tsx
+++ b/@navikt/core/react/src/layout/grid/HGrid.tsx
@@ -1,7 +1,7 @@
import cl from "clsx";
import React, { forwardRef } from "react";
-import { UNSAFE_useAkselTheme } from "../../provider";
import { Slot } from "../../slot/Slot";
+import { useThemeInternal } from "../../theme/Theme";
import { OverridableComponent, omit } from "../../util";
import BasePrimitive, {
PRIMITIVE_PROPS,
@@ -78,7 +78,7 @@ export const HGrid: OverridableComponent =
},
ref,
) => {
- const themeContext = UNSAFE_useAkselTheme(false);
+ const themeContext = useThemeInternal(false);
const prefix = themeContext ? "ax" : "a";
const styles: React.CSSProperties = {
diff --git a/@navikt/core/react/src/layout/page/Page.tsx b/@navikt/core/react/src/layout/page/Page.tsx
index 598ec3b4af..24bddf0726 100644
--- a/@navikt/core/react/src/layout/page/Page.tsx
+++ b/@navikt/core/react/src/layout/page/Page.tsx
@@ -1,6 +1,6 @@
import cl from "clsx";
import React, { forwardRef } from "react";
-import { UNSAFE_useAkselTheme } from "../../provider";
+import { useThemeInternal } from "../../theme/Theme";
import { OverridableComponent } from "../../util";
import { BackgroundColorToken } from "../utilities/types";
import { PageBlock } from "./parts/PageBlock";
@@ -54,7 +54,7 @@ export const PageComponent: OverridableComponent =
},
ref,
) => {
- const themeContext = UNSAFE_useAkselTheme(false);
+ const themeContext = useThemeInternal(false);
if (process.env.NODE_ENV !== "production" && themeContext && background) {
console.warn(
diff --git a/@navikt/core/react/src/layout/stack/Stack.tsx b/@navikt/core/react/src/layout/stack/Stack.tsx
index 880b36cdb3..68b8cfed95 100644
--- a/@navikt/core/react/src/layout/stack/Stack.tsx
+++ b/@navikt/core/react/src/layout/stack/Stack.tsx
@@ -1,7 +1,7 @@
import cl from "clsx";
import React, { HTMLAttributes, forwardRef } from "react";
-import { UNSAFE_useAkselTheme } from "../../provider";
import { Slot } from "../../slot/Slot";
+import { useThemeInternal } from "../../theme/Theme";
import { omit } from "../../util";
import { OverridableComponent } from "../../util/types";
import BasePrimitive, {
@@ -84,7 +84,7 @@ export const Stack: OverridableComponent =
},
ref,
) => {
- const themeContext = UNSAFE_useAkselTheme(false);
+ const themeContext = useThemeInternal(false);
const prefix = themeContext ? "ax" : "a";
const style: React.CSSProperties = {
diff --git a/@navikt/core/react/src/overlays/action-menu/ActionMenu.tsx b/@navikt/core/react/src/overlays/action-menu/ActionMenu.tsx
index c159cd0ccc..8d81e2bb13 100644
--- a/@navikt/core/react/src/overlays/action-menu/ActionMenu.tsx
+++ b/@navikt/core/react/src/overlays/action-menu/ActionMenu.tsx
@@ -2,8 +2,8 @@ import cl from "clsx";
import React, { forwardRef, useRef } from "react";
import { ChevronRightIcon } from "@navikt/aksel-icons";
import { useModalContext } from "../../modal/Modal.context";
-import { UNSAFE_useAkselTheme } from "../../provider";
import { Slot } from "../../slot/Slot";
+import { useThemeInternal } from "../../theme/Theme";
import { OverridableComponent, useId } from "../../util";
import { composeEventHandlers } from "../../util/composeEventHandlers";
import { createContext } from "../../util/create-context";
@@ -736,7 +736,7 @@ export const ActionMenuRadioItem = forwardRef<
{ children, className, onSelect, ...rest }: ActionMenuRadioItemProps,
ref,
) => {
- const themeContext = UNSAFE_useAkselTheme(false);
+ const themeContext = useThemeInternal(false);
return (
{
- const themeContext = UNSAFE_useAkselTheme(false);
+ const themeContext = useThemeInternal(false);
return (
-