@navikt/ds-react 5.10.1 → 5.10.2

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.
@@ -1,7 +1,24 @@
1
1
  import React from "react";
2
+ /**
3
+ * This interface represents a component that can be overridden with different props and elements.
4
+ * @template Component The type of the props for the component.
5
+ * @template Element The type of the HTML element that the component renders.
6
+ */
2
7
  export interface OverridableComponent<Component, Element extends HTMLElement> {
8
+ /**
9
+ * This is a function type that takes props and returns a React functional component.
10
+ * @param props The props for the component, which are a combination of the Component type and React.RefAttributes for the Element type.
11
+ * @returns A React functional component.
12
+ */
3
13
  (props: Component & React.RefAttributes<Element>): ReturnType<React.FC>;
14
+ /**
15
+ * This is a function type that takes props and returns a React functional component.
16
+ * It allows for the 'as' prop to override the type of element that the component renders.
17
+ * @template As The type of the element that the component should render as.
18
+ * @param props The props for the component, which are a combination of the Component type, the 'as' prop, and any other props that are not part of the Component type or the 'as' prop.
19
+ * @returns A React functional component.
20
+ */
4
21
  <As extends React.ElementType>(props: {
5
- as: As;
22
+ as?: As;
6
23
  } & Component & Omit<React.ComponentPropsWithRef<As>, keyof Component | "as">): ReturnType<React.FC>;
7
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/ds-react",
3
- "version": "5.10.1",
3
+ "version": "5.10.2",
4
4
  "description": "Aksel react-components for NAV designsystem",
5
5
  "author": "Aksel | NAV designsystem team",
6
6
  "license": "MIT",
@@ -38,8 +38,8 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@floating-ui/react": "0.25.4",
41
- "@navikt/aksel-icons": "^5.10.1",
42
- "@navikt/ds-tokens": "^5.10.1",
41
+ "@navikt/aksel-icons": "^5.10.2",
42
+ "@navikt/ds-tokens": "^5.10.2",
43
43
  "@radix-ui/react-tabs": "1.0.0",
44
44
  "@radix-ui/react-toggle-group": "1.0.0",
45
45
  "clsx": "^1.2.1",
@@ -1,8 +1,8 @@
1
- import React from "react";
2
1
  import type { Meta } from "@storybook/react";
2
+ import React from "react";
3
+ import { Box, HStack, VStack } from "../..";
3
4
  import { BodyLong } from "../../typography";
4
5
  import { Bleed } from "./Bleed";
5
- import { Box, HStack, VStack } from "../..";
6
6
 
7
7
  export default {
8
8
  title: "ds-react/Primitives/Bleed",
@@ -1,11 +1,28 @@
1
1
  import React from "react";
2
2
 
3
+ /**
4
+ * This interface represents a component that can be overridden with different props and elements.
5
+ * @template Component The type of the props for the component.
6
+ * @template Element The type of the HTML element that the component renders.
7
+ */
3
8
  export interface OverridableComponent<Component, Element extends HTMLElement> {
9
+ /**
10
+ * This is a function type that takes props and returns a React functional component.
11
+ * @param props The props for the component, which are a combination of the Component type and React.RefAttributes for the Element type.
12
+ * @returns A React functional component.
13
+ */
4
14
  (props: Component & React.RefAttributes<Element>): ReturnType<React.FC>;
5
15
 
16
+ /**
17
+ * This is a function type that takes props and returns a React functional component.
18
+ * It allows for the 'as' prop to override the type of element that the component renders.
19
+ * @template As The type of the element that the component should render as.
20
+ * @param props The props for the component, which are a combination of the Component type, the 'as' prop, and any other props that are not part of the Component type or the 'as' prop.
21
+ * @returns A React functional component.
22
+ */
6
23
  <As extends React.ElementType>(
7
24
  props: {
8
- as: As;
25
+ as?: As;
9
26
  } & Component &
10
27
  Omit<React.ComponentPropsWithRef<As>, keyof Component | "as">
11
28
  ): ReturnType<React.FC>;