@navikt/ds-react 7.23.2 → 7.25.1

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 (80) hide show
  1. package/cjs/chat/Chat.js +4 -3
  2. package/cjs/chat/Chat.js.map +1 -1
  3. package/cjs/form/file-upload/parts/item/Item.d.ts +1 -1
  4. package/cjs/form/file-upload/parts/item/Item.js +10 -2
  5. package/cjs/form/file-upload/parts/item/Item.js.map +1 -1
  6. package/cjs/form/search/Search.js +5 -3
  7. package/cjs/form/search/Search.js.map +1 -1
  8. package/cjs/form/switch/Switch.js +23 -2
  9. package/cjs/form/switch/Switch.js.map +1 -1
  10. package/cjs/index.d.ts +1 -0
  11. package/cjs/index.js +3 -1
  12. package/cjs/index.js.map +1 -1
  13. package/cjs/link-card/LinkCard.d.ts +126 -0
  14. package/cjs/link-card/LinkCard.js +141 -0
  15. package/cjs/link-card/LinkCard.js.map +1 -0
  16. package/cjs/link-card/index.d.ts +2 -0
  17. package/cjs/link-card/index.js +13 -0
  18. package/cjs/link-card/index.js.map +1 -0
  19. package/cjs/link-panel/LinkPanel.d.ts +3 -11
  20. package/cjs/link-panel/LinkPanel.js +3 -11
  21. package/cjs/link-panel/LinkPanel.js.map +1 -1
  22. package/cjs/modal/ModalUtils.d.ts +2 -1
  23. package/cjs/modal/ModalUtils.js +21 -12
  24. package/cjs/modal/ModalUtils.js.map +1 -1
  25. package/cjs/table/Table.d.ts +5 -0
  26. package/cjs/table/Table.js +2 -1
  27. package/cjs/table/Table.js.map +1 -1
  28. package/cjs/util/link-anchor/LinkAnchor.d.ts +26 -0
  29. package/cjs/util/link-anchor/LinkAnchor.js +110 -0
  30. package/cjs/util/link-anchor/LinkAnchor.js.map +1 -0
  31. package/cjs/util/link-anchor/index.d.ts +2 -0
  32. package/cjs/util/link-anchor/index.js +9 -0
  33. package/cjs/util/link-anchor/index.js.map +1 -0
  34. package/esm/chat/Chat.js +4 -3
  35. package/esm/chat/Chat.js.map +1 -1
  36. package/esm/form/file-upload/parts/item/Item.d.ts +1 -1
  37. package/esm/form/file-upload/parts/item/Item.js +10 -2
  38. package/esm/form/file-upload/parts/item/Item.js.map +1 -1
  39. package/esm/form/search/Search.js +5 -3
  40. package/esm/form/search/Search.js.map +1 -1
  41. package/esm/form/switch/Switch.js +23 -2
  42. package/esm/form/switch/Switch.js.map +1 -1
  43. package/esm/index.d.ts +1 -0
  44. package/esm/index.js +1 -0
  45. package/esm/index.js.map +1 -1
  46. package/esm/link-card/LinkCard.d.ts +126 -0
  47. package/esm/link-card/LinkCard.js +105 -0
  48. package/esm/link-card/LinkCard.js.map +1 -0
  49. package/esm/link-card/index.d.ts +2 -0
  50. package/esm/link-card/index.js +3 -0
  51. package/esm/link-card/index.js.map +1 -0
  52. package/esm/link-panel/LinkPanel.d.ts +3 -11
  53. package/esm/link-panel/LinkPanel.js +3 -11
  54. package/esm/link-panel/LinkPanel.js.map +1 -1
  55. package/esm/modal/ModalUtils.d.ts +2 -1
  56. package/esm/modal/ModalUtils.js +20 -11
  57. package/esm/modal/ModalUtils.js.map +1 -1
  58. package/esm/table/Table.d.ts +5 -0
  59. package/esm/table/Table.js +2 -1
  60. package/esm/table/Table.js.map +1 -1
  61. package/esm/util/link-anchor/LinkAnchor.d.ts +26 -0
  62. package/esm/util/link-anchor/LinkAnchor.js +72 -0
  63. package/esm/util/link-anchor/LinkAnchor.js.map +1 -0
  64. package/esm/util/link-anchor/index.d.ts +2 -0
  65. package/esm/util/link-anchor/index.js +3 -0
  66. package/esm/util/link-anchor/index.js.map +1 -0
  67. package/package.json +13 -3
  68. package/src/chat/Chat.tsx +15 -13
  69. package/src/form/file-upload/parts/item/Item.tsx +20 -6
  70. package/src/form/search/Search.tsx +5 -1
  71. package/src/form/switch/Switch.tsx +79 -26
  72. package/src/index.ts +10 -0
  73. package/src/link-card/LinkCard.tsx +317 -0
  74. package/src/link-card/index.tsx +20 -0
  75. package/src/link-panel/LinkPanel.tsx +3 -11
  76. package/src/modal/Modal.test.tsx +12 -4
  77. package/src/modal/ModalUtils.ts +24 -7
  78. package/src/table/Table.tsx +7 -0
  79. package/src/util/link-anchor/LinkAnchor.tsx +153 -0
  80. package/src/util/link-anchor/index.tsx +7 -0
@@ -0,0 +1,126 @@
1
+ import React, { HTMLAttributes } from "react";
2
+ import { LinkAnchorProps } from "../util/link-anchor/index.js";
3
+ interface LinkCardProps extends HTMLAttributes<HTMLDivElement> {
4
+ /**
5
+ * @default true
6
+ */
7
+ arrow?: boolean;
8
+ /**
9
+ * Changes padding and typo sizes.
10
+ * @default "medium"
11
+ */
12
+ size?: "small" | "medium";
13
+ }
14
+ interface LinkCardComponent extends React.ForwardRefExoticComponent<LinkCardProps & React.RefAttributes<HTMLDivElement>> {
15
+ /**
16
+ * @see 🏷️ {@link LinkCardTitleProps}
17
+ */
18
+ Title: typeof LinkCardTitle;
19
+ /**
20
+ * @see 🏷️ {@link LinkCardAnchorProps}
21
+ */
22
+ Anchor: typeof LinkCardAnchor;
23
+ /**
24
+ * @see 🏷️ {@link LinkCardDescriptionProps}
25
+ */
26
+ Description: typeof LinkCardDescription;
27
+ /**
28
+ * @see 🏷️ {@link LinkCardFooterProps}
29
+ */
30
+ Footer: typeof LinkCardFooter;
31
+ /**
32
+ * @see 🏷️ {@link LinkCardIconProps}
33
+ */
34
+ Icon: typeof LinkCardIcon;
35
+ /**
36
+ * @see 🏷️ {@link LinkCardImageProps}
37
+ */
38
+ Image: typeof LinkCardImage;
39
+ }
40
+ /**
41
+ * Accessible clickable card as a link.
42
+ *
43
+ * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/linkcard)
44
+ * @see 🏷️ {@link LinkCardProps}
45
+ *
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * <LinkCard>
50
+ * <LinkCard.Icon>
51
+ * <IconOrPictogram />
52
+ * </LinkCard.Icon>
53
+ * <LinkCard.Title>
54
+ * <LinkCard.Anchor href="/href">
55
+ * LinkCard title
56
+ * </LinkCard.Anchor>
57
+ * </LinkCard.Title>
58
+ * <LinkCard.Description>
59
+ * This is a description of the link card.
60
+ * </LinkCard.Description>
61
+ * <LinkCard.Footer>Footer content</LinkCard.Footer>
62
+ * </LinkCard>
63
+ * ```
64
+ */
65
+ export declare const LinkCard: LinkCardComponent;
66
+ type LinkCardTitleProps = HTMLAttributes<HTMLHeadingElement> & {
67
+ children: React.ReactNode;
68
+ /**
69
+ * Heading tag. Use "span" if you want a non header defining card
70
+ * (eg. you have a lot of them all at once, such as in a grid)
71
+ * @default "span"
72
+ */
73
+ as?: "span" | "h2" | "h3" | "h4" | "h5" | "h6";
74
+ };
75
+ /**
76
+ * @see 🏷️ {@link LinkCardTitleProps}
77
+ */
78
+ export declare const LinkCardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & {
79
+ children: React.ReactNode;
80
+ /**
81
+ * Heading tag. Use "span" if you want a non header defining card
82
+ * (eg. you have a lot of them all at once, such as in a grid)
83
+ * @default "span"
84
+ */
85
+ as?: "span" | "h2" | "h3" | "h4" | "h5" | "h6";
86
+ } & React.RefAttributes<HTMLHeadingElement>>;
87
+ type LinkCardAnchorProps = LinkAnchorProps;
88
+ /**
89
+ * @see 🏷️ {@link LinkCardAnchorProps}
90
+ */
91
+ export declare const LinkCardAnchor: React.ForwardRefExoticComponent<LinkAnchorProps & React.RefAttributes<HTMLAnchorElement>>;
92
+ interface LinkCardDescriptionProps extends HTMLAttributes<HTMLDivElement> {
93
+ children: React.ReactNode;
94
+ }
95
+ /**
96
+ * @see 🏷️ {@link LinkCardDescriptionProps}
97
+ */
98
+ export declare const LinkCardDescription: React.ForwardRefExoticComponent<LinkCardDescriptionProps & React.RefAttributes<HTMLDivElement>>;
99
+ interface LinkCardFooterProps extends HTMLAttributes<HTMLDivElement> {
100
+ children: React.ReactNode;
101
+ }
102
+ /**
103
+ * @see 🏷️ {@link LinkCardFooterProps}
104
+ */
105
+ export declare const LinkCardFooter: React.ForwardRefExoticComponent<LinkCardFooterProps & React.RefAttributes<HTMLDivElement>>;
106
+ interface LinkCardIconProps extends HTMLAttributes<HTMLDivElement> {
107
+ children: React.ReactNode;
108
+ }
109
+ /**
110
+ * @see 🏷️ {@link LinkCardIconProps}
111
+ */
112
+ export declare const LinkCardIcon: React.ForwardRefExoticComponent<LinkCardIconProps & React.RefAttributes<HTMLDivElement>>;
113
+ type ImageAspectRatio = "1/1" | "16/9" | "16/10" | "4/3" | (string & {});
114
+ interface LinkCardImageProps extends HTMLAttributes<HTMLDivElement> {
115
+ children: React.ReactNode;
116
+ /**
117
+ * The aspect-ratio CSS property allows you to define the desired width-to-height ratio of an element's box.
118
+ * This means that even if the parent container or viewport size changes, the browser will adjust the element's dimensions to maintain the specified width-to-height ratio.
119
+ */
120
+ aspectRatio?: ImageAspectRatio;
121
+ }
122
+ /**
123
+ * @see 🏷️ {@link LinkCardImageProps}
124
+ */
125
+ export declare const LinkCardImage: React.ForwardRefExoticComponent<LinkCardImageProps & React.RefAttributes<HTMLDivElement>>;
126
+ export type { LinkCardAnchorProps, LinkCardDescriptionProps, LinkCardFooterProps, LinkCardIconProps, LinkCardImageProps, LinkCardProps, LinkCardTitleProps, };
@@ -0,0 +1,105 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React, { forwardRef } from "react";
13
+ import { useRenameCSS } from "../theme/Theme.js";
14
+ import { BodyLong, Heading } from "../typography/index.js";
15
+ import { createContext } from "../util/create-context.js";
16
+ import { LinkAnchor, LinkAnchorArrow, LinkAnchorOverlay, } from "../util/link-anchor/index.js";
17
+ const [LinkCardContextProvider, useLinkCardContext] = createContext({
18
+ name: "LinkCardContextProvider",
19
+ });
20
+ /**
21
+ * Accessible clickable card as a link.
22
+ *
23
+ * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/linkcard)
24
+ * @see 🏷️ {@link LinkCardProps}
25
+ *
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * <LinkCard>
30
+ * <LinkCard.Icon>
31
+ * <IconOrPictogram />
32
+ * </LinkCard.Icon>
33
+ * <LinkCard.Title>
34
+ * <LinkCard.Anchor href="/href">
35
+ * LinkCard title
36
+ * </LinkCard.Anchor>
37
+ * </LinkCard.Title>
38
+ * <LinkCard.Description>
39
+ * This is a description of the link card.
40
+ * </LinkCard.Description>
41
+ * <LinkCard.Footer>Footer content</LinkCard.Footer>
42
+ * </LinkCard>
43
+ * ```
44
+ */
45
+ export const LinkCard = forwardRef((_a, forwardedRef) => {
46
+ var { children, className, arrow = true, size = "medium" } = _a, restProps = __rest(_a, ["children", "className", "arrow", "size"]);
47
+ const { cn } = useRenameCSS();
48
+ return (React.createElement(LinkCardContextProvider, { size: size, arrow: arrow },
49
+ React.createElement(LinkAnchorOverlay, { asChild: true },
50
+ React.createElement(BodyLong, Object.assign({ as: "div", size: size, ref: forwardedRef, "data-color": "neutral", className: cn("navds-link-card", className, `navds-link-card--${size}`) }, restProps), children))));
51
+ });
52
+ /**
53
+ * @see 🏷️ {@link LinkCardTitleProps}
54
+ */
55
+ export const LinkCardTitle = forwardRef((_a, forwardedRef) => {
56
+ var { children, as = "span", className } = _a, restProps = __rest(_a, ["children", "as", "className"]);
57
+ const { cn } = useRenameCSS();
58
+ const context = useLinkCardContext();
59
+ return (React.createElement(Heading, Object.assign({ ref: forwardedRef, as: as, size: context.size === "medium" ? "small" : "xsmall", className: cn("navds-link-card__title", className) }, restProps),
60
+ children,
61
+ context.arrow && (React.createElement(LinkAnchorArrow, { fontSize: context.size === "medium" ? "1.75rem" : "1.5rem" }))));
62
+ });
63
+ /**
64
+ * @see 🏷️ {@link LinkCardAnchorProps}
65
+ */
66
+ export const LinkCardAnchor = LinkAnchor;
67
+ /**
68
+ * @see 🏷️ {@link LinkCardDescriptionProps}
69
+ */
70
+ export const LinkCardDescription = forwardRef((_a, forwardedRef) => {
71
+ var { children, className } = _a, restProps = __rest(_a, ["children", "className"]);
72
+ const { cn } = useRenameCSS();
73
+ return (React.createElement("div", Object.assign({ ref: forwardedRef, className: cn("navds-link-card__description", className) }, restProps), children));
74
+ });
75
+ /**
76
+ * @see 🏷️ {@link LinkCardFooterProps}
77
+ */
78
+ export const LinkCardFooter = forwardRef((_a, forwardedRef) => {
79
+ var { children, className } = _a, restProps = __rest(_a, ["children", "className"]);
80
+ const { cn } = useRenameCSS();
81
+ return (React.createElement("div", Object.assign({ ref: forwardedRef, className: cn("navds-link-card__footer", className) }, restProps), children));
82
+ });
83
+ /**
84
+ * @see 🏷️ {@link LinkCardIconProps}
85
+ */
86
+ export const LinkCardIcon = forwardRef((_a, forwardedRef) => {
87
+ var { children, className } = _a, restProps = __rest(_a, ["children", "className"]);
88
+ const { cn } = useRenameCSS();
89
+ return (React.createElement("div", Object.assign({ ref: forwardedRef, "aria-hidden": true, className: cn("navds-link-card__icon", className) }, restProps), children));
90
+ });
91
+ /**
92
+ * @see 🏷️ {@link LinkCardImageProps}
93
+ */
94
+ export const LinkCardImage = forwardRef((_a, forwardedRef) => {
95
+ var { children, className, aspectRatio, style } = _a, restProps = __rest(_a, ["children", "className", "aspectRatio", "style"]);
96
+ const { cn } = useRenameCSS();
97
+ return (React.createElement("div", Object.assign({ ref: forwardedRef, className: cn("navds-link-card__image-container", className), style: Object.assign(Object.assign({}, style), { aspectRatio }) }, restProps), children));
98
+ });
99
+ LinkCard.Title = LinkCardTitle;
100
+ LinkCard.Anchor = LinkCardAnchor;
101
+ LinkCard.Description = LinkCardDescription;
102
+ LinkCard.Footer = LinkCardFooter;
103
+ LinkCard.Icon = LinkCardIcon;
104
+ LinkCard.Image = LinkCardImage;
105
+ //# sourceMappingURL=LinkCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkCard.js","sourceRoot":"","sources":["../../src/link-card/LinkCard.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAkB,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACL,UAAU,EACV,eAAe,EACf,iBAAiB,GAElB,MAAM,qBAAqB,CAAC;AAoB7B,MAAM,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,GACjD,aAAa,CAAuB;IAClC,IAAI,EAAE,yBAAyB;CAChC,CAAC,CAAC;AAgCL;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,CACE,EAMgB,EAChB,YAAY,EACZ,EAAE;QARF,EACE,QAAQ,EACR,SAAS,EACT,KAAK,GAAG,IAAI,EACZ,IAAI,GAAG,QAAQ,OAED,EADX,SAAS,cALd,0CAMC,CADa;IAId,MAAM,EAAE,EAAE,EAAE,GAAG,YAAY,EAAE,CAAC;IAE9B,OAAO,CACL,oBAAC,uBAAuB,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK;QAC/C,oBAAC,iBAAiB,IAAC,OAAO;YACxB,oBAAC,QAAQ,kBACP,EAAE,EAAC,KAAK,EACR,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,YAAY,gBACN,SAAS,EACpB,SAAS,EAAE,EAAE,CACX,iBAAiB,EACjB,SAAS,EACT,oBAAoB,IAAI,EAAE,CAC3B,IACG,SAAS,GAEZ,QAAQ,CACA,CACO,CACI,CAC3B,CAAC;AACJ,CAAC,CACmB,CAAC;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;AAC/B,QAAQ,CAAC,MAAM,GAAG,cAAc,CAAC;AACjC,QAAQ,CAAC,WAAW,GAAG,mBAAmB,CAAC;AAC3C,QAAQ,CAAC,MAAM,GAAG,cAAc,CAAC;AACjC,QAAQ,CAAC,IAAI,GAAG,YAAY,CAAC;AAC7B,QAAQ,CAAC,KAAK,GAAG,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { LinkCard, LinkCardTitle, LinkCardDescription, LinkCardFooter, LinkCardAnchor, LinkCardIcon, LinkCardImage, } from "./LinkCard.js";
2
+ export type { LinkCardProps, LinkCardTitleProps, LinkCardDescriptionProps, LinkCardFooterProps, LinkCardAnchorProps, LinkCardIconProps, LinkCardImageProps, } from "./LinkCard.js";
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ export { LinkCard, LinkCardTitle, LinkCardDescription, LinkCardFooter, LinkCardAnchor, LinkCardIcon, LinkCardImage, } from "./LinkCard.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/link-card/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EACL,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,GACd,MAAM,YAAY,CAAC"}
@@ -25,21 +25,13 @@ interface LinkPanelComponentType extends OverridableComponent<LinkPanelProps, HT
25
25
  Description: React.ForwardRefExoticComponent<LinkPanelDescriptionProps & React.RefAttributes<HTMLDivElement>>;
26
26
  }
27
27
  /**
28
- * A component that displays a link panel.
28
+ * @deprecated Use `LinkCard` instead. Migrations should be straightforward as the API is similar.
29
+ * @see [📝 LinkCard documentation](https://aksel.nav.no/komponenter/core/linkcard)
29
30
  *
30
- * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/linkpanel)
31
+ * @see [📝 Documentation](https://aksel.nav.no/komponenter/legacy/linkpanel)
31
32
  * @see 🏷️ {@link LinkPanelProps}
32
33
  * @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
33
34
  *
34
- * @example
35
- * ```jsx
36
- * <LinkPanel href="#" border>
37
- * <LinkPanel.Title>Arbeidssøker eller permittert</LinkPanel.Title>
38
- * <LinkPanel.Description>
39
- * Om jobb, registrering, CV, dagpenger og feriepenger av dagpenger
40
- * </LinkPanel.Description>
41
- * </LinkPanel>
42
- * ```
43
35
  */
44
36
  export declare const LinkPanelComponent: OverridableComponent<LinkPanelProps, HTMLAnchorElement>;
45
37
  declare const LinkPanel: LinkPanelComponentType;
@@ -16,21 +16,13 @@ import { useRenameCSS } from "../theme/Theme.js";
16
16
  import { LinkPanelDescription, } from "./LinkPanelDescription.js";
17
17
  import { LinkPanelTitle } from "./LinkPanelTitle.js";
18
18
  /**
19
- * A component that displays a link panel.
19
+ * @deprecated Use `LinkCard` instead. Migrations should be straightforward as the API is similar.
20
+ * @see [📝 LinkCard documentation](https://aksel.nav.no/komponenter/core/linkcard)
20
21
  *
21
- * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/linkpanel)
22
+ * @see [📝 Documentation](https://aksel.nav.no/komponenter/legacy/linkpanel)
22
23
  * @see 🏷️ {@link LinkPanelProps}
23
24
  * @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
24
25
  *
25
- * @example
26
- * ```jsx
27
- * <LinkPanel href="#" border>
28
- * <LinkPanel.Title>Arbeidssøker eller permittert</LinkPanel.Title>
29
- * <LinkPanel.Description>
30
- * Om jobb, registrering, CV, dagpenger og feriepenger av dagpenger
31
- * </LinkPanel.Description>
32
- * </LinkPanel>
33
- * ```
34
26
  */
35
27
  export const LinkPanelComponent = forwardRef((_a, ref) => {
36
28
  var { children, as = "a", border = true, className } = _a, rest = __rest(_a, ["children", "as", "border", "className"]);
@@ -1 +1 @@
1
- {"version":3,"file":"LinkPanel.js","sourceRoot":"","sources":["../../src/link-panel/LinkPanel.tsx"],"names":[],"mappings":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OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EACL,oBAAoB,GAErB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AA8BvE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAG3B,UAAU,CACZ,CAAC,EAAyD,EAAE,GAAG,EAAE,EAAE;QAAlE,EAAE,QAAQ,EAAE,EAAE,GAAG,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,OAAW,EAAN,IAAI,cAAvD,yCAAyD,CAAF;IACtD,MAAM,EAAE,EAAE,EAAE,GAAG,YAAY,EAAE,CAAC;IAE9B,OAAO,CACL,oBAAC,KAAK,oBACA,IAAI,IACR,EAAE,EAAE,EAAE,EACN,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC;QAE5C,6BAAK,SAAS,EAAE,EAAE,CAAC,2BAA2B,CAAC,IAAG,QAAQ,CAAO;QACjE,oBAAC,gBAAgB,IACf,SAAS,EAAE,EAAE,CAAC,2BAA2B,CAAC,wBAE1C,CACI,CACT,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,SAAS,GAAG,kBAA4C,CAAC;AAE/D,SAAS,CAAC,KAAK,GAAG,cAAc,CAAC;AACjC,SAAS,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAE7C,eAAe,SAAS,CAAC"}
@@ -6,5 +6,6 @@ export interface MouseCoordinates {
6
6
  }
7
7
  export declare const coordsAreInside: ({ clientX, clientY }: MouseCoordinates, { left, top, right, bottom }: DOMRect) => boolean;
8
8
  export declare function getCloseHandler(modalRef: React.RefObject<HTMLDialogElement>, header: ModalProps["header"], onBeforeClose: ModalProps["onBeforeClose"]): (() => false | void | undefined) | undefined;
9
- export declare const BODY_CLASS = "navds-modal__document-body";
9
+ export declare const BODY_CLASS_LEGACY = "navds-modal__document-body";
10
+ export declare const BODY_CLASS = "aksel-modal__document-body";
10
11
  export declare function useBodyScrollLock(modalRef: React.RefObject<HTMLDialogElement>, portalNode: HTMLElement | null, isNested: boolean): void;
@@ -14,21 +14,29 @@ export function getCloseHandler(modalRef, header, onBeforeClose) {
14
14
  }
15
15
  return () => { var _a; return (_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.close(); };
16
16
  }
17
- export const BODY_CLASS = "navds-modal__document-body";
17
+ export const BODY_CLASS_LEGACY = "navds-modal__document-body";
18
+ export const BODY_CLASS = "aksel-modal__document-body";
18
19
  export function useBodyScrollLock(modalRef, portalNode, isNested) {
19
20
  React.useEffect(() => {
20
- if (isNested)
21
+ if (isNested) {
21
22
  return;
22
- if (!modalRef.current || !portalNode)
23
- return; // We check both to avoid running this twice when not using portal
24
- if (modalRef.current.open)
25
- document.body.classList.add(BODY_CLASS); // In case `open` is true initially
23
+ }
24
+ // We check both to avoid running this twice when not using portal
25
+ if (!modalRef.current || !portalNode) {
26
+ return;
27
+ }
28
+ // In case `open` is true initially
29
+ if (modalRef.current.open) {
30
+ document.body.classList.add(BODY_CLASS, BODY_CLASS_LEGACY);
31
+ }
26
32
  const observer = new MutationObserver(() => {
27
33
  var _a;
28
- if ((_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.open)
29
- document.body.classList.add(BODY_CLASS);
30
- else
31
- document.body.classList.remove(BODY_CLASS);
34
+ if ((_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.open) {
35
+ document.body.classList.add(BODY_CLASS, BODY_CLASS_LEGACY);
36
+ }
37
+ else {
38
+ document.body.classList.remove(BODY_CLASS, BODY_CLASS_LEGACY);
39
+ }
32
40
  });
33
41
  observer.observe(modalRef.current, {
34
42
  attributes: true,
@@ -36,7 +44,8 @@ export function useBodyScrollLock(modalRef, portalNode, isNested) {
36
44
  });
37
45
  return () => {
38
46
  observer.disconnect();
39
- document.body.classList.remove(BODY_CLASS); // In case modal is unmounted before it's closed
47
+ // In case modal is unmounted before it's closed
48
+ document.body.classList.remove(BODY_CLASS, BODY_CLASS_LEGACY);
40
49
  };
41
50
  }, [modalRef, portalNode, isNested]);
42
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ModalUtils.js","sourceRoot":"","sources":["../../src/modal/ModalUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,EAAE,OAAO,EAAE,OAAO,EAAoB,EACtC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAW,EACrC,EAAE;IACF,IAAI,OAAO,GAAG,IAAI,IAAI,OAAO,GAAG,GAAG;QAAE,OAAO,KAAK,CAAC;IAClD,IAAI,OAAO,GAAG,KAAK,IAAI,OAAO,GAAG,MAAM;QAAE,OAAO,KAAK,CAAC;IACtD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,UAAU,eAAe,CAC7B,QAA4C,EAC5C,MAA4B,EAC5B,aAA0C;IAE1C,IAAI,MAAM,IAAI,MAAM,CAAC,WAAW,KAAK,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7D,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,GAAG,EAAE,WAAC,OAAA,aAAa,EAAE,KAAK,KAAK,KAAI,MAAA,QAAQ,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAA,CAAA,EAAA,CAAC;IACtE,CAAC;IACD,OAAO,GAAG,EAAE,WAAC,OAAA,MAAA,QAAQ,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAA,EAAA,CAAC;AACzC,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,4BAA4B,CAAC;AAE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CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE;;YACzC,IAAI,MAAA,QAAQ,CAAC,OAAO,0CAAE,IAAI,EAAE,CAAC;gBAC3B,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;YAC7D,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;YAChE,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE;YACjC,UAAU,EAAE,IAAI;YAChB,eAAe,EAAE,CAAC,MAAM,CAAC;SAC1B,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,UAAU,EAAE,CAAC;YACtB,gDAAgD;YAChD,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AACvC,CAAC"}
@@ -18,6 +18,11 @@ export interface TableProps extends React.TableHTMLAttributes<HTMLTableElement>
18
18
  * @default false
19
19
  */
20
20
  zebraStripes?: boolean;
21
+ /**
22
+ * Makes the header sticky
23
+ * @default false
24
+ */
25
+ stickyHeader?: boolean;
21
26
  /**
22
27
  * Sort state
23
28
  */
@@ -52,11 +52,12 @@ import { TableContext } from "./context.js";
52
52
  * ```
53
53
  */
54
54
  export const Table = forwardRef((_a, ref) => {
55
- var { className, zebraStripes = false, size = "medium", onSortChange, sort } = _a, rest = __rest(_a, ["className", "zebraStripes", "size", "onSortChange", "sort"]);
55
+ var { className, zebraStripes = false, size = "medium", onSortChange, sort, stickyHeader = false } = _a, rest = __rest(_a, ["className", "zebraStripes", "size", "onSortChange", "sort", "stickyHeader"]);
56
56
  const { cn } = useRenameCSS();
57
57
  return (React.createElement(TableContext.Provider, { value: { onSortChange, sort } },
58
58
  React.createElement("table", Object.assign({}, rest, { ref: ref, className: cn("navds-table", `navds-table--${size}`, className, {
59
59
  "navds-table--zebra-stripes": zebraStripes,
60
+ "navds-table--sticky-header": stickyHeader,
60
61
  }) }))));
61
62
  });
62
63
  Table.Header = Header;
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/table/Table.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAsCzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAC7B,CACE,EAOC,EACD,GAAG,EACH,EAAE;QATF,EACE,SAAS,EACT,YAAY,GAAG,KAAK,EACpB,IAAI,GAAG,QAAQ,EACf,YAAY,EACZ,IAAI,OAEL,EADI,IAAI,cANT,6DAOC,CADQ;IAIT,MAAM,EAAE,EAAE,EAAE,GAAG,YAAY,EAAE,CAAC;IAC9B,OAAO,CACL,oBAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;QAClD,+CACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EA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OAErB,EADI,IAAI,cAPT,6EAQC,CADQ;IAIT,MAAM,EAAE,EAAE,EAAE,GAAG,YAAY,EAAE,CAAC;IAC9B,OAAO,CACL,oBAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;QAClD,+CACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,gBAAgB,IAAI,EAAE,EAAE,SAAS,EAAE;gBAC9D,4BAA4B,EAAE,YAAY;gBAC1C,4BAA4B,EAAE,YAAY;aAC3C,CAAC,IACF,CACoB,CACzB,CAAC;AACJ,CAAC,CACW,CAAC;AAEf,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;AACtB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;AAClB,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;AAChB,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;AAClC,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;AAC9B,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC1B,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC;AAEpC,eAAe,KAAK,CAAC"}
@@ -0,0 +1,26 @@
1
+ import React, { AnchorHTMLAttributes, HTMLAttributes, SVGProps } from "react";
2
+ import { AsChildProps } from "../types/index.js";
3
+ type LinkAnchorOverlayProps = HTMLAttributes<HTMLDivElement> & AsChildProps;
4
+ declare const LinkAnchorOverlay: React.ForwardRefExoticComponent<LinkAnchorOverlayProps & React.RefAttributes<HTMLDivElement>>;
5
+ type LinkAnchorProps = AnchorHTMLAttributes<HTMLAnchorElement> & ({
6
+ children: React.ReactElement | false | null;
7
+ /**
8
+ * Renders the component and its child as a single element,
9
+ * merging the props of the component with the props of the child.
10
+ */
11
+ asChild: true;
12
+ as?: never;
13
+ } | {
14
+ children: React.ReactNode;
15
+ /**
16
+ * Renders the component and its child as a single element,
17
+ * merging the props of the component with the props of the child.
18
+ */
19
+ asChild?: false;
20
+ href: string;
21
+ });
22
+ declare const LinkAnchor: React.ForwardRefExoticComponent<LinkAnchorProps & React.RefAttributes<HTMLAnchorElement>>;
23
+ type LinkAnchorArrowProps = Omit<SVGProps<SVGSVGElement>, "ref">;
24
+ declare const LinkAnchorArrow: React.ForwardRefExoticComponent<LinkAnchorArrowProps & React.RefAttributes<SVGSVGElement>>;
25
+ export { LinkAnchor, LinkAnchorArrow, LinkAnchorOverlay };
26
+ export type { LinkAnchorArrowProps, LinkAnchorOverlayProps, LinkAnchorProps };
@@ -0,0 +1,72 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React, { forwardRef, useRef, } from "react";
13
+ import { ArrowRightIcon } from "@navikt/aksel-icons";
14
+ import { Slot } from "../../slot/Slot.js";
15
+ import { useRenameCSS } from "../../theme/Theme.js";
16
+ import { composeEventHandlers } from "../composeEventHandlers.js";
17
+ import { createContext } from "../create-context.js";
18
+ import { useMergeRefs } from "../hooks/useMergeRefs.js";
19
+ const [LinkAnchorContextProvider, useLinkAnchorContext] = createContext({
20
+ name: "LinkAnchorOverlayContext",
21
+ });
22
+ const LinkAnchorOverlay = forwardRef((_a, forwardedRef) => {
23
+ var { children, asChild, className, onClick } = _a, restProps = __rest(_a, ["children", "asChild", "className", "onClick"]);
24
+ const { cn } = useRenameCSS();
25
+ const anchorRef = useRef(null);
26
+ const Component = asChild ? Slot : "div";
27
+ return (React.createElement(LinkAnchorContextProvider, { anchorRef: anchorRef },
28
+ React.createElement(Component, Object.assign({ ref: forwardedRef }, restProps, { className: cn("navds-link-anchor__overlay", className), onClick: composeEventHandlers(onClick, (e) => {
29
+ var _a;
30
+ if (e.target === anchorRef.current || isTextSelected()) {
31
+ return;
32
+ }
33
+ const event = new MouseEvent("click", {
34
+ bubbles: true,
35
+ cancelable: true,
36
+ view: window,
37
+ ctrlKey: e.ctrlKey,
38
+ shiftKey: e.shiftKey,
39
+ altKey: e.altKey,
40
+ metaKey: e.metaKey,
41
+ button: e.button,
42
+ screenX: e.screenX,
43
+ screenY: e.screenY,
44
+ clientX: e.clientX,
45
+ clientY: e.clientY,
46
+ });
47
+ (_a = anchorRef.current) === null || _a === void 0 ? void 0 : _a.dispatchEvent(event);
48
+ }) }), children)));
49
+ });
50
+ const LinkAnchor = forwardRef((_a, forwardedRef) => {
51
+ var { children, asChild, className } = _a, restProps = __rest(_a, ["children", "asChild", "className"]);
52
+ const { cn } = useRenameCSS();
53
+ const context = useLinkAnchorContext(false);
54
+ const mergedRefs = useMergeRefs(forwardedRef, context === null || context === void 0 ? void 0 : context.anchorRef);
55
+ const Component = asChild ? Slot : "a";
56
+ return (React.createElement(Component, Object.assign({ ref: mergedRefs }, restProps, { className: cn("navds-link-anchor", className) }), children));
57
+ });
58
+ const LinkAnchorArrow = forwardRef((_a, forwardedRef) => {
59
+ var { className } = _a, restProps = __rest(_a, ["className"]);
60
+ const { cn } = useRenameCSS();
61
+ return (React.createElement(ArrowRightIcon, Object.assign({ ref: forwardedRef, "aria-hidden": true, className: cn("navds-link-anchor__arrow", className) }, restProps)));
62
+ });
63
+ /* -------------------------- LinkAnchor Utilities -------------------------- */
64
+ function isTextSelected() {
65
+ var _a;
66
+ if (typeof window === "undefined") {
67
+ return false;
68
+ }
69
+ return !!((_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.toString());
70
+ }
71
+ export { LinkAnchor, LinkAnchorArrow, LinkAnchorOverlay };
72
+ //# sourceMappingURL=LinkAnchor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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E,CAAC,mBAAmB,EAAE,SAAS,CAAC,KAE5C,QAAQ,CACC,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAKF,MAAM,eAAe,GAAG,UAAU,CAChC,CAAC,EAAiD,EAAE,YAAY,EAAE,EAAE;QAAnE,EAAE,SAAS,OAAsC,EAAjC,SAAS,cAAzB,aAA2B,CAAF;IACxB,MAAM,EAAE,EAAE,EAAE,GAAG,YAAY,EAAE,CAAC;IAE9B,OAAO,CACL,oBAAC,cAAc,kBACb,GAAG,EAAE,YAAY,uBAEjB,SAAS,EAAE,EAAE,CAAC,0BAA0B,EAAE,SAAS,CAAC,IAChD,SAAS,EACb,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gFAAgF;AAChF,SAAS,cAAc;;IACrB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CAAC,CAAC,CAAA,MAAA,MAAM,CAAC,YAAY,EAAE,0CAAE,QAAQ,EAAE,CAAA,CAAC;AAC7C,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { LinkAnchor, LinkAnchorOverlay, LinkAnchorArrow } from "./LinkAnchor.js";
2
+ export type { LinkAnchorProps, LinkAnchorOverlayProps, LinkAnchorArrowProps, } from "./LinkAnchor.js";
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ export { LinkAnchor, LinkAnchorOverlay, LinkAnchorArrow } from "./LinkAnchor.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/link-anchor/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/ds-react",
3
- "version": "7.23.2",
3
+ "version": "7.25.1",
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",
@@ -264,6 +264,16 @@
264
264
  "default": "./cjs/link/index.js"
265
265
  }
266
266
  },
267
+ "./LinkCard": {
268
+ "import": {
269
+ "types": "./esm/link-card/index.d.ts",
270
+ "default": "./esm/link-card/index.js"
271
+ },
272
+ "require": {
273
+ "types": "./cjs/link-card/index.d.ts",
274
+ "default": "./cjs/link-card/index.js"
275
+ }
276
+ },
267
277
  "./LinkPanel": {
268
278
  "import": {
269
279
  "types": "./esm/link-panel/index.d.ts",
@@ -630,8 +640,8 @@
630
640
  "dependencies": {
631
641
  "@floating-ui/react": "0.27.8",
632
642
  "@floating-ui/react-dom": "^2.0.9",
633
- "@navikt/aksel-icons": "^7.23.2",
634
- "@navikt/ds-tokens": "^7.23.2",
643
+ "@navikt/aksel-icons": "^7.25.1",
644
+ "@navikt/ds-tokens": "^7.25.1",
635
645
  "clsx": "^2.1.0",
636
646
  "date-fns": "^4.0.0",
637
647
  "react-day-picker": "9.7.0"
package/src/chat/Chat.tsx CHANGED
@@ -122,22 +122,24 @@ export const Chat = forwardRef<HTMLDivElement, ChatProps>(
122
122
  {avatar}
123
123
  </div>
124
124
  )}
125
- <ol className={cn("navds-chat__bubble-wrapper")}>
125
+ <BodyLong
126
+ as="div"
127
+ size={size}
128
+ className={cn("navds-chat__bubble-wrapper")}
129
+ >
126
130
  {React.Children.map(children, (child, i) => {
127
- if (React.isValidElement(child)) {
128
- return (
129
- <BodyLong as="li" size={size}>
130
- {React.cloneElement(child, {
131
- name: name && i === 0 ? name : undefined,
132
- timestamp: timestamp && i === 0 ? timestamp : undefined,
133
- toptextHeadingLevel,
134
- ...child.props,
135
- })}
136
- </BodyLong>
137
- );
131
+ if (!React.isValidElement(child)) {
132
+ return null;
138
133
  }
134
+
135
+ return React.cloneElement(child, {
136
+ name: name && i === 0 ? name : undefined,
137
+ timestamp: timestamp && i === 0 ? timestamp : undefined,
138
+ toptextHeadingLevel,
139
+ ...child.props,
140
+ });
139
141
  })}
140
- </ol>
142
+ </BodyLong>
141
143
  </div>
142
144
  );
143
145
  },