@developer-overheid-nl/don-register-components 1.3.1 → 1.6.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.
- package/CHANGELOG.md +170 -130
- package/LICENSE.md +291 -291
- package/README.md +20 -20
- package/package.json +10 -6
- package/src/Introduction.mdx +31 -0
- package/src/alert/Alert.stories.tsx +57 -0
- package/src/alert/Alert.tsx +19 -19
- package/src/alert/styles.module.css +3 -3
- package/src/alignBox/AlignBox.stories.tsx +84 -0
- package/src/alignBox/AlignBox.tsx +114 -114
- package/src/alignBox/styles.module.css +110 -110
- package/src/amountLabel/AmountLabel.stories.tsx +28 -0
- package/src/amountLabel/AmountLabel.tsx +21 -16
- package/src/amountLabel/styles.module.css +11 -11
- package/src/analytics/PiwikPro.tsx +94 -94
- package/src/analytics/index.ts +1 -1
- package/src/article/Article.stories.tsx +53 -0
- package/src/article/Article.tsx +10 -10
- package/src/badgeList/BadgeList.tsx +34 -34
- package/src/badgeList/styles.module.css +37 -37
- package/src/block/Block.stories.tsx +58 -0
- package/src/block/Block.tsx +35 -35
- package/src/block/styles.module.css +29 -29
- package/src/button/Button.stories.tsx +56 -0
- package/src/button/Button.tsx +3 -3
- package/src/button/ButtonAction.stories.tsx +62 -0
- package/src/button/ButtonAction.tsx +51 -0
- package/src/cardAsLink/CardAsLink.stories.tsx +81 -0
- package/src/cardAsLink/CardAsLink.tsx +21 -21
- package/src/cardAsLink/styles.module.css +23 -23
- package/src/cardsList/CardsList.tsx +56 -56
- package/src/cardsList/styles.module.css +18 -19
- package/src/client.ts +7 -7
- package/src/container/Container.stories.tsx +21 -0
- package/src/container/Container.tsx +10 -10
- package/src/container/styles.module.css +28 -28
- package/src/copyButton/CopyButton.stories.tsx +41 -0
- package/src/copyButton/CopyButton.tsx +45 -39
- package/src/copyButton/styles.module.css +13 -13
- package/src/dataBadgeLink/DataBadgeLink.stories.tsx +137 -0
- package/src/dataBadgeLink/DataBadgeLink.tsx +59 -53
- package/src/dataBadgeLink/styles.module.css +89 -89
- package/src/dataSummary/DataSummary.tsx +22 -22
- package/src/dataSummary/DataSummaryItem.tsx +21 -21
- package/src/dataSummary/styles.module.css +75 -75
- package/src/facetFilters/FacetFilters.stories.tsx +93 -0
- package/src/facetFilters/FacetFilters.tsx +424 -419
- package/src/facetFilters/styles.module.css +3 -3
- package/src/fieldset/FieldSet.stories.tsx +45 -0
- package/src/fieldset/FieldSet.tsx +3 -3
- package/src/filters/Filters.stories.tsx +45 -0
- package/src/filters/Filters.tsx +116 -116
- package/src/filters/styles.module.css +26 -26
- package/src/footer/Footer.stories.tsx +127 -0
- package/src/footer/Footer.tsx +81 -76
- package/src/footer/styles.module.css +103 -103
- package/src/formFieldCheckboxGroup/FormFieldCheckboxGroup.stories.tsx +48 -0
- package/src/formFieldCheckboxGroup/FormFieldCheckboxGroup.tsx +16 -16
- package/src/formFieldCheckboxGroup/styles.module.css +5 -5
- package/src/formFieldCheckboxOption/FormFieldCheckboxOption.stories.tsx +61 -0
- package/src/formFieldCheckboxOption/FormFieldCheckboxOption.tsx +26 -26
- package/src/formFieldCheckboxOption/styles.module.css +22 -22
- package/src/formFieldLabel/FormFieldLabel.stories.tsx +21 -0
- package/src/formFieldLabel/FormFieldLabel.tsx +23 -23
- package/src/formFieldRadioGroup/FormFieldRadioGroup.stories.tsx +57 -0
- package/src/formFieldRadioGroup/FormFieldRadioGroup.tsx +13 -13
- package/src/formFieldRadioGroup/styles.module.css +5 -5
- package/src/formFieldRadioOption/FormFieldRadioOption.stories.tsx +48 -0
- package/src/formFieldRadioOption/FormFieldRadioOption.tsx +75 -75
- package/src/formFieldRadioOption/styles.module.css +49 -49
- package/src/formFieldSwitch/FormFieldSwitch.stories.tsx +61 -0
- package/src/formFieldSwitch/FormFieldSwitch.tsx +82 -79
- package/src/formFieldSwitch/styles.module.css +32 -32
- package/src/formFieldTextInput/FormFieldTextInput.stories.tsx +45 -0
- package/src/formFieldTextInput/FormFieldTextInput.tsx +3 -3
- package/src/grid/Grid.stories.tsx +37 -0
- package/src/grid/Grid.tsx +48 -0
- package/src/grid/styles.module.css +24 -0
- package/src/header/Header.stories.tsx +54 -0
- package/src/header/Header.tsx +137 -137
- package/src/header/styles.module.css +71 -71
- package/src/heading/Heading.stories.tsx +60 -0
- package/src/heading/Heading.tsx +15 -15
- package/src/headingGroup/HeadingGroup.stories.tsx +57 -0
- package/src/headingGroup/HeadingGroup.tsx +48 -48
- package/src/headingGroup/styles.module.css +3 -3
- package/src/i18n.ts +24 -25
- package/src/iconBadge/IconBadge.stories.tsx +46 -0
- package/src/iconBadge/IconBadge.tsx +35 -35
- package/src/iconBadge/getAppearance.ts +53 -53
- package/src/iconBadge/styles.module.css +19 -19
- package/src/iconsSprite/Icon.stories.tsx +73 -0
- package/src/iconsSprite/Icon.tsx +17 -17
- package/src/iconsSprite/IconsSprite.tsx +5 -5
- package/src/index.ts +117 -107
- package/src/infoButton/InfoButton.stories.tsx +52 -0
- package/src/infoButton/InfoButton.tsx +45 -45
- package/src/infoButton/styles.module.css +43 -43
- package/src/link/Link.stories.tsx +49 -0
- package/src/link/Link.tsx +10 -10
- package/src/markdown/Markdown.stories.tsx +48 -0
- package/src/markdown/Markdown.tsx +42 -42
- package/src/overlay/Overlay.stories.tsx +38 -0
- package/src/overlay/Overlay.tsx +18 -18
- package/src/overlay/styles.module.css +15 -15
- package/src/pagination/Pagination.stories.tsx +91 -0
- package/src/pagination/Pagination.tsx +267 -267
- package/src/pagination/styles.module.css +28 -28
- package/src/paragraph/Paragraph.stories.tsx +45 -0
- package/src/paragraph/Paragraph.tsx +24 -24
- package/src/paragraph/styles.module.css +6 -6
- package/src/pillBadge/PillBadge.examples.tsx +107 -107
- package/src/pillBadge/PillBadge.stories.tsx +257 -0
- package/src/pillBadge/PillBadge.tsx +60 -51
- package/src/pillBadge/styles.module.css +214 -214
- package/src/readOnlyTextInput/ReadOnlyTextInput.stories.tsx +49 -0
- package/src/readOnlyTextInput/ReadOnlyTextInput.tsx +24 -24
- package/src/readOnlyTextInput/styles.module.css +19 -19
- package/src/scoreBadge/ScoreBadge.stories.tsx +45 -0
- package/src/scoreBadge/ScoreBadge.tsx +135 -133
- package/src/search/Search.stories.tsx +65 -0
- package/src/search/Search.tsx +82 -82
- package/src/search/styles.module.css +40 -39
- package/src/siteLogo/ExampleLogo.stories.tsx +40 -0
- package/src/siteLogo/SiteLogo.stories.tsx +28 -0
- package/src/siteLogo/SiteLogo.tsx +24 -24
- package/src/sortForm/SortForm.stories.tsx +111 -0
- package/src/sortForm/SortForm.tsx +121 -0
- package/src/sortForm/styles.module.css +40 -0
- package/src/switch/Switch.stories.tsx +68 -0
- package/src/switch/Switch.tsx +152 -86
- package/src/switch/styles.module.css +54 -7
- package/src/toolTip/ToolTip.stories.tsx +131 -0
- package/src/toolTip/ToolTip.tsx +55 -55
- package/src/toolTip/styles.module.css +49 -49
- package/src/topNavigation/TopNavigation.stories.tsx +71 -0
- package/src/topNavigation/TopNavigation.tsx +67 -67
- package/src/topNavigation/styles.module.css +54 -54
- package/tsconfig.json +122 -121
|
@@ -1,110 +1,110 @@
|
|
|
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
|
-
.wrap {
|
|
27
|
-
flex-wrap: wrap;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.left {
|
|
31
|
-
align-items: center;
|
|
32
|
-
justify-content: flex-start;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.center,
|
|
36
|
-
.middle {
|
|
37
|
-
align-items: center;
|
|
38
|
-
justify-content: center;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.right {
|
|
42
|
-
align-items: center;
|
|
43
|
-
justify-content: flex-end;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.top {
|
|
47
|
-
align-items: flex-start;
|
|
48
|
-
justify-content: center;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.bottom {
|
|
52
|
-
align-items: flex-end;
|
|
53
|
-
justify-content: center;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.topLeft {
|
|
57
|
-
align-items: flex-start;
|
|
58
|
-
justify-content: flex-start;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.topRight {
|
|
62
|
-
align-items: flex-start;
|
|
63
|
-
justify-content: flex-end;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.bottomLeft {
|
|
67
|
-
align-items: flex-end;
|
|
68
|
-
justify-content: flex-start;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.bottomRight {
|
|
72
|
-
align-items: flex-end;
|
|
73
|
-
justify-content: flex-end;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.stretch {
|
|
77
|
-
align-items: stretch;
|
|
78
|
-
justify-content: stretch;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.spaceBetween {
|
|
82
|
-
align-items: center;
|
|
83
|
-
justify-content: space-between;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.spaceAround {
|
|
87
|
-
align-items: center;
|
|
88
|
-
justify-content: space-around;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.spaceEvenly {
|
|
92
|
-
align-items: center;
|
|
93
|
-
justify-content: space-evenly;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.gapNone {
|
|
97
|
-
gap: 0;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.gapSmall {
|
|
101
|
-
gap: 0.5rem;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.gapMedium {
|
|
105
|
-
gap: 1rem;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.gapLarge {
|
|
109
|
-
gap: 2rem;
|
|
110
|
-
}
|
|
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
|
+
.wrap {
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.left {
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: flex-start;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.center,
|
|
36
|
+
.middle {
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.right {
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: flex-end;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.top {
|
|
47
|
+
align-items: flex-start;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.bottom {
|
|
52
|
+
align-items: flex-end;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.topLeft {
|
|
57
|
+
align-items: flex-start;
|
|
58
|
+
justify-content: flex-start;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.topRight {
|
|
62
|
+
align-items: flex-start;
|
|
63
|
+
justify-content: flex-end;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.bottomLeft {
|
|
67
|
+
align-items: flex-end;
|
|
68
|
+
justify-content: flex-start;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.bottomRight {
|
|
72
|
+
align-items: flex-end;
|
|
73
|
+
justify-content: flex-end;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.stretch {
|
|
77
|
+
align-items: stretch;
|
|
78
|
+
justify-content: stretch;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.spaceBetween {
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: space-between;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.spaceAround {
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: space-around;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.spaceEvenly {
|
|
92
|
+
align-items: center;
|
|
93
|
+
justify-content: space-evenly;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.gapNone {
|
|
97
|
+
gap: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.gapSmall {
|
|
101
|
+
gap: 0.5rem;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.gapMedium {
|
|
105
|
+
gap: 1rem;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.gapLarge {
|
|
109
|
+
gap: 2rem;
|
|
110
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import AmountLabel from "./AmountLabel";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Toont een label met optioneel een aantal tussen haakjes, bijvoorbeeld
|
|
6
|
+
* "Kadaster (12)". Wordt onder andere gebruikt als label voor filteropties
|
|
7
|
+
* (checkboxes, radio's en switches) om het aantal resultaten te tonen.
|
|
8
|
+
*/
|
|
9
|
+
const meta = {
|
|
10
|
+
title: "Components/Form/FormFieldParts/AmountLabel",
|
|
11
|
+
component: AmountLabel,
|
|
12
|
+
tags: ["autodocs", "custom"],
|
|
13
|
+
args: {
|
|
14
|
+
label: "API's",
|
|
15
|
+
amount: 12,
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof AmountLabel>;
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {};
|
|
23
|
+
|
|
24
|
+
export const WithoutAmount: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
amount: undefined,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import styles from "./styles.module.css";
|
|
3
|
-
|
|
4
|
-
export interface AmountLabelProps {
|
|
5
|
-
label
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import styles from "./styles.module.css";
|
|
3
|
+
|
|
4
|
+
export interface AmountLabelProps {
|
|
5
|
+
/** The text or content of the label. */
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
/** Optional amount, shown between brackets: `(` and `)`. */
|
|
8
|
+
amount?: string | number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Shows a label with optional a amount between brackets
|
|
13
|
+
*/
|
|
14
|
+
const AmountLabel = ({ label, amount }: AmountLabelProps) => (
|
|
15
|
+
<div className={styles.amountLabel}>
|
|
16
|
+
<span className={styles.labelText}>{label}</span>
|
|
17
|
+
{amount ? <span className={styles.amountText}>({amount})</span> : null}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export default AmountLabel;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
.amountLabel {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.labelText {
|
|
6
|
-
word-break: break-word;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.amountText {
|
|
10
|
-
font-size: smaller;
|
|
11
|
-
}
|
|
1
|
+
.amountLabel {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.labelText {
|
|
6
|
+
word-break: break-word;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.amountText {
|
|
10
|
+
font-size: smaller;
|
|
11
|
+
}
|
|
@@ -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
|
+
}
|
package/src/analytics/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as PiwikPro } from "./PiwikPro";
|
|
1
|
+
export { default as PiwikPro } from "./PiwikPro";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import Article from "./Article";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Dit component is er om de breedte van de inhoud ervan te beperken tot de ideale lees-lengte.
|
|
6
|
+
* Het rendert een HTML `<article>`-element.
|
|
7
|
+
*/
|
|
8
|
+
const meta = {
|
|
9
|
+
title: "Components/Article",
|
|
10
|
+
component: Article,
|
|
11
|
+
tags: ["autodocs", "re-export"],
|
|
12
|
+
args: {
|
|
13
|
+
children: "Dit is de inhoud van het artikel.",
|
|
14
|
+
},
|
|
15
|
+
} satisfies Meta<typeof Article>;
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {};
|
|
21
|
+
|
|
22
|
+
export const LongText: Story = {
|
|
23
|
+
name: "Lange tekst (toont de leesbreedte)",
|
|
24
|
+
args: {
|
|
25
|
+
children: (
|
|
26
|
+
<>
|
|
27
|
+
<p>
|
|
28
|
+
Het API-register is de centrale plek waar overheidsorganisaties hun
|
|
29
|
+
API's registreren, zodat andere overheden, bedrijven en burgers
|
|
30
|
+
eenvoudig kunnen ontdekken welke API's beschikbaar zijn. Door
|
|
31
|
+
API's te registreren, wordt het makkelijker om hergebruik van
|
|
32
|
+
gegevens en functionaliteit te stimuleren, in plaats van dat iedere
|
|
33
|
+
organisatie het wiel opnieuw uitvindt.
|
|
34
|
+
</p>
|
|
35
|
+
<p>
|
|
36
|
+
Elke registratie bevat onder andere de OAS-specificatie, contact- en
|
|
37
|
+
beheerinformatie, de levensfase van de API (bijvoorbeeld actief,
|
|
38
|
+
verouderd of uit gebruik genomen) en een verwijzing naar de
|
|
39
|
+
organisatie die de API beheert. Hierdoor kunnen ontwikkelaars snel
|
|
40
|
+
inschatten of een API geschikt is voor hun toepassing, zonder eerst
|
|
41
|
+
contact te hoeven opnemen met de beherende organisatie.
|
|
42
|
+
</p>
|
|
43
|
+
<p>
|
|
44
|
+
Dit component beperkt de breedte van zijn inhoud tot een ideale
|
|
45
|
+
lees-lengte, ongeacht hoeveel tekst er wordt doorgegeven. Zo blijft
|
|
46
|
+
een lange, doorlopende tekst goed leesbaar op elk schermformaat, in
|
|
47
|
+
plaats van dat regels over de volledige breedte van een breed scherm
|
|
48
|
+
uitrekken.
|
|
49
|
+
</p>
|
|
50
|
+
</>
|
|
51
|
+
),
|
|
52
|
+
},
|
|
53
|
+
};
|
package/src/article/Article.tsx
CHANGED
|
@@ -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,34 +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
|
-
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
|
+
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;
|