@navikt/ds-react 7.31.0 → 7.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/cjs/chat/Chat.d.ts +1 -1
  2. package/cjs/chat/Chat.js.map +1 -1
  3. package/cjs/copybutton/CopyButton.js +1 -1
  4. package/cjs/copybutton/CopyButton.js.map +1 -1
  5. package/cjs/form/combobox/Input/Input.context.d.ts +2 -2
  6. package/cjs/form/file-upload/useFileUpload.d.ts +1 -1
  7. package/cjs/form/useFormField.js.map +1 -1
  8. package/cjs/modal/ModalUtils.d.ts +2 -2
  9. package/cjs/modal/ModalUtils.js.map +1 -1
  10. package/cjs/overlays/dismissablelayer/DismissableLayer.d.ts +1 -1
  11. package/cjs/overlays/floating/Floating.js +2 -2
  12. package/cjs/overlays/floating/Floating.js.map +1 -1
  13. package/cjs/overlays/overlay/hooks/{useOpenChangeComplete.d.ts → useOpenChangeAnimationComplete.d.ts} +2 -2
  14. package/cjs/overlays/overlay/hooks/{useOpenChangeComplete.js → useOpenChangeAnimationComplete.js} +3 -3
  15. package/cjs/overlays/overlay/hooks/useOpenChangeAnimationComplete.js.map +1 -0
  16. package/cjs/overlays/overlay/hooks/useTransitionStatus.d.ts +38 -0
  17. package/cjs/overlays/overlay/hooks/useTransitionStatus.js +118 -0
  18. package/cjs/overlays/overlay/hooks/useTransitionStatus.js.map +1 -0
  19. package/cjs/progress-bar/ProgressBar.js +1 -1
  20. package/cjs/progress-bar/ProgressBar.js.map +1 -1
  21. package/cjs/read-more/ReadMore.d.ts +2 -9
  22. package/cjs/read-more/ReadMore.js +1 -8
  23. package/cjs/read-more/ReadMore.js.map +1 -1
  24. package/cjs/table/AnimateHeight.js +2 -2
  25. package/cjs/table/AnimateHeight.js.map +1 -1
  26. package/cjs/tabs/Tabs.context.d.ts +1 -1
  27. package/cjs/tabs/parts/tab/useTab.d.ts +1 -1
  28. package/cjs/tabs/parts/tablist/useScrollButtons.d.ts +1 -1
  29. package/cjs/tabs/parts/tablist/useScrollButtons.js.map +1 -1
  30. package/cjs/toggle-group/ToggleGroup.context.d.ts +1 -1
  31. package/cjs/toggle-group/parts/useToggleItem.d.ts +1 -1
  32. package/cjs/util/hooks/descendants/useDescendant.d.ts +1 -1
  33. package/cjs/util/hooks/useMergeRefs.d.ts +3 -3
  34. package/cjs/util/hooks/useMergeRefs.js +3 -3
  35. package/cjs/util/hooks/useMergeRefs.js.map +1 -1
  36. package/cjs/util/renderStoriesForChromatic.d.ts +2 -2
  37. package/cjs/util/renderStoriesForChromatic.js +2 -2
  38. package/cjs/util/renderStoriesForChromatic.js.map +1 -1
  39. package/cjs/util/virtualfocus/Context.d.ts +1 -1
  40. package/esm/chat/Chat.d.ts +1 -1
  41. package/esm/chat/Chat.js.map +1 -1
  42. package/esm/copybutton/CopyButton.js +1 -1
  43. package/esm/copybutton/CopyButton.js.map +1 -1
  44. package/esm/form/combobox/Input/Input.context.d.ts +2 -2
  45. package/esm/form/file-upload/useFileUpload.d.ts +1 -1
  46. package/esm/form/useFormField.js.map +1 -1
  47. package/esm/modal/ModalUtils.d.ts +2 -2
  48. package/esm/modal/ModalUtils.js.map +1 -1
  49. package/esm/overlays/dismissablelayer/DismissableLayer.d.ts +1 -1
  50. package/esm/overlays/floating/Floating.js +2 -2
  51. package/esm/overlays/floating/Floating.js.map +1 -1
  52. package/esm/overlays/overlay/hooks/{useOpenChangeComplete.d.ts → useOpenChangeAnimationComplete.d.ts} +2 -2
  53. package/esm/overlays/overlay/hooks/{useOpenChangeComplete.js → useOpenChangeAnimationComplete.js} +2 -2
  54. package/esm/overlays/overlay/hooks/useOpenChangeAnimationComplete.js.map +1 -0
  55. package/esm/overlays/overlay/hooks/useTransitionStatus.d.ts +38 -0
  56. package/esm/overlays/overlay/hooks/useTransitionStatus.js +113 -0
  57. package/esm/overlays/overlay/hooks/useTransitionStatus.js.map +1 -0
  58. package/esm/progress-bar/ProgressBar.js +1 -1
  59. package/esm/progress-bar/ProgressBar.js.map +1 -1
  60. package/esm/read-more/ReadMore.d.ts +2 -9
  61. package/esm/read-more/ReadMore.js +1 -8
  62. package/esm/read-more/ReadMore.js.map +1 -1
  63. package/esm/table/AnimateHeight.js +2 -2
  64. package/esm/table/AnimateHeight.js.map +1 -1
  65. package/esm/tabs/Tabs.context.d.ts +1 -1
  66. package/esm/tabs/parts/tab/useTab.d.ts +1 -1
  67. package/esm/tabs/parts/tablist/useScrollButtons.d.ts +1 -1
  68. package/esm/tabs/parts/tablist/useScrollButtons.js.map +1 -1
  69. package/esm/toggle-group/ToggleGroup.context.d.ts +1 -1
  70. package/esm/toggle-group/parts/useToggleItem.d.ts +1 -1
  71. package/esm/util/hooks/descendants/useDescendant.d.ts +1 -1
  72. package/esm/util/hooks/useMergeRefs.d.ts +3 -3
  73. package/esm/util/hooks/useMergeRefs.js +3 -3
  74. package/esm/util/hooks/useMergeRefs.js.map +1 -1
  75. package/esm/util/renderStoriesForChromatic.d.ts +2 -2
  76. package/esm/util/renderStoriesForChromatic.js +2 -2
  77. package/esm/util/renderStoriesForChromatic.js.map +1 -1
  78. package/esm/util/virtualfocus/Context.d.ts +1 -1
  79. package/package.json +4 -4
  80. package/src/chat/Chat.tsx +3 -3
  81. package/src/copybutton/CopyButton.tsx +1 -1
  82. package/src/form/combobox/Input/Input.context.tsx +2 -2
  83. package/src/form/useFormField.ts +1 -1
  84. package/src/modal/ModalUtils.ts +2 -2
  85. package/src/overlays/action-menu/ActionMenu.tsx +1 -1
  86. package/src/overlays/floating/Floating.tsx +2 -2
  87. package/src/overlays/overlay/hooks/{useOpenChangeComplete.ts → useOpenChangeAnimationComplete.ts} +3 -3
  88. package/src/overlays/overlay/hooks/useTransitionStatus.ts +145 -0
  89. package/src/progress-bar/ProgressBar.tsx +1 -1
  90. package/src/read-more/ReadMore.tsx +4 -11
  91. package/src/table/AnimateHeight.tsx +2 -2
  92. package/src/tabs/parts/tablist/useScrollButtons.ts +3 -1
  93. package/src/util/hooks/useMergeRefs.ts +5 -5
  94. package/src/util/link-anchor/LinkAnchor.tsx +1 -1
  95. package/src/util/renderStoriesForChromatic.tsx +4 -5
  96. package/cjs/overlays/overlay/hooks/useOpenChangeComplete.js.map +0 -1
  97. package/esm/overlays/overlay/hooks/useOpenChangeComplete.js.map +0 -1
@@ -16,7 +16,7 @@ export declare const TabsDescendantsProvider: import("react").Provider<import(".
16
16
  }>;
17
17
  index: number;
18
18
  enabledIndex: number;
19
- register: (instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
19
+ register: (instance: HTMLButtonElement | null) => void;
20
20
  };
21
21
  type TabsProviderProps = ReturnType<typeof useTabs> & Pick<TabsProps, "selectionFollowsFocus" | "loop" | "size" | "iconPosition" | "fill">;
22
22
  export declare const TabsProvider: import("react").ForwardRefExoticComponent<{
@@ -9,7 +9,7 @@ export interface UseTabProps {
9
9
  value: string;
10
10
  }
11
11
  export declare function useTab<P extends UseTabProps>({ value, disabled, onFocus: _onFocus, onClick }: P, ref: React.ForwardedRef<HTMLButtonElement>): {
12
- ref: (instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
12
+ ref: (instance: HTMLButtonElement | null) => void;
13
13
  isSelected: boolean;
14
14
  isFocused: boolean;
15
15
  id: string;
@@ -1,4 +1,4 @@
1
- export declare function useScrollButtons(listRef: React.RefObject<HTMLDivElement>): {
1
+ export declare function useScrollButtons(listRef: React.RefObject<HTMLDivElement | null>): {
2
2
  update: {
3
3
  (this: any): void;
4
4
  clear(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollButtons.js","sourceRoot":"","sources":["../../../../src/tab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22
  enabledIndex: number;
23
- register: (instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
23
+ register: (instance: HTMLButtonElement | null) => void;
24
24
  };
25
25
  type ToggleGroupProviderProps = ReturnType<typeof useToggleGroup> & Pick<ToggleGroupProps, "size">;
26
26
  export declare const ToggleGroupProvider: import("react").ForwardRefExoticComponent<{
@@ -10,7 +10,7 @@ export interface UseToggleItemProps {
10
10
  value: string;
11
11
  }
12
12
  export declare function useToggleItem<P extends UseToggleItemProps>({ value, disabled, onFocus: _onFocus, onClick, onKeyDown: _onKeyDown, }: P, ref: React.ForwardedRef<HTMLButtonElement>): {
13
- ref: (instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
13
+ ref: (instance: HTMLButtonElement | null) => void;
14
14
  isSelected: boolean;
15
15
  isFocused: boolean;
16
16
  onClick: (event: import("react").MouseEvent<Element, MouseEvent>) => void;
@@ -10,5 +10,5 @@ export declare function createDescendantContext<T extends HTMLElement = HTMLElem
10
10
  descendants: DescendantsManager<T, K>;
11
11
  index: number;
12
12
  enabledIndex: number;
13
- register: (instance: T | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
13
+ register: (instance: T | null) => void;
14
14
  }];
@@ -1,15 +1,15 @@
1
1
  import React from "react";
2
- type PossibleRef<T> = React.LegacyRef<T> | undefined;
2
+ type PossibleRef<T> = React.Ref<T> | undefined;
3
3
  /**
4
4
  * Use `useMergeRefs`
5
5
  * @internal
6
6
  */
7
- export declare function mergeRefs<T>(refs: PossibleRef<T>[]): React.RefCallback<T>;
7
+ export declare function mergeRefs<T>(refs: PossibleRef<T>[]): (instance: T | null) => void;
8
8
  /**
9
9
  * Merges refs within useCallback
10
10
  * @internal
11
11
  * @param ...refs: React.Ref<T> | undefined
12
12
  * @returns React.useCallback(mergeRefs(refs), refs)
13
13
  */
14
- export declare function useMergeRefs<T>(...refs: PossibleRef<T>[]): (instance: T | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
14
+ export declare function useMergeRefs<T>(...refs: PossibleRef<T>[]): (instance: T | null) => void;
15
15
  export {};
@@ -6,13 +6,13 @@ import React from "react";
6
6
  * @internal
7
7
  */
8
8
  export function mergeRefs(refs) {
9
- return (value) => {
9
+ return (instance) => {
10
10
  refs.forEach((ref) => {
11
11
  if (typeof ref === "function") {
12
- ref(value);
12
+ ref(instance);
13
13
  }
14
14
  else if (ref !== null && ref !== undefined) {
15
- ref.current = value;
15
+ ref.current = instance;
16
16
  }
17
17
  });
18
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useMergeRefs.js","sourceRoot":"","sources":["../../../src/util/hooks/useMergeRefs.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,gDAAgD;AAChD;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAI,IAAsB;IACjD,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;gBAC9B,GAAG,CAAC,KAAK,CAAC,CAAC;YACb,CAAC;iBAAM,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBAC5C,GAAwC,CAAC,OAAO,GAAG,KAAK,CAAC;YAC5D,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAI,GAAG,IAAsB;IACvD,uDAAuD;IACvD,OAAO,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"useMergeRefs.js","sourceRoot":"","sources":["../../../src/util/hooks/useMergeRefs.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,gDAAgD;AAChD;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAI,IAAsB;IACjD,OAAO,CAAC,QAAkB,EAAE,EAAE;QAC5B,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;gBAC9B,GAAG,CAAC,QAAQ,CAAC,CAAC;YAChB,CAAC;iBAAM,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBAC5C,GAAwC,CAAC,OAAO,GAAG,QAAQ,CAAC;YAC/D,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAI,GAAG,IAAsB;IACvD,uDAAuD;IACvD,OAAO,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;AAClD,CAAC"}
@@ -1,5 +1,5 @@
1
- import { StoryObj } from "@storybook/react";
1
+ import { StoryObj } from "@storybook/react-vite";
2
2
  import React from "react";
3
3
  export declare function renderStoriesForChromatic(stories: Record<string, {
4
4
  render?: (...args: any[]) => React.ReactNode;
5
- } | React.FunctionComponent<void>>): StoryObj;
5
+ } | React.FunctionComponent>): StoryObj;
@@ -1,11 +1,11 @@
1
1
  import React from "react";
2
2
  export function renderStoriesForChromatic(stories) {
3
3
  return {
4
- render: (...args) => (React.createElement(React.Fragment, null, Object.entries(stories).map(([storyName, story]) => {
4
+ render: (...args) => (React.createElement(React.Fragment, null, Object.entries(stories).map(([storyName, Story]) => {
5
5
  var _a;
6
6
  return (React.createElement("div", { key: storyName },
7
7
  React.createElement("h2", { className: "storyheading" }, storyName),
8
- typeof story === "function" ? story() : (_a = story.render) === null || _a === void 0 ? void 0 : _a.call(story, ...args)));
8
+ typeof Story === "function" ? React.createElement(Story, null) : (_a = Story.render) === null || _a === void 0 ? void 0 : _a.call(Story, ...args)));
9
9
  }))),
10
10
  parameters: {
11
11
  chromatic: { disable: false },
@@ -1 +1 @@
1
- {"version":3,"file":"renderStoriesForChromatic.js","sourceRoot":"","sources":["../../src/util/renderStoriesForChromatic.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,UAAU,yBAAyB,CACvC,OAIC;IAED,OAAO;QACL,MAAM,EAAE,CAAC,GAAG,IAA0C,EAAE,EAAE,CAAC,CACzD,0CACG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE;;YAAC,OAAA,CACnD,6BAAK,GAAG,EAAE,SAAS;gBACjB,4BAAI,SAAS,EAAC,cAAc,IAAE,SAAS,CAAM;gBAC5C,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,MAAA,KAAK,CAAC,MAAM,sDAAG,GAAG,IAAI,CAAC,CAC5D,CACP,CAAA;SAAA,CAAC,CACD,CACJ;QACD,UAAU,EAAE;YACV,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;SAC9B;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"renderStoriesForChromatic.js","sourceRoot":"","sources":["../../src/util/renderStoriesForChromatic.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,UAAU,yBAAyB,CACvC,OAGC;IAED,OAAO;QACL,MAAM,EAAE,CAAC,GAAG,IAA0C,EAAE,EAAE,CAAC,CACzD,0CACG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE;;YAAC,OAAA,CACnD,6BAAK,GAAG,EAAE,SAAS;gBACjB,4BAAI,SAAS,EAAC,cAAc,IAAE,SAAS,CAAM;gBAC5C,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,oBAAC,KAAK,OAAG,CAAC,CAAC,CAAC,MAAA,KAAK,CAAC,MAAM,sDAAG,GAAG,IAAI,CAAC,CAC9D,CACP,CAAA;SAAA,CAAC,CACD,CACJ;QACD,UAAU,EAAE;YACV,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;SAC9B;KACF,CAAC;AACJ,CAAC"}
@@ -21,7 +21,7 @@ export declare const VirtualFocusDescendantsProvider: import("react").Provider<i
21
21
  }>;
22
22
  index: number;
23
23
  enabledIndex: number;
24
- register: (instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
24
+ register: (instance: HTMLDivElement | null) => void;
25
25
  };
26
26
  export declare const VirtualFocusInternalContextProvider: import("react").ForwardRefExoticComponent<{
27
27
  virtualFocusIdx: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/ds-react",
3
- "version": "7.31.0",
3
+ "version": "7.32.0",
4
4
  "description": "React components from the Norwegian Labour and Welfare Administration.",
5
5
  "author": "Aksel, a team part of the Norwegian Labour and Welfare Administration.",
6
6
  "license": "MIT",
@@ -650,8 +650,8 @@
650
650
  "dependencies": {
651
651
  "@floating-ui/react": "0.27.8",
652
652
  "@floating-ui/react-dom": "^2.0.9",
653
- "@navikt/aksel-icons": "^7.31.0",
654
- "@navikt/ds-tokens": "^7.31.0",
653
+ "@navikt/aksel-icons": "^7.32.0",
654
+ "@navikt/ds-tokens": "^7.32.0",
655
655
  "clsx": "^2.1.0",
656
656
  "date-fns": "^4.0.0",
657
657
  "react-day-picker": "9.7.0"
@@ -673,7 +673,7 @@
673
673
  "rimraf": "6.0.1",
674
674
  "swr": "^2.3.6",
675
675
  "tsc-alias": "1.8.16",
676
- "tsx": "^4.19.1",
676
+ "tsx": "^4.20.6",
677
677
  "typescript": "5.8.3",
678
678
  "vitest": "^2.1.9"
679
679
  },
package/src/chat/Chat.tsx CHANGED
@@ -2,7 +2,7 @@ import React, { HTMLAttributes, forwardRef } from "react";
2
2
  import { useRenameCSS } from "../theme/Theme";
3
3
  import { AkselColor } from "../types";
4
4
  import { BodyLong, HeadingProps } from "../typography";
5
- import Bubble from "./Bubble";
5
+ import Bubble, { type ChatBubbleProps } from "./Bubble";
6
6
 
7
7
  export const VARIANTS = ["subtle", "info", "neutral"] as const;
8
8
  export const POSITIONS = ["left", "right"] as const;
@@ -60,7 +60,7 @@ interface ChatComponent
60
60
  ChatProps & React.RefAttributes<HTMLDivElement>
61
61
  > {
62
62
  /**
63
- * @see 🏷️ {@link BubbleProps}
63
+ * @see 🏷️ {@link ChatBubbleProps}
64
64
  */
65
65
  Bubble: typeof Bubble;
66
66
  }
@@ -128,7 +128,7 @@ export const Chat = forwardRef<HTMLDivElement, ChatProps>(
128
128
  className={cn("navds-chat__bubble-wrapper")}
129
129
  >
130
130
  {React.Children.map(children, (child, i) => {
131
- if (!React.isValidElement(child)) {
131
+ if (!React.isValidElement<ChatBubbleProps>(child)) {
132
132
  return null;
133
133
  }
134
134
 
@@ -94,7 +94,7 @@ export const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>(
94
94
  ref,
95
95
  ) => {
96
96
  const [active, setActive] = useState(false);
97
- const timeoutRef = useRef<number>();
97
+ const timeoutRef = useRef<number>(undefined);
98
98
  const translate = useI18n("CopyButton");
99
99
 
100
100
  const { cn } = useRenameCSS();
@@ -8,14 +8,14 @@ interface InputContextValue extends FormFieldType {
8
8
  clearInput: NonNullable<ComboboxProps["onClear"]>;
9
9
  error?: ComboboxProps["error"];
10
10
  focusInput: () => void;
11
- inputRef: React.RefObject<HTMLInputElement>;
11
+ inputRef: React.RefObject<HTMLInputElement | null>;
12
12
  value: string;
13
13
  setValue: (text: string) => void;
14
14
  onChange: (newValue: string) => void;
15
15
  searchTerm: string;
16
16
  setSearchTerm: React.Dispatch<React.SetStateAction<string>>;
17
17
  shouldAutocomplete?: boolean;
18
- toggleOpenButtonRef: React.RefObject<HTMLDivElement>;
18
+ toggleOpenButtonRef: React.MutableRefObject<HTMLDivElement | null>;
19
19
  hideCaret: boolean;
20
20
  setHideCaret: React.Dispatch<React.SetStateAction<boolean>>;
21
21
  }
@@ -116,7 +116,7 @@ export function containsReadMore(
116
116
  children: React.ReactNode,
117
117
  checkNested = true,
118
118
  ): boolean {
119
- if (React.isValidElement(children)) {
119
+ if (React.isValidElement<{ children?: any }>(children)) {
120
120
  if (children.type === ReadMore) {
121
121
  return true;
122
122
  }
@@ -16,7 +16,7 @@ export const coordsAreInside = (
16
16
  };
17
17
 
18
18
  export function getCloseHandler(
19
- modalRef: React.RefObject<HTMLDialogElement>,
19
+ modalRef: React.RefObject<HTMLDialogElement | null>,
20
20
  header: ModalProps["header"],
21
21
  onBeforeClose: ModalProps["onBeforeClose"],
22
22
  ) {
@@ -31,7 +31,7 @@ export const BODY_CLASS_LEGACY = "navds-modal__document-body";
31
31
  export const BODY_CLASS = "aksel-modal__document-body";
32
32
 
33
33
  export function useBodyScrollLock(
34
- modalRef: React.RefObject<HTMLDialogElement>,
34
+ modalRef: React.RefObject<HTMLDialogElement | null>,
35
35
  portalNode: HTMLElement | null,
36
36
  isNested: boolean,
37
37
  ) {
@@ -16,7 +16,7 @@ import { Menu, MenuPortalProps } from "../floating-menu/Menu";
16
16
  /* -------------------------------------------------------------------------- */
17
17
  type ActionMenuContextValue = {
18
18
  triggerId: string;
19
- triggerRef: React.RefObject<HTMLButtonElement>;
19
+ triggerRef: React.RefObject<HTMLButtonElement | null>;
20
20
  contentId: string;
21
21
  open: boolean;
22
22
  onOpenChange: (open: boolean) => void;
@@ -27,7 +27,7 @@ import {
27
27
  useMergeRefs,
28
28
  } from "../../util/hooks";
29
29
  import { AsChildProps } from "../../util/types";
30
- import { useOpenChangeComplete } from "../overlay/hooks/useOpenChangeComplete";
30
+ import { useOpenChangeAnimationComplete } from "../overlay/hooks/useOpenChangeAnimationComplete";
31
31
  import {
32
32
  type Align,
33
33
  type Measurable,
@@ -363,7 +363,7 @@ const FloatingContent = forwardRef<HTMLDivElement, FloatingContentProps>(
363
363
  }
364
364
  }, [autoUpdateWhileMounted, enabled, floatingElements, update]);
365
365
 
366
- useOpenChangeComplete({
366
+ useOpenChangeAnimationComplete({
367
367
  enabled: !!modalContext?.ref,
368
368
  open: enabled,
369
369
  ref: modalContext?.ref,
@@ -5,7 +5,7 @@ import { useAnimationsFinished } from "./useAnimationsFinished";
5
5
  import { useEventCallback } from "./useEventCallback";
6
6
  import { useLatestRef } from "./useLatestRef";
7
7
 
8
- interface useOpenChangeCompleteParameters {
8
+ interface useOpenChangeAnimationCompleteParameters {
9
9
  /**
10
10
  * Enable / disable the effect. Disabled => no animation tracking / callback.
11
11
  * @default true
@@ -34,8 +34,8 @@ interface useOpenChangeCompleteParameters {
34
34
  * comparing the `open` value captured at scheduling time with the latest `open` via ref;
35
35
  * if they differ (state flipped again mid‑animation) the callback is skipped.
36
36
  */
37
- export function useOpenChangeComplete(
38
- parameters: useOpenChangeCompleteParameters,
37
+ export function useOpenChangeAnimationComplete(
38
+ parameters: useOpenChangeAnimationCompleteParameters,
39
39
  ) {
40
40
  const {
41
41
  enabled = true,
@@ -0,0 +1,145 @@
1
+ "use client";
2
+
3
+ import { useMemo, useState } from "react";
4
+ import ReactDOM from "react-dom";
5
+ import { useClientLayoutEffect } from "../../../util";
6
+
7
+ type TransitionStatus = "entering" | "exiting" | "idle" | undefined;
8
+
9
+ /**
10
+ * Transition status state machine for components that animate between an
11
+ * `open` boolean and actual mount/unmount. Keeps the element mounted while
12
+ * exit animations run and introduces an optional stable `idle` phase.
13
+ *
14
+ * Adapted from MUI Base + Floating UI examples:
15
+ * - Source: https://github.com/mui/base-ui/blob/6fd69008d83561dbe75ff89acf270f0fac3e0049/packages/react/src/utils/useTransitionStatus.ts
16
+ * - Originally based on https://github.com/floating-ui/floating-ui/blob/7c33a3d0198a9b523d54ae2c37cedb315a309452/packages/react/src/hooks/useTransition.ts
17
+ *
18
+ * States (transitionStatus):
19
+ * - "entering" : just entered (initial frame of enter) OR re-entering to reach "idle".
20
+ * - "idle" : stable open (only when `enableIdleState === true`).
21
+ * - "exiting" : exit animation is running; element still mounted.
22
+ * - undefined : closed (unmounted) OR stable open when idle state is disabled.
23
+ * When `enableIdleState` is false we clear the label after
24
+ * the first frame so styling can rely purely on `mounted`.
25
+ *
26
+ * Distinction:
27
+ * - `mounted` tells you whether to render DOM.
28
+ * - `transitionStatus` tells you which phase-specific classes to apply.
29
+ *
30
+ * Frame separation: state changes that must trigger CSS transitions are
31
+ * scheduled with `requestAnimationFrame` so the browser sees distinct style
32
+ * mutations across frames (avoids missed transitions due to batching).
33
+ *
34
+ * @param open Controls visibility lifecycle.
35
+ * @param enableIdleState Insert a persistent "idle" phase after entering.
36
+ * @param deferExitingState Delay entering the exit phase by one frame to allow
37
+ * measurement / layout work before applying exit styles.
38
+ */
39
+ function useTransitionStatus(
40
+ open: boolean,
41
+ enableIdleState: boolean = false,
42
+ deferExitingState: boolean = false,
43
+ ) {
44
+ const [mounted, setMounted] = useState(open);
45
+ const [transitionStatus, setTransitionStatus] = useState<TransitionStatus>(
46
+ open && enableIdleState ? "idle" : undefined,
47
+ );
48
+
49
+ /* Opening: mount immediately and label as "entering" for the first frame. */
50
+ if (open && !mounted) {
51
+ setMounted(true);
52
+ setTransitionStatus("entering");
53
+ }
54
+
55
+ /* Closing (no defer): begin exit animation right away. */
56
+ if (
57
+ !open &&
58
+ mounted &&
59
+ transitionStatus !== "exiting" &&
60
+ !deferExitingState
61
+ ) {
62
+ setTransitionStatus("exiting");
63
+ }
64
+
65
+ /* Cleanup: after unmount post-exit ensure status returns to undefined. */
66
+ if (!open && !mounted && transitionStatus === "exiting") {
67
+ setTransitionStatus(undefined);
68
+ }
69
+
70
+ /* Deferred closing: provide one frame to measure / flush layout before exit styles. */
71
+ useClientLayoutEffect(() => {
72
+ if (
73
+ !open &&
74
+ mounted &&
75
+ transitionStatus !== "exiting" &&
76
+ deferExitingState
77
+ ) {
78
+ const frame = requestAnimationFrame(() => {
79
+ setTransitionStatus("exiting");
80
+ });
81
+
82
+ return () => {
83
+ cancelAnimationFrame(frame);
84
+ };
85
+ }
86
+
87
+ return undefined;
88
+ }, [open, mounted, transitionStatus, deferExitingState]);
89
+
90
+ /* Enter (no idle): hold "entering" for one frame, then clear label (stable open). */
91
+ useClientLayoutEffect(() => {
92
+ if (!open || enableIdleState) {
93
+ return undefined;
94
+ }
95
+
96
+ const frame = requestAnimationFrame(() => {
97
+ ReactDOM.flushSync(() => {
98
+ setTransitionStatus(undefined);
99
+ });
100
+ });
101
+
102
+ return () => {
103
+ cancelAnimationFrame(frame);
104
+ };
105
+ }, [enableIdleState, open]);
106
+
107
+ useClientLayoutEffect(() => {
108
+ if (!open || !enableIdleState) {
109
+ return undefined;
110
+ }
111
+
112
+ /*
113
+ * We can enter this state by re-opening before exiting-state was finished
114
+ * (open → close → open in quick succession).
115
+ */
116
+ if (open && mounted && transitionStatus !== "idle") {
117
+ setTransitionStatus("entering");
118
+ }
119
+
120
+ /**
121
+ * Next frame, after "entering", switch to persistent "idle" state.
122
+ * By delaying to the next frame we ensure any "entering" styles are
123
+ * applied and the transition can run.
124
+ */
125
+ const frame = requestAnimationFrame(() => {
126
+ setTransitionStatus("idle");
127
+ });
128
+
129
+ return () => {
130
+ cancelAnimationFrame(frame);
131
+ };
132
+ }, [enableIdleState, open, mounted, setTransitionStatus, transitionStatus]);
133
+
134
+ return useMemo(
135
+ () => ({
136
+ mounted,
137
+ setMounted,
138
+ transitionStatus,
139
+ }),
140
+ [mounted, transitionStatus],
141
+ );
142
+ }
143
+
144
+ export { useTransitionStatus };
145
+ export type { TransitionStatus };
@@ -95,7 +95,7 @@ export const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(
95
95
  ) => {
96
96
  const { cn } = useRenameCSS();
97
97
  const translateX = 100 - (Math.round(value) / valueMax) * 100;
98
- const onTimeoutRef = useRef<() => void>();
98
+ const onTimeoutRef = useRef<() => void>(undefined);
99
99
  onTimeoutRef.current = simulated?.onTimeout;
100
100
  const translate = useI18n("ProgressBar");
101
101
 
@@ -26,11 +26,11 @@ export interface ReadMoreProps
26
26
  */
27
27
  defaultOpen?: boolean;
28
28
  /**
29
- * Callback for current open-state
29
+ * Callback for current open-state.
30
30
  */
31
31
  onOpenChange?: (open: boolean) => void;
32
32
  /**
33
- * Changes fontsize for content.
33
+ * Changes font size for content.
34
34
  * @default "medium"
35
35
  */
36
36
  size?: "large" | "medium" | "small";
@@ -42,14 +42,7 @@ export interface ReadMoreProps
42
42
  * @see 🏷️ {@link ReadMoreProps}
43
43
  *
44
44
  * @example
45
- * // Default
46
45
  * <ReadMore header="Dette regnes som helsemessige begrensninger">
47
- * Med helsemessige begrensninger mener vi funksjonshemming, sykdom...
48
- * </ReadMore>
49
- *
50
- * @example
51
- * // Litt mindre versjon
52
- * <ReadMore size="small" header="Dette regnes som helsemessige begrensninger">
53
46
  * Med helsemessige begrensninger mener vi funksjonshemming, sykdom...
54
47
  * </ReadMore>
55
48
  */
@@ -65,7 +58,7 @@ export const ReadMore = forwardRef<HTMLButtonElement, ReadMoreProps>(
65
58
  size = "medium",
66
59
  onOpenChange,
67
60
  ...rest
68
- },
61
+ }: ReadMoreProps,
69
62
  ref,
70
63
  ) => {
71
64
  const { cn } = useRenameCSS();
@@ -107,7 +100,7 @@ export const ReadMore = forwardRef<HTMLButtonElement, ReadMoreProps>(
107
100
 
108
101
  <BodyLong
109
102
  as="div"
110
- aria-hidden={!_open}
103
+ tabIndex={0}
111
104
  className={cn("navds-read-more__content", {
112
105
  "navds-read-more__content--closed": !_open,
113
106
  })}
@@ -73,8 +73,8 @@ const AnimateHeight: React.FC<AnimateHeightProps> = ({
73
73
  const prevHeight = useRef<Height>(height);
74
74
  const contentElement = useRef<HTMLDivElement>(null);
75
75
 
76
- const animationClassesTimeoutID = useRef<Timeout>();
77
- const timeoutID = useRef<Timeout>();
76
+ const animationClassesTimeoutID = useRef<Timeout>(undefined);
77
+ const timeoutID = useRef<Timeout>(undefined);
78
78
 
79
79
  const initialHeight = useRef<Height>(height);
80
80
  const initialOverflow = useRef<Overflow>("visible");
@@ -1,7 +1,9 @@
1
1
  import { useEffect, useMemo, useState } from "react";
2
2
  import { debounce } from "../../../util";
3
3
 
4
- export function useScrollButtons(listRef: React.RefObject<HTMLDivElement>) {
4
+ export function useScrollButtons(
5
+ listRef: React.RefObject<HTMLDivElement | null>,
6
+ ) {
5
7
  const [displayScroll, setDisplayScroll] = useState({
6
8
  start: false,
7
9
  end: false,
@@ -1,20 +1,20 @@
1
1
  /* https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/composeRefs.tsx */
2
2
  import React from "react";
3
3
 
4
- type PossibleRef<T> = React.LegacyRef<T> | undefined;
4
+ type PossibleRef<T> = React.Ref<T> | undefined;
5
5
 
6
6
  // https://github.com/gregberge/react-merge-refs
7
7
  /**
8
8
  * Use `useMergeRefs`
9
9
  * @internal
10
10
  */
11
- export function mergeRefs<T>(refs: PossibleRef<T>[]): React.RefCallback<T> {
12
- return (value) => {
11
+ export function mergeRefs<T>(refs: PossibleRef<T>[]) {
12
+ return (instance: T | null) => {
13
13
  refs.forEach((ref) => {
14
14
  if (typeof ref === "function") {
15
- ref(value);
15
+ ref(instance);
16
16
  } else if (ref !== null && ref !== undefined) {
17
- (ref as React.MutableRefObject<T | null>).current = value;
17
+ (ref as React.MutableRefObject<T | null>).current = instance;
18
18
  }
19
19
  });
20
20
  };
@@ -14,7 +14,7 @@ import { useMergeRefs } from "../hooks/useMergeRefs";
14
14
  import { AsChildProps } from "../types";
15
15
 
16
16
  type LinkAnchorOverlayContextProps = {
17
- anchorRef: React.RefObject<HTMLAnchorElement>;
17
+ anchorRef: React.RefObject<HTMLAnchorElement | null>;
18
18
  };
19
19
 
20
20
  const [LinkAnchorContextProvider, useLinkAnchorContext] =
@@ -1,21 +1,20 @@
1
- import { Args, StoryObj } from "@storybook/react";
1
+ import { Args, StoryObj } from "@storybook/react-vite";
2
2
  import React from "react";
3
3
  import { Renderer, StoryContext } from "storybook/internal/types";
4
4
 
5
5
  export function renderStoriesForChromatic(
6
6
  stories: Record<
7
7
  string,
8
- | { render?: (...args: any[]) => React.ReactNode }
9
- | React.FunctionComponent<void>
8
+ { render?: (...args: any[]) => React.ReactNode } | React.FunctionComponent
10
9
  >,
11
10
  ): StoryObj {
12
11
  return {
13
12
  render: (...args: [Args, StoryContext<Renderer, Args>]) => (
14
13
  <>
15
- {Object.entries(stories).map(([storyName, story]) => (
14
+ {Object.entries(stories).map(([storyName, Story]) => (
16
15
  <div key={storyName}>
17
16
  <h2 className="storyheading">{storyName}</h2>
18
- {typeof story === "function" ? story() : story.render?.(...args)}
17
+ {typeof Story === "function" ? <Story /> : Story.render?.(...args)}
19
18
  </div>
20
19
  ))}
21
20
  </>
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOpenChangeComplete.js","sourceRoot":"","sources":["../../../../src/overlays/overlay/hooks/useOpenChangeComplete.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAoCb,sDA6BC;AA/DD,iCAAyC;AACzC,mEAAgE;AAChE,yDAAsD;AACtD,iDAA8C;AAyB9C;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,UAA2C;IAE3C,MAAM,EACJ,OAAO,GAAG,IAAI,EACd,IAAI,EACJ,GAAG,GAAG,IAAI,EACV,UAAU,EAAE,eAAe,GAC5B,GAAG,UAAU,CAAC;IAEf,MAAM,OAAO,GAAG,IAAA,2BAAY,EAAC,IAAI,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,IAAA,mCAAgB,EAAC,eAAe,CAAC,CAAC;IACrD,MAAM,uBAAuB,GAAG,IAAA,6CAAqB,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEjE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QAED;;;WAGG;QACH,uBAAuB,CAAC,GAAG,EAAE;YAC3B,IAAI,IAAI,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC7B,UAAU,EAAE,CAAC;YACf,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,uBAAuB,EAAE,OAAO,CAAC,CAAC,CAAC;AACpE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOpenChangeComplete.js","sourceRoot":"","sources":["../../../../src/overlays/overlay/hooks/useOpenChangeComplete.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAyB9C;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAA2C;IAE3C,MAAM,EACJ,OAAO,GAAG,IAAI,EACd,IAAI,EACJ,GAAG,GAAG,IAAI,EACV,UAAU,EAAE,eAAe,GAC5B,GAAG,UAAU,CAAC;IAEf,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACrD,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEjE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QAED;;;WAGG;QACH,uBAAuB,CAAC,GAAG,EAAE;YAC3B,IAAI,IAAI,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC7B,UAAU,EAAE,CAAC;YACf,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,uBAAuB,EAAE,OAAO,CAAC,CAAC,CAAC;AACpE,CAAC"}