@developer-overheid-nl/don-register-components 1.0.0 → 1.1.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 (64) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/LICENSE.md +291 -291
  3. package/README.md +20 -20
  4. package/package.json +10 -7
  5. package/src/alert/Alert.tsx +19 -19
  6. package/src/alert/styles.module.css +3 -3
  7. package/src/alignBox/AlignBox.tsx +111 -110
  8. package/src/alignBox/styles.module.css +106 -106
  9. package/src/analytics/PiwikPro.tsx +72 -0
  10. package/src/analytics/index.ts +1 -0
  11. package/src/article/Article.tsx +10 -10
  12. package/src/block/Block.tsx +35 -35
  13. package/src/block/styles.module.css +29 -29
  14. package/src/button/Button.tsx +3 -3
  15. package/src/cardAsLink/CardAsLink.tsx +21 -21
  16. package/src/cardAsLink/styles.module.css +23 -23
  17. package/src/cardsList/CardsList.tsx +54 -54
  18. package/src/cardsList/styles.module.css +19 -19
  19. package/src/client.ts +2 -2
  20. package/src/container/Container.tsx +10 -10
  21. package/src/container/styles.module.css +28 -28
  22. package/src/copyButton/CopyButton.tsx +39 -39
  23. package/src/copyButton/styles.module.css +13 -13
  24. package/src/dataBadgeLink/DataBadgeLink.tsx +50 -50
  25. package/src/dataBadgeLink/styles.module.css +43 -43
  26. package/src/dataSummary/DataSummary.tsx +22 -22
  27. package/src/dataSummary/DataSummaryItem.tsx +21 -21
  28. package/src/dataSummary/styles.module.css +70 -70
  29. package/src/fieldset/FieldSet.tsx +3 -3
  30. package/src/filters/Filters.tsx +115 -115
  31. package/src/filters/styles.module.css +26 -26
  32. package/src/footer/Footer.tsx +76 -76
  33. package/src/footer/styles.module.css +103 -103
  34. package/src/formFieldLabel/FormFieldLabel.tsx +23 -23
  35. package/src/formFieldTextInput/FormFieldTextInput.tsx +3 -3
  36. package/src/header/Header.tsx +137 -137
  37. package/src/header/styles.module.css +71 -71
  38. package/src/heading/Heading.tsx +10 -10
  39. package/src/headingGroup/HeadingGroup.tsx +48 -48
  40. package/src/headingGroup/styles.module.css +3 -3
  41. package/src/i18n.ts +25 -24
  42. package/src/iconBadge/IconBadge.tsx +32 -32
  43. package/src/iconBadge/getAppearance.ts +47 -47
  44. package/src/iconBadge/styles.module.css +19 -19
  45. package/src/iconsSprite/Icon.tsx +17 -17
  46. package/src/iconsSprite/IconsSprite.tsx +5 -5
  47. package/src/index.ts +80 -80
  48. package/src/link/Link.tsx +10 -10
  49. package/src/markdown/Markdown.tsx +42 -42
  50. package/src/pagination/Pagination.tsx +144 -144
  51. package/src/pagination/styles.module.css +13 -13
  52. package/src/paragraph/Paragraph.tsx +10 -10
  53. package/src/pillBadge/PillBadge.examples.tsx +107 -107
  54. package/src/pillBadge/PillBadge.tsx +51 -51
  55. package/src/pillBadge/styles.module.css +194 -194
  56. package/src/readOnlyTextInput/ReadOnlyTextInput.tsx +24 -24
  57. package/src/readOnlyTextInput/styles.module.css +19 -19
  58. package/src/scoreBadge/ScoreBadge.tsx +132 -132
  59. package/src/search/Search.tsx +66 -66
  60. package/src/search/styles.module.css +39 -39
  61. package/src/siteLogo/SiteLogo.tsx +24 -24
  62. package/src/topNavigation/TopNavigation.tsx +67 -64
  63. package/src/topNavigation/styles.module.css +54 -54
  64. package/tsconfig.json +121 -121
package/README.md CHANGED
@@ -1,20 +1,20 @@
1
- # Register Site Components
2
-
3
- > Deze package bevat de generieke React componenten voor een register site.
4
-
5
- ![NPM License](https://img.shields.io/npm/l/%40developer-overheid-nl%2Fdon-register-components)
6
- [![NPM Version](https://img.shields.io/npm/v/%40developer-overheid-nl%2Fdon-register-components)](https://www.npmjs.com/package/@developer-overheid-nl/don-register-components)
7
- ![NPM Last Update](https://img.shields.io/npm/last-update/%40developer-overheid-nl%2Fdon-register-components)
8
-
9
- ## Gebruik
10
-
11
- Deze package wordt gebruikt in de register sites van developer.overheid.nl en in register-site-template repository.
12
-
13
- De package heeft o.a. de volgende dependencies:
14
-
15
- - [Rijkshuisstijl Community](https://www.rijkshuisstijl-community.nl/) voor de React componenten, CSS en design tokens
16
- - [@developer-overheid-nl/don-register-locales](https://www.npmjs.com/package/@developer-overheid-nl/don-register-locales)
17
-
18
- ## Changelog
19
-
20
- Zie de [CHANGELOG](./CHANGELOG.md) voor een overzicht van de wijzigingen in deze package.
1
+ # Register Site Components
2
+
3
+ > Deze package bevat de generieke React componenten voor een register site.
4
+
5
+ ![NPM License](https://img.shields.io/npm/l/%40developer-overheid-nl%2Fdon-register-components)
6
+ [![NPM Version](https://img.shields.io/npm/v/%40developer-overheid-nl%2Fdon-register-components)](https://www.npmjs.com/package/@developer-overheid-nl/don-register-components)
7
+ ![NPM Last Update](https://img.shields.io/npm/last-update/%40developer-overheid-nl%2Fdon-register-components)
8
+
9
+ ## Gebruik
10
+
11
+ Deze package wordt gebruikt in de register sites van developer.overheid.nl en in register-site-template repository.
12
+
13
+ De package heeft o.a. de volgende dependencies:
14
+
15
+ - [Rijkshuisstijl Community](https://www.rijkshuisstijl-community.nl/) voor de React componenten, CSS en design tokens
16
+ - [@developer-overheid-nl/don-register-locales](https://www.npmjs.com/package/@developer-overheid-nl/don-register-locales)
17
+
18
+ ## Changelog
19
+
20
+ Zie de [CHANGELOG](./CHANGELOG.md) voor een overzicht van de wijzigingen in deze package.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "license": "EUPL-1.2",
6
6
  "private": false,
7
7
  "type": "module",
8
- "version": "1.0.0",
8
+ "version": "1.1.0",
9
9
  "keywords": [],
10
10
  "publishConfig": {
11
11
  "access": "public"
@@ -13,22 +13,25 @@
13
13
  "exports": {
14
14
  ".": "./src/index.ts",
15
15
  "./client": "./src/client.ts",
16
+ "./analytics": "./src/analytics/index.ts",
16
17
  "./i18n": "./src/i18n.ts"
17
18
  },
18
19
  "main": "./src/index.ts",
19
20
  "files": [
20
21
  "src/",
21
- "tsconfig.json"
22
+ "tsconfig.json",
23
+ "CHANGELOG.md"
22
24
  ],
23
25
  "dependencies": {
24
- "@rijkshuisstijl-community/components-css": "11.0.0",
25
- "@rijkshuisstijl-community/components-react": "10.0.0",
26
+ "@piwikpro/react-piwik-pro": "2.5.0",
27
+ "@rijkshuisstijl-community/components-css": "12.0.0",
28
+ "@rijkshuisstijl-community/components-react": "11.0.0",
26
29
  "@rijkshuisstijl-community/design-tokens": "11.0.0",
27
30
  "@types/parse-link-header": "^2.0.3",
28
31
  "clsx": "2.1.1",
29
- "i18next": "25.7.3",
32
+ "i18next": "25.8.4",
30
33
  "parse-link-header": "^2.0.0",
31
- "react-i18next": "16.5.1",
34
+ "react-i18next": "16.5.4",
32
35
  "react-markdown": "10.1.0",
33
36
  "remark-behead": "^3.1.0",
34
37
  "@developer-overheid-nl/don-register-locales": "1.0.0"
@@ -37,7 +40,7 @@
37
40
  "@vitejs/plugin-react": "^5.1.2",
38
41
  "rimraf": "^6.1.2",
39
42
  "typescript": "5.9.3",
40
- "vite": "7.3.0",
43
+ "vite": "7.3.1",
41
44
  "vite-plugin-dts": "^4.5.4"
42
45
  },
43
46
  "peerDependencies": {
@@ -1,19 +1,19 @@
1
- import {
2
- Alert as RHCAlert,
3
- type AlertProps as RHCAlertProps,
4
- } from "@rijkshuisstijl-community/components-react";
5
- import clsx from "clsx";
6
- import type { PropsWithChildren } from "react";
7
- import styles from "./styles.module.css";
8
-
9
- export interface AlertProps extends RHCAlertProps {
10
- className?: string;
11
- }
12
-
13
- const Alert = (props: PropsWithChildren<AlertProps>) => {
14
- const { className } = props;
15
-
16
- return <RHCAlert className={clsx(className, styles.alert)} {...props} />;
17
- };
18
-
19
- export default Alert;
1
+ import {
2
+ Alert as RHCAlert,
3
+ type AlertProps as RHCAlertProps,
4
+ } from "@rijkshuisstijl-community/components-react";
5
+ import clsx from "clsx";
6
+ import type { PropsWithChildren } from "react";
7
+ import styles from "./styles.module.css";
8
+
9
+ export interface AlertProps extends RHCAlertProps {
10
+ className?: string;
11
+ }
12
+
13
+ const Alert = (props: PropsWithChildren<AlertProps>) => {
14
+ const { className } = props;
15
+
16
+ return <RHCAlert className={clsx(className, styles.alert)} {...props} />;
17
+ };
18
+
19
+ export default Alert;
@@ -1,3 +1,3 @@
1
- .alert {
2
- --utrecht-space-around: 1;
3
- }
1
+ .alert {
2
+ --utrecht-space-around: 1;
3
+ }
@@ -1,110 +1,111 @@
1
- import clsx from "clsx";
2
- import type React from "react";
3
- import type { ReactNode } from "react";
4
- import styles from "./styles.module.css";
5
-
6
- type Align =
7
- | "left"
8
- | "center"
9
- | "right"
10
- | "top"
11
- | "bottom"
12
- | "middle"
13
- | "top-left"
14
- | "top-right"
15
- | "bottom-left"
16
- | "bottom-right"
17
- | "stretch"
18
- | "space-between"
19
- | "space-around"
20
- | "space-evenly";
21
-
22
- type Gap = "none" | "small" | "medium" | "large";
23
-
24
- export interface AlignBoxProps {
25
- align?: Align;
26
- gap?: Gap;
27
- direction?: "row" | "column";
28
- display?: "block" | "inline";
29
- className?: string;
30
- children: ReactNode;
31
- }
32
-
33
- const getAlignmentClass = (align: Align): string => {
34
- switch (align) {
35
- case "left":
36
- return styles.left;
37
- case "center":
38
- return styles.center;
39
- case "right":
40
- return styles.right;
41
- case "top":
42
- return styles.top;
43
- case "bottom":
44
- return styles.bottom;
45
- case "middle":
46
- return styles.middle;
47
- case "top-left":
48
- return styles.topLeft;
49
- case "top-right":
50
- return styles.topRight;
51
- case "bottom-left":
52
- return styles.bottomLeft;
53
- case "bottom-right":
54
- return styles.bottomRight;
55
- case "stretch":
56
- return styles.stretch;
57
- case "space-between":
58
- return styles.spaceBetween;
59
- case "space-around":
60
- return styles.spaceAround;
61
- case "space-evenly":
62
- return styles.spaceEvenly;
63
- default:
64
- return styles.center;
65
- }
66
- };
67
-
68
- const getGapClass = (gap: Gap): string => {
69
- switch (gap) {
70
- case "none":
71
- return styles.gapNone;
72
- case "small":
73
- return styles.gapSmall;
74
- case "medium":
75
- return styles.gapMedium;
76
- case "large":
77
- return styles.gapLarge;
78
- default:
79
- return styles.gapMedium;
80
- }
81
- };
82
-
83
- const AlignBox: React.FC<AlignBoxProps> = ({
84
- align = "center",
85
- gap = "none",
86
- direction = "row",
87
- display = "block",
88
- className,
89
- children,
90
- }) => {
91
- const alignmentClass = getAlignmentClass(align);
92
- const gapClass = getGapClass(gap);
93
-
94
- return (
95
- <div
96
- className={clsx(
97
- styles.alignBox,
98
- styles[direction],
99
- styles[display],
100
- alignmentClass,
101
- gapClass,
102
- className ?? "",
103
- )}
104
- >
105
- {children}
106
- </div>
107
- );
108
- };
109
-
110
- export default AlignBox;
1
+ import clsx from "clsx";
2
+ import type React from "react";
3
+ import type { ReactNode } from "react";
4
+ import styles from "./styles.module.css";
5
+
6
+ type Align =
7
+ | "left"
8
+ | "center"
9
+ | "right"
10
+ | "top"
11
+ | "bottom"
12
+ | "middle"
13
+ | "top-left"
14
+ | "top-right"
15
+ | "bottom-left"
16
+ | "bottom-right"
17
+ | "stretch"
18
+ | "space-between"
19
+ | "space-around"
20
+ | "space-evenly";
21
+
22
+ type Gap = "none" | "small" | "medium" | "large";
23
+
24
+ export interface AlignBoxProps extends React.HTMLAttributes<HTMLDivElement> {
25
+ align?: Align;
26
+ gap?: Gap;
27
+ direction?: "row" | "column";
28
+ display?: "block" | "inline";
29
+ children: ReactNode;
30
+ }
31
+
32
+ const getAlignmentClass = (align: Align): string => {
33
+ switch (align) {
34
+ case "left":
35
+ return styles.left;
36
+ case "center":
37
+ return styles.center;
38
+ case "right":
39
+ return styles.right;
40
+ case "top":
41
+ return styles.top;
42
+ case "bottom":
43
+ return styles.bottom;
44
+ case "middle":
45
+ return styles.middle;
46
+ case "top-left":
47
+ return styles.topLeft;
48
+ case "top-right":
49
+ return styles.topRight;
50
+ case "bottom-left":
51
+ return styles.bottomLeft;
52
+ case "bottom-right":
53
+ return styles.bottomRight;
54
+ case "stretch":
55
+ return styles.stretch;
56
+ case "space-between":
57
+ return styles.spaceBetween;
58
+ case "space-around":
59
+ return styles.spaceAround;
60
+ case "space-evenly":
61
+ return styles.spaceEvenly;
62
+ default:
63
+ return styles.center;
64
+ }
65
+ };
66
+
67
+ const getGapClass = (gap: Gap): string => {
68
+ switch (gap) {
69
+ case "none":
70
+ return styles.gapNone;
71
+ case "small":
72
+ return styles.gapSmall;
73
+ case "medium":
74
+ return styles.gapMedium;
75
+ case "large":
76
+ return styles.gapLarge;
77
+ default:
78
+ return styles.gapMedium;
79
+ }
80
+ };
81
+
82
+ const AlignBox: React.FC<AlignBoxProps> = ({
83
+ align = "center",
84
+ gap = "none",
85
+ direction = "row",
86
+ display = "block",
87
+ className,
88
+ children,
89
+ ...restProps
90
+ }) => {
91
+ const alignmentClass = getAlignmentClass(align);
92
+ const gapClass = getGapClass(gap);
93
+
94
+ return (
95
+ <div
96
+ className={clsx(
97
+ styles.alignBox,
98
+ styles[direction],
99
+ styles[display],
100
+ alignmentClass,
101
+ gapClass,
102
+ className ?? "",
103
+ )}
104
+ {...restProps}
105
+ >
106
+ {children}
107
+ </div>
108
+ );
109
+ };
110
+
111
+ export default AlignBox;
@@ -1,106 +1,106 @@
1
- .alignBox {
2
- display: flex;
3
- inline-size: 100%;
4
-
5
- :global(.no-shrink) {
6
- flex-shrink: 0;
7
- }
8
- }
9
-
10
- .inline {
11
- inline-size: max-content;
12
- }
13
-
14
- .block {
15
- inline-size: 100%;
16
- }
17
-
18
- .row {
19
- flex-direction: row;
20
- }
21
-
22
- .column {
23
- flex-direction: column;
24
- }
25
-
26
- .left {
27
- align-items: center;
28
- justify-content: flex-start;
29
- }
30
-
31
- .center,
32
- .middle {
33
- align-items: center;
34
- justify-content: center;
35
- }
36
-
37
- .right {
38
- align-items: center;
39
- justify-content: flex-end;
40
- }
41
-
42
- .top {
43
- align-items: flex-start;
44
- justify-content: center;
45
- }
46
-
47
- .bottom {
48
- align-items: flex-end;
49
- justify-content: center;
50
- }
51
-
52
- .topLeft {
53
- align-items: flex-start;
54
- justify-content: flex-start;
55
- }
56
-
57
- .topRight {
58
- align-items: flex-start;
59
- justify-content: flex-end;
60
- }
61
-
62
- .bottomLeft {
63
- align-items: flex-end;
64
- justify-content: flex-start;
65
- }
66
-
67
- .bottomRight {
68
- align-items: flex-end;
69
- justify-content: flex-end;
70
- }
71
-
72
- .stretch {
73
- align-items: stretch;
74
- justify-content: stretch;
75
- }
76
-
77
- .spaceBetween {
78
- align-items: center;
79
- justify-content: space-between;
80
- }
81
-
82
- .spaceAround {
83
- align-items: center;
84
- justify-content: space-around;
85
- }
86
-
87
- .spaceEvenly {
88
- align-items: center;
89
- justify-content: space-evenly;
90
- }
91
-
92
- .gapNone {
93
- gap: 0;
94
- }
95
-
96
- .gapSmall {
97
- gap: 0.5rem;
98
- }
99
-
100
- .gapMedium {
101
- gap: 1rem;
102
- }
103
-
104
- .gapLarge {
105
- gap: 2rem;
106
- }
1
+ .alignBox {
2
+ display: flex;
3
+ inline-size: 100%;
4
+
5
+ :global(.no-shrink) {
6
+ flex-shrink: 0;
7
+ }
8
+ }
9
+
10
+ .inline {
11
+ inline-size: max-content;
12
+ }
13
+
14
+ .block {
15
+ inline-size: 100%;
16
+ }
17
+
18
+ .row {
19
+ flex-direction: row;
20
+ }
21
+
22
+ .column {
23
+ flex-direction: column;
24
+ }
25
+
26
+ .left {
27
+ align-items: center;
28
+ justify-content: flex-start;
29
+ }
30
+
31
+ .center,
32
+ .middle {
33
+ align-items: center;
34
+ justify-content: center;
35
+ }
36
+
37
+ .right {
38
+ align-items: center;
39
+ justify-content: flex-end;
40
+ }
41
+
42
+ .top {
43
+ align-items: flex-start;
44
+ justify-content: center;
45
+ }
46
+
47
+ .bottom {
48
+ align-items: flex-end;
49
+ justify-content: center;
50
+ }
51
+
52
+ .topLeft {
53
+ align-items: flex-start;
54
+ justify-content: flex-start;
55
+ }
56
+
57
+ .topRight {
58
+ align-items: flex-start;
59
+ justify-content: flex-end;
60
+ }
61
+
62
+ .bottomLeft {
63
+ align-items: flex-end;
64
+ justify-content: flex-start;
65
+ }
66
+
67
+ .bottomRight {
68
+ align-items: flex-end;
69
+ justify-content: flex-end;
70
+ }
71
+
72
+ .stretch {
73
+ align-items: stretch;
74
+ justify-content: stretch;
75
+ }
76
+
77
+ .spaceBetween {
78
+ align-items: center;
79
+ justify-content: space-between;
80
+ }
81
+
82
+ .spaceAround {
83
+ align-items: center;
84
+ justify-content: space-around;
85
+ }
86
+
87
+ .spaceEvenly {
88
+ align-items: center;
89
+ justify-content: space-evenly;
90
+ }
91
+
92
+ .gapNone {
93
+ gap: 0;
94
+ }
95
+
96
+ .gapSmall {
97
+ gap: 0.5rem;
98
+ }
99
+
100
+ .gapMedium {
101
+ gap: 1rem;
102
+ }
103
+
104
+ .gapLarge {
105
+ gap: 2rem;
106
+ }
@@ -0,0 +1,72 @@
1
+ "use client";
2
+
3
+ import PiwikPro, {
4
+ ContentTracking,
5
+ type Dimensions,
6
+ DownloadAndOutlink,
7
+ ErrorTracking,
8
+ PageViews,
9
+ SiteSearch,
10
+ } from "@piwikpro/react-piwik-pro";
11
+ import { useEffect } from "react";
12
+
13
+ interface AnalyticsProps {
14
+ siteId: string;
15
+ accountAddress: string;
16
+ dataLayerName?: string;
17
+ trackJSErrors?: boolean;
18
+ downloadExtensions?: string[];
19
+ pageTitle?: string;
20
+ isSearchPage?: boolean;
21
+ searchObject?: {
22
+ keyword: string;
23
+ category?: string;
24
+ searchCount?: number;
25
+ dimensions?: Dimensions;
26
+ };
27
+ }
28
+
29
+ // Default extra download extensions in addition to the standard ones tracked by Piwik Pro.
30
+ const DOWNLOAD_EXTENSIONS = ["json", "yaml", "yml"];
31
+
32
+ export default function Analytics(props: AnalyticsProps) {
33
+ /* const nonce = `n.${Math.random() * 1000000}`; // TODO: replace with nanoid or uuid */
34
+ const {
35
+ siteId,
36
+ accountAddress,
37
+ dataLayerName,
38
+ trackJSErrors = true,
39
+ pageTitle,
40
+ isSearchPage,
41
+ searchObject,
42
+ } = props;
43
+ const downloadExtensions = [
44
+ ...DOWNLOAD_EXTENSIONS,
45
+ ...(props.downloadExtensions || []),
46
+ ];
47
+
48
+ PiwikPro.initialize(siteId, accountAddress, {
49
+ /* nonce, */
50
+ dataLayerName,
51
+ });
52
+
53
+ DownloadAndOutlink.addDownloadExtensions(downloadExtensions);
54
+
55
+ ContentTracking.trackAllContentImpressions();
56
+ ContentTracking.trackVisibleContentImpressions(true);
57
+
58
+ if (trackJSErrors) {
59
+ ErrorTracking.enableJSErrorTracking();
60
+ }
61
+
62
+ useEffect(() => {
63
+ if (pageTitle && !isSearchPage) {
64
+ PageViews.trackPageView(pageTitle);
65
+ } else if (isSearchPage && searchObject?.keyword) {
66
+ const { keyword, category, searchCount, dimensions } = searchObject;
67
+ SiteSearch.trackSiteSearch(keyword, category, searchCount, dimensions);
68
+ }
69
+ }, [pageTitle, isSearchPage, searchObject]);
70
+
71
+ return null;
72
+ }
@@ -0,0 +1 @@
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;