@developer-overheid-nl/don-register-components 1.2.0 → 1.3.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 (89) hide show
  1. package/CHANGELOG.md +130 -85
  2. package/LICENSE.md +291 -291
  3. package/README.md +20 -20
  4. package/package.json +5 -7
  5. package/src/alert/Alert.tsx +19 -19
  6. package/src/alert/styles.module.css +3 -3
  7. package/src/alignBox/AlignBox.tsx +114 -114
  8. package/src/alignBox/styles.module.css +110 -110
  9. package/src/amountLabel/AmountLabel.tsx +16 -16
  10. package/src/amountLabel/styles.module.css +11 -11
  11. package/src/analytics/PiwikPro.tsx +94 -94
  12. package/src/analytics/index.ts +1 -1
  13. package/src/article/Article.tsx +10 -10
  14. package/src/badgeList/BadgeList.tsx +34 -26
  15. package/src/badgeList/styles.module.css +37 -24
  16. package/src/block/Block.tsx +35 -35
  17. package/src/block/styles.module.css +29 -29
  18. package/src/button/Button.tsx +3 -3
  19. package/src/cardAsLink/CardAsLink.tsx +21 -21
  20. package/src/cardAsLink/styles.module.css +23 -23
  21. package/src/cardsList/CardsList.tsx +56 -54
  22. package/src/cardsList/styles.module.css +19 -19
  23. package/src/client.ts +7 -7
  24. package/src/container/Container.tsx +10 -10
  25. package/src/container/styles.module.css +28 -28
  26. package/src/copyButton/CopyButton.tsx +39 -39
  27. package/src/copyButton/styles.module.css +13 -13
  28. package/src/dataBadgeLink/DataBadgeLink.tsx +53 -53
  29. package/src/dataBadgeLink/styles.module.css +89 -69
  30. package/src/dataSummary/DataSummary.tsx +22 -22
  31. package/src/dataSummary/DataSummaryItem.tsx +21 -21
  32. package/src/dataSummary/styles.module.css +75 -75
  33. package/src/facetFilters/FacetFilters.tsx +419 -313
  34. package/src/facetFilters/styles.module.css +3 -3
  35. package/src/fieldset/FieldSet.tsx +3 -3
  36. package/src/filters/Filters.tsx +116 -115
  37. package/src/filters/styles.module.css +26 -26
  38. package/src/footer/Footer.tsx +76 -76
  39. package/src/footer/styles.module.css +103 -103
  40. package/src/formFieldCheckboxGroup/FormFieldCheckboxGroup.tsx +16 -16
  41. package/src/formFieldCheckboxGroup/styles.module.css +5 -5
  42. package/src/formFieldCheckboxOption/FormFieldCheckboxOption.tsx +26 -26
  43. package/src/formFieldCheckboxOption/styles.module.css +22 -22
  44. package/src/formFieldLabel/FormFieldLabel.tsx +23 -23
  45. package/src/formFieldRadioGroup/FormFieldRadioGroup.tsx +13 -13
  46. package/src/formFieldRadioGroup/styles.module.css +5 -5
  47. package/src/formFieldRadioOption/FormFieldRadioOption.tsx +75 -75
  48. package/src/formFieldRadioOption/styles.module.css +49 -49
  49. package/src/formFieldSwitch/FormFieldSwitch.tsx +79 -79
  50. package/src/formFieldSwitch/styles.module.css +32 -32
  51. package/src/formFieldTextInput/FormFieldTextInput.tsx +3 -3
  52. package/src/header/Header.tsx +137 -137
  53. package/src/header/styles.module.css +71 -71
  54. package/src/heading/Heading.tsx +15 -15
  55. package/src/headingGroup/HeadingGroup.tsx +48 -48
  56. package/src/headingGroup/styles.module.css +3 -3
  57. package/src/i18n.ts +25 -25
  58. package/src/iconBadge/IconBadge.tsx +35 -35
  59. package/src/iconBadge/getAppearance.ts +53 -53
  60. package/src/iconBadge/styles.module.css +19 -19
  61. package/src/iconsSprite/Icon.tsx +17 -17
  62. package/src/iconsSprite/IconsSprite.tsx +5 -5
  63. package/src/index.ts +107 -106
  64. package/src/infoButton/InfoButton.tsx +45 -45
  65. package/src/infoButton/styles.module.css +43 -43
  66. package/src/link/Link.tsx +10 -10
  67. package/src/markdown/Markdown.tsx +42 -42
  68. package/src/overlay/Overlay.tsx +18 -18
  69. package/src/overlay/styles.module.css +15 -15
  70. package/src/pagination/Pagination.tsx +267 -144
  71. package/src/pagination/styles.module.css +28 -13
  72. package/src/paragraph/Paragraph.tsx +24 -24
  73. package/src/paragraph/styles.module.css +6 -6
  74. package/src/pillBadge/PillBadge.examples.tsx +107 -107
  75. package/src/pillBadge/PillBadge.tsx +51 -51
  76. package/src/pillBadge/styles.module.css +214 -214
  77. package/src/readOnlyTextInput/ReadOnlyTextInput.tsx +24 -24
  78. package/src/readOnlyTextInput/styles.module.css +19 -19
  79. package/src/scoreBadge/ScoreBadge.tsx +133 -133
  80. package/src/search/Search.tsx +82 -66
  81. package/src/search/styles.module.css +39 -39
  82. package/src/siteLogo/SiteLogo.tsx +24 -24
  83. package/src/switch/Switch.tsx +86 -86
  84. package/src/switch/styles.module.css +7 -7
  85. package/src/toolTip/ToolTip.tsx +55 -55
  86. package/src/toolTip/styles.module.css +49 -48
  87. package/src/topNavigation/TopNavigation.tsx +67 -67
  88. package/src/topNavigation/styles.module.css +54 -54
  89. package/tsconfig.json +121 -121
@@ -1,94 +1,94 @@
1
- "use client";
2
-
3
- import PiwikPro, {
4
- ContentTracking,
5
- CustomEvent,
6
- type Dimensions,
7
- DownloadAndOutlink,
8
- ErrorTracking,
9
- SiteSearch,
10
- } from "@piwikpro/react-piwik-pro";
11
- import { useEffect } from "react";
12
-
13
- declare global {
14
- interface Window {
15
- _paq: unknown[];
16
- }
17
- }
18
-
19
- interface AnalyticsProps {
20
- siteId: string;
21
- accountAddress: string;
22
- dataLayerName?: string;
23
- trackJSErrors?: boolean;
24
- downloadExtensions?: string[];
25
- /**
26
- * @deprecated This property is deprecated.
27
- */
28
- pageTitle?: string;
29
- customEvent?: { category?: string; action?: string; name: string };
30
- isSearchPage?: boolean;
31
- searchObject?: {
32
- keyword: string;
33
- category?: string;
34
- searchCount?: number;
35
- dimensions?: Dimensions;
36
- };
37
- }
38
-
39
- // Default extra download extensions in addition to the standard ones tracked by Piwik Pro.
40
- const DOWNLOAD_EXTENSIONS = ["json", "yaml", "yml"];
41
-
42
- export default function Analytics(props: AnalyticsProps) {
43
- /* const nonce = `n.${Math.random() * 1000000}`; // TODO: replace with nanoid or uuid */
44
- const {
45
- siteId,
46
- accountAddress,
47
- dataLayerName,
48
- trackJSErrors = true,
49
- pageTitle,
50
- customEvent,
51
- isSearchPage,
52
- searchObject,
53
- } = props;
54
- const downloadExtensions = [
55
- ...DOWNLOAD_EXTENSIONS,
56
- ...(props.downloadExtensions || []),
57
- ];
58
-
59
- if (pageTitle) {
60
- console.warn(
61
- "The 'pageTitle' property is deprecated and will be removed in future versions.",
62
- );
63
- }
64
-
65
- PiwikPro.initialize(siteId, accountAddress, {
66
- /* nonce, */
67
- dataLayerName,
68
- });
69
-
70
- DownloadAndOutlink.addDownloadExtensions(downloadExtensions);
71
-
72
- ContentTracking.trackAllContentImpressions();
73
- ContentTracking.trackVisibleContentImpressions(true);
74
-
75
- if (trackJSErrors) {
76
- ErrorTracking.enableJSErrorTracking();
77
- }
78
-
79
- useEffect(() => {
80
- if (customEvent) {
81
- CustomEvent.trackEvent(
82
- customEvent.category || "Pages",
83
- customEvent.action || "view",
84
- customEvent.name,
85
- );
86
- }
87
- if (isSearchPage && searchObject?.keyword) {
88
- const { keyword, category, searchCount, dimensions } = searchObject;
89
- SiteSearch.trackSiteSearch(keyword, category, searchCount, dimensions);
90
- }
91
- }, [customEvent, isSearchPage, searchObject]);
92
-
93
- return null;
94
- }
1
+ "use client";
2
+
3
+ import PiwikPro, {
4
+ ContentTracking,
5
+ CustomEvent,
6
+ type Dimensions,
7
+ DownloadAndOutlink,
8
+ ErrorTracking,
9
+ SiteSearch,
10
+ } from "@piwikpro/react-piwik-pro";
11
+ import { useEffect } from "react";
12
+
13
+ declare global {
14
+ interface Window {
15
+ _paq: unknown[];
16
+ }
17
+ }
18
+
19
+ interface AnalyticsProps {
20
+ siteId: string;
21
+ accountAddress: string;
22
+ dataLayerName?: string;
23
+ trackJSErrors?: boolean;
24
+ downloadExtensions?: string[];
25
+ /**
26
+ * @deprecated This property is deprecated.
27
+ */
28
+ pageTitle?: string;
29
+ customEvent?: { category?: string; action?: string; name: string };
30
+ isSearchPage?: boolean;
31
+ searchObject?: {
32
+ keyword: string;
33
+ category?: string;
34
+ searchCount?: number;
35
+ dimensions?: Dimensions;
36
+ };
37
+ }
38
+
39
+ // Default extra download extensions in addition to the standard ones tracked by Piwik Pro.
40
+ const DOWNLOAD_EXTENSIONS = ["json", "yaml", "yml"];
41
+
42
+ export default function Analytics(props: AnalyticsProps) {
43
+ /* const nonce = `n.${Math.random() * 1000000}`; // TODO: replace with nanoid or uuid */
44
+ const {
45
+ siteId,
46
+ accountAddress,
47
+ dataLayerName,
48
+ trackJSErrors = true,
49
+ pageTitle,
50
+ customEvent,
51
+ isSearchPage,
52
+ searchObject,
53
+ } = props;
54
+ const downloadExtensions = [
55
+ ...DOWNLOAD_EXTENSIONS,
56
+ ...(props.downloadExtensions || []),
57
+ ];
58
+
59
+ if (pageTitle) {
60
+ console.warn(
61
+ "The 'pageTitle' property is deprecated and will be removed in future versions.",
62
+ );
63
+ }
64
+
65
+ PiwikPro.initialize(siteId, accountAddress, {
66
+ /* nonce, */
67
+ dataLayerName,
68
+ });
69
+
70
+ DownloadAndOutlink.addDownloadExtensions(downloadExtensions);
71
+
72
+ ContentTracking.trackAllContentImpressions();
73
+ ContentTracking.trackVisibleContentImpressions(true);
74
+
75
+ if (trackJSErrors) {
76
+ ErrorTracking.enableJSErrorTracking();
77
+ }
78
+
79
+ useEffect(() => {
80
+ if (customEvent) {
81
+ CustomEvent.trackEvent(
82
+ customEvent.category || "Pages",
83
+ customEvent.action || "view",
84
+ customEvent.name,
85
+ );
86
+ }
87
+ if (isSearchPage && searchObject?.keyword) {
88
+ const { keyword, category, searchCount, dimensions } = searchObject;
89
+ SiteSearch.trackSiteSearch(keyword, category, searchCount, dimensions);
90
+ }
91
+ }, [customEvent, isSearchPage, searchObject]);
92
+
93
+ return null;
94
+ }
@@ -1 +1 @@
1
- export { default as PiwikPro } from "./PiwikPro";
1
+ export { default as PiwikPro } from "./PiwikPro";
@@ -1,10 +1,10 @@
1
- import {
2
- type ArticleProps,
3
- Article as RHCArticle,
4
- } from "@rijkshuisstijl-community/components-react";
5
-
6
- const Article = (props: ArticleProps) => {
7
- return <RHCArticle {...props} />;
8
- };
9
-
10
- export default Article;
1
+ import {
2
+ type ArticleProps,
3
+ Article as RHCArticle,
4
+ } from "@rijkshuisstijl-community/components-react";
5
+
6
+ const Article = (props: ArticleProps) => {
7
+ return <RHCArticle {...props} />;
8
+ };
9
+
10
+ export default Article;
@@ -1,26 +1,34 @@
1
- import clsx from "clsx";
2
- import type { HTMLAttributes } from "react";
3
- import styles from "./styles.module.css";
4
-
5
- export interface BadgeListProps extends HTMLAttributes<HTMLUListElement> {
6
- direction?: "row" | "column";
7
- }
8
-
9
- const BadgeList = (props: BadgeListProps) => {
10
- const { direction = "row", className, children, ...restProps } = props;
11
-
12
- return (
13
- <ul
14
- className={clsx(
15
- styles.badgelist,
16
- styles[`badgelist--${direction}`],
17
- className,
18
- )}
19
- {...restProps}
20
- >
21
- {children}
22
- </ul>
23
- );
24
- };
25
-
26
- export default BadgeList;
1
+ import clsx from "clsx";
2
+ import type { HTMLAttributes } from "react";
3
+ import styles from "./styles.module.css";
4
+
5
+ export interface BadgeListProps extends HTMLAttributes<HTMLUListElement> {
6
+ direction?: "row" | "column";
7
+ table?: boolean;
8
+ }
9
+
10
+ const BadgeList = (props: BadgeListProps) => {
11
+ const {
12
+ direction = "row",
13
+ table = false,
14
+ className,
15
+ children,
16
+ ...restProps
17
+ } = props;
18
+
19
+ return (
20
+ <ul
21
+ className={clsx(
22
+ styles.badgelist,
23
+ styles[`badgelist--${direction}`],
24
+ table && styles[`badgelist--table`],
25
+ className,
26
+ )}
27
+ {...restProps}
28
+ >
29
+ {children}
30
+ </ul>
31
+ );
32
+ };
33
+
34
+ export default BadgeList;
@@ -1,24 +1,37 @@
1
- .badgelist {
2
- display: flex;
3
- flex-wrap: wrap;
4
- gap: 0.25rem;
5
- padding: 0;
6
- list-style: none;
7
-
8
- &:empty {
9
- display: none;
10
- }
11
- }
12
-
13
- .badgelist--row {
14
- flex-direction: row;
15
- }
16
-
17
- .badgelist--row > * {
18
- display: inline-flex;
19
- gap: 0.25rem;
20
- }
21
-
22
- .badgelist--column {
23
- flex-direction: column;
24
- }
1
+ .badgelist {
2
+ display: flex;
3
+ flex-wrap: wrap;
4
+ gap: 0.25rem;
5
+ padding: 0;
6
+ list-style: none;
7
+
8
+ &:empty {
9
+ display: none;
10
+ }
11
+ }
12
+
13
+ .badgelist--row {
14
+ flex-direction: row;
15
+ }
16
+
17
+ .badgelist--row > * {
18
+ display: inline-flex;
19
+ flex-wrap: wrap;
20
+ gap: 0.25rem;
21
+ }
22
+
23
+ .badgelist--column {
24
+ flex-direction: column;
25
+ }
26
+
27
+ .badgelist--table > * {
28
+ display: inline-table;
29
+
30
+ :global(.label) {
31
+ display: table-caption;
32
+ }
33
+
34
+ :global(:not(.label)) {
35
+ margin-inline-end: 0.25rem;
36
+ }
37
+ }
@@ -1,35 +1,35 @@
1
- import clsx from "clsx";
2
- import type { HTMLAttributes, ReactNode } from "react";
3
- import styles from "./styles.module.css";
4
-
5
- export interface BlockProps extends HTMLAttributes<HTMLDivElement> {
6
- className?: string;
7
- children?: ReactNode;
8
- appearance?: "clear" | "outlined" | "filled";
9
- layout?: "full" | "flex-row" | "flex-col";
10
- }
11
-
12
- const Block = (props: BlockProps) => {
13
- const {
14
- className,
15
- appearance = "filled",
16
- layout = "full",
17
- ...restProps
18
- } = props;
19
-
20
- return (
21
- <div
22
- className={clsx([
23
- styles.block,
24
- className,
25
- styles[appearance],
26
- styles[layout],
27
- ])}
28
- {...restProps}
29
- >
30
- {props.children}
31
- </div>
32
- );
33
- };
34
-
35
- export default Block;
1
+ import clsx from "clsx";
2
+ import type { HTMLAttributes, ReactNode } from "react";
3
+ import styles from "./styles.module.css";
4
+
5
+ export interface BlockProps extends HTMLAttributes<HTMLDivElement> {
6
+ className?: string;
7
+ children?: ReactNode;
8
+ appearance?: "clear" | "outlined" | "filled";
9
+ layout?: "full" | "flex-row" | "flex-col";
10
+ }
11
+
12
+ const Block = (props: BlockProps) => {
13
+ const {
14
+ className,
15
+ appearance = "filled",
16
+ layout = "full",
17
+ ...restProps
18
+ } = props;
19
+
20
+ return (
21
+ <div
22
+ className={clsx([
23
+ styles.block,
24
+ className,
25
+ styles[appearance],
26
+ styles[layout],
27
+ ])}
28
+ {...restProps}
29
+ >
30
+ {props.children}
31
+ </div>
32
+ );
33
+ };
34
+
35
+ export default Block;
@@ -1,29 +1,29 @@
1
- .block {
2
- padding: 1rem;
3
- border-radius: var(--rhc-card-as-link-border-radius);
4
-
5
- &.flex-row,
6
- &.flex-col {
7
- display: flex;
8
- align-items: center;
9
- justify-content: space-between;
10
- }
11
-
12
- &.flex-col {
13
- flex-direction: column;
14
- gap: 1rem;
15
- align-items: flex-start;
16
- }
17
-
18
- &.clear {
19
- background-color: transparent;
20
- }
21
-
22
- &.filled {
23
- background-color: var(--rhc-card-as-link-hover-background-color);
24
- }
25
-
26
- &.outlined {
27
- border: 1px solid var(--rhc-card-as-link-border-color);
28
- }
29
- }
1
+ .block {
2
+ padding: 1rem;
3
+ border-radius: var(--rhc-card-as-link-border-radius);
4
+
5
+ &.flex-row,
6
+ &.flex-col {
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: space-between;
10
+ }
11
+
12
+ &.flex-col {
13
+ flex-direction: column;
14
+ gap: 1rem;
15
+ align-items: flex-start;
16
+ }
17
+
18
+ &.clear {
19
+ background-color: transparent;
20
+ }
21
+
22
+ &.filled {
23
+ background-color: var(--rhc-card-as-link-hover-background-color);
24
+ }
25
+
26
+ &.outlined {
27
+ border: 1px solid var(--rhc-card-as-link-border-color);
28
+ }
29
+ }
@@ -1,3 +1,3 @@
1
- import { Button } from "@rijkshuisstijl-community/components-react";
2
-
3
- export default Button;
1
+ import { Button } from "@rijkshuisstijl-community/components-react";
2
+
3
+ export default Button;
@@ -1,21 +1,21 @@
1
- import {
2
- CardAsLink as RHCCardAsLink,
3
- type CardAsLinkProps as RHCCardAsLinkProps,
4
- } from "@rijkshuisstijl-community/components-react";
5
- import clsx from "clsx";
6
- import styles from "./styles.module.css";
7
-
8
- export interface CardAsLinksProps extends RHCCardAsLinkProps {}
9
-
10
- const CardAsLink = (props: CardAsLinksProps) => {
11
- const { className, ...restProps } = props;
12
-
13
- return (
14
- <RHCCardAsLink
15
- className={clsx(className, styles.cardAsLink)}
16
- {...restProps}
17
- />
18
- );
19
- };
20
-
21
- export default CardAsLink;
1
+ import {
2
+ CardAsLink as RHCCardAsLink,
3
+ type CardAsLinkProps as RHCCardAsLinkProps,
4
+ } from "@rijkshuisstijl-community/components-react";
5
+ import clsx from "clsx";
6
+ import styles from "./styles.module.css";
7
+
8
+ export interface CardAsLinksProps extends RHCCardAsLinkProps {}
9
+
10
+ const CardAsLink = (props: CardAsLinksProps) => {
11
+ const { className, ...restProps } = props;
12
+
13
+ return (
14
+ <RHCCardAsLink
15
+ className={clsx(className, styles.cardAsLink)}
16
+ {...restProps}
17
+ />
18
+ );
19
+ };
20
+
21
+ export default CardAsLink;
@@ -1,23 +1,23 @@
1
- .cardAsLink.cardAsLink {
2
- &:hover {
3
- :global(.rhc-card-as-link__heading) {
4
- text-decoration: none;
5
- }
6
- :global(.nl-heading) {
7
- text-decoration: var(
8
- --rhc-card-as-link-active-text-decoration,
9
- underline
10
- );
11
- }
12
- }
13
- }
14
-
15
- :global(.rhc-card-as-link__metadata) {
16
- display: flex;
17
- align-items: baseline;
18
- justify-content: flex-end;
19
- }
20
-
21
- :global(.rhc-card-as-link__footer) {
22
- --rhc-card-as-link-padding-block-start: 0;
23
- }
1
+ .cardAsLink.cardAsLink {
2
+ &:hover {
3
+ :global(.rhc-card-as-link__heading) {
4
+ text-decoration: none;
5
+ }
6
+ :global(.nl-heading) {
7
+ text-decoration: var(
8
+ --rhc-card-as-link-active-text-decoration,
9
+ underline
10
+ );
11
+ }
12
+ }
13
+ }
14
+
15
+ :global(.rhc-card-as-link__metadata) {
16
+ display: flex;
17
+ align-items: baseline;
18
+ justify-content: flex-end;
19
+ }
20
+
21
+ :global(.rhc-card-as-link__footer) {
22
+ --rhc-card-as-link-padding-block-start: 0;
23
+ }
@@ -1,54 +1,56 @@
1
- import type { CardAsLink } from "@rijkshuisstijl-community/components-react";
2
- import clsx from "clsx";
3
- import type { HTMLAttributes, PropsWithChildren, ReactNode } from "react";
4
- import styles from "./styles.module.css";
5
-
6
- export interface CardsListProps extends HTMLAttributes<HTMLOListElement> {
7
- /**
8
- * Array of items to display in the list.
9
- * This will encapsulate the `CardAsLink`s in `<li>` elements.
10
- * If not provided, the component will render its children instead and will not wrap them in `<li>` elements.
11
- * You can then use the `CardsListItem` component to wrap individual items.
12
- *
13
- * @type {?Array<React.JSX.Element | string>}
14
- */
15
- items?: Array<typeof CardAsLink>;
16
- className?: string;
17
- }
18
-
19
- const CardsList = (props: PropsWithChildren<CardsListProps>) => {
20
- const { id, items, className, children } = props;
21
-
22
- return (
23
- <ol className={clsx(styles.cardsList, className)} id={id}>
24
- {items && items.length > 0
25
- ? items.map((item, index, array) => (
26
- <CardsListItem
27
- key={`${id || "don-cards"}_${index}`}
28
- index={index}
29
- setsize={array.length}
30
- >
31
- {item as unknown as ReactNode}
32
- </CardsListItem>
33
- ))
34
- : children}
35
- </ol>
36
- );
37
- };
38
-
39
- export interface CardsListItemProps {
40
- index: number;
41
- setsize: number;
42
- }
43
-
44
- export const CardsListItem = ({
45
- index,
46
- setsize,
47
- children,
48
- }: PropsWithChildren<CardsListItemProps>) => (
49
- <li aria-posinset={index + 1} aria-setsize={setsize}>
50
- {children}
51
- </li>
52
- );
53
-
54
- export default CardsList;
1
+ import type { CardAsLink } from "@rijkshuisstijl-community/components-react";
2
+ import clsx from "clsx";
3
+ import type { HTMLAttributes, PropsWithChildren, ReactNode } from "react";
4
+ import styles from "./styles.module.css";
5
+
6
+ export interface CardsListProps extends HTMLAttributes<HTMLOListElement> {
7
+ /**
8
+ * Array of items to display in the list.
9
+ * This will encapsulate the `CardAsLink`s in `<li>` elements.
10
+ * If not provided, the component will render its children instead and will not wrap them in `<li>` elements.
11
+ * You can then use the `CardsListItem` component to wrap individual items.
12
+ *
13
+ * @type {?Array<React.JSX.Element | string>}
14
+ */
15
+ items?: Array<typeof CardAsLink>;
16
+ className?: string;
17
+ }
18
+
19
+ const CardsList = (props: PropsWithChildren<CardsListProps>) => {
20
+ const { id, items, className, children } = props;
21
+
22
+ return (
23
+ <ol className={clsx(styles.cardsList, className)} id={id}>
24
+ {items && items.length > 0
25
+ ? items.map((item, index, array) => (
26
+ // biome-ignore-start lint/suspicious/noArrayIndexKey: no stable ID's https://legacy.reactjs.org/docs/lists-and-keys.html#keys
27
+ <CardsListItem
28
+ key={`${id || "don-cards"}_${index}`}
29
+ index={index}
30
+ setsize={array.length}
31
+ >
32
+ {item as unknown as ReactNode}
33
+ </CardsListItem>
34
+ // biome-ignore-end lint/suspicious/noArrayIndexKey: no stable ID's https://legacy.reactjs.org/docs/lists-and-keys.html#keys
35
+ ))
36
+ : children}
37
+ </ol>
38
+ );
39
+ };
40
+
41
+ export interface CardsListItemProps {
42
+ index: number;
43
+ setsize: number;
44
+ }
45
+
46
+ export const CardsListItem = ({
47
+ index,
48
+ setsize,
49
+ children,
50
+ }: PropsWithChildren<CardsListItemProps>) => (
51
+ <li aria-posinset={index + 1} aria-setsize={setsize}>
52
+ {children}
53
+ </li>
54
+ );
55
+
56
+ export default CardsList;