@developer-overheid-nl/don-register-components 1.2.0 → 1.3.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.
- package/CHANGELOG.md +118 -85
- package/LICENSE.md +291 -291
- package/README.md +20 -20
- package/package.json +2 -2
- package/src/alert/Alert.tsx +19 -19
- package/src/alert/styles.module.css +3 -3
- package/src/alignBox/AlignBox.tsx +114 -114
- package/src/alignBox/styles.module.css +110 -110
- package/src/amountLabel/AmountLabel.tsx +16 -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.tsx +10 -10
- package/src/badgeList/BadgeList.tsx +34 -26
- package/src/badgeList/styles.module.css +37 -24
- package/src/block/Block.tsx +35 -35
- package/src/block/styles.module.css +29 -29
- package/src/button/Button.tsx +3 -3
- package/src/cardAsLink/CardAsLink.tsx +21 -21
- package/src/cardAsLink/styles.module.css +23 -23
- package/src/cardsList/CardsList.tsx +54 -54
- package/src/cardsList/styles.module.css +19 -19
- package/src/client.ts +7 -7
- package/src/container/Container.tsx +10 -10
- package/src/container/styles.module.css +28 -28
- package/src/copyButton/CopyButton.tsx +39 -39
- package/src/copyButton/styles.module.css +13 -13
- package/src/dataBadgeLink/DataBadgeLink.tsx +53 -53
- package/src/dataBadgeLink/styles.module.css +89 -69
- 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.tsx +367 -313
- package/src/facetFilters/styles.module.css +3 -3
- package/src/fieldset/FieldSet.tsx +3 -3
- package/src/filters/Filters.tsx +116 -115
- package/src/filters/styles.module.css +26 -26
- package/src/footer/Footer.tsx +76 -76
- package/src/footer/styles.module.css +103 -103
- package/src/formFieldCheckboxGroup/FormFieldCheckboxGroup.tsx +16 -16
- package/src/formFieldCheckboxGroup/styles.module.css +5 -5
- package/src/formFieldCheckboxOption/FormFieldCheckboxOption.tsx +26 -26
- package/src/formFieldCheckboxOption/styles.module.css +22 -22
- package/src/formFieldLabel/FormFieldLabel.tsx +23 -23
- package/src/formFieldRadioGroup/FormFieldRadioGroup.tsx +13 -13
- package/src/formFieldRadioGroup/styles.module.css +5 -5
- package/src/formFieldRadioOption/FormFieldRadioOption.tsx +75 -75
- package/src/formFieldRadioOption/styles.module.css +49 -49
- package/src/formFieldSwitch/FormFieldSwitch.tsx +79 -79
- package/src/formFieldSwitch/styles.module.css +32 -32
- package/src/formFieldTextInput/FormFieldTextInput.tsx +3 -3
- package/src/header/Header.tsx +137 -137
- package/src/header/styles.module.css +71 -71
- package/src/heading/Heading.tsx +15 -15
- package/src/headingGroup/HeadingGroup.tsx +48 -48
- package/src/headingGroup/styles.module.css +3 -3
- package/src/i18n.ts +25 -25
- 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.tsx +17 -17
- package/src/iconsSprite/IconsSprite.tsx +5 -5
- package/src/index.ts +107 -106
- package/src/infoButton/InfoButton.tsx +45 -45
- package/src/infoButton/styles.module.css +43 -43
- package/src/link/Link.tsx +10 -10
- package/src/markdown/Markdown.tsx +42 -42
- package/src/overlay/Overlay.tsx +18 -18
- package/src/overlay/styles.module.css +15 -15
- package/src/pagination/Pagination.tsx +267 -144
- package/src/pagination/styles.module.css +28 -13
- 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.tsx +51 -51
- package/src/pillBadge/styles.module.css +214 -214
- package/src/readOnlyTextInput/ReadOnlyTextInput.tsx +24 -24
- package/src/readOnlyTextInput/styles.module.css +19 -19
- package/src/scoreBadge/ScoreBadge.tsx +133 -133
- package/src/search/Search.tsx +82 -66
- package/src/search/styles.module.css +39 -39
- package/src/siteLogo/SiteLogo.tsx +24 -24
- package/src/switch/Switch.tsx +86 -86
- package/src/switch/styles.module.css +7 -7
- package/src/toolTip/ToolTip.tsx +55 -55
- package/src/toolTip/styles.module.css +49 -48
- package/src/topNavigation/TopNavigation.tsx +67 -67
- package/src/topNavigation/styles.module.css +54 -54
- package/tsconfig.json +121 -121
package/src/link/Link.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type LinkProps,
|
|
3
|
-
Link as RHCLink,
|
|
4
|
-
} from "@rijkshuisstijl-community/components-react";
|
|
5
|
-
|
|
6
|
-
const Link = (props: LinkProps) => {
|
|
7
|
-
return <RHCLink {...props} />;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default Link;
|
|
1
|
+
import {
|
|
2
|
+
type LinkProps,
|
|
3
|
+
Link as RHCLink,
|
|
4
|
+
} from "@rijkshuisstijl-community/components-react";
|
|
5
|
+
|
|
6
|
+
const Link = (props: LinkProps) => {
|
|
7
|
+
return <RHCLink {...props} />;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default Link;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import ReactMarkdown, { type Components, type Options } from "react-markdown";
|
|
2
|
-
import remarkBehead from "remark-behead";
|
|
3
|
-
|
|
4
|
-
export type HeadingLevels = 0 | 1 | 2 | 3 | 4 | 5;
|
|
5
|
-
export interface MarkdownProps extends Readonly<Options> {
|
|
6
|
-
text?: string;
|
|
7
|
-
openLinksInNewTab?: boolean;
|
|
8
|
-
minHeadingDepth?: HeadingLevels;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default function Markdown(options: MarkdownProps) {
|
|
12
|
-
const {
|
|
13
|
-
children,
|
|
14
|
-
text,
|
|
15
|
-
openLinksInNewTab = false,
|
|
16
|
-
minHeadingDepth = 2,
|
|
17
|
-
...restOptions
|
|
18
|
-
} = options;
|
|
19
|
-
|
|
20
|
-
const mdText = text || (typeof children === "string" ? children : "");
|
|
21
|
-
|
|
22
|
-
const linkAttrs = openLinksInNewTab
|
|
23
|
-
? { target: "_blank", rel: "noopener noreferrer" }
|
|
24
|
-
: {};
|
|
25
|
-
const components: Components = {
|
|
26
|
-
a: ({ node, ...props }) => (
|
|
27
|
-
<a {...props} {...linkAttrs} className="moveAbove" />
|
|
28
|
-
),
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<ReactMarkdown
|
|
33
|
-
/* biome-ignore lint/correctness/noChildrenProp: TODO: make sure other way is works */
|
|
34
|
-
children={mdText}
|
|
35
|
-
components={components}
|
|
36
|
-
skipHtml={true}
|
|
37
|
-
unwrapDisallowed={true}
|
|
38
|
-
remarkPlugins={[[remarkBehead, { minDepth: minHeadingDepth }]]}
|
|
39
|
-
{...restOptions}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
1
|
+
import ReactMarkdown, { type Components, type Options } from "react-markdown";
|
|
2
|
+
import remarkBehead from "remark-behead";
|
|
3
|
+
|
|
4
|
+
export type HeadingLevels = 0 | 1 | 2 | 3 | 4 | 5;
|
|
5
|
+
export interface MarkdownProps extends Readonly<Options> {
|
|
6
|
+
text?: string;
|
|
7
|
+
openLinksInNewTab?: boolean;
|
|
8
|
+
minHeadingDepth?: HeadingLevels;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function Markdown(options: MarkdownProps) {
|
|
12
|
+
const {
|
|
13
|
+
children,
|
|
14
|
+
text,
|
|
15
|
+
openLinksInNewTab = false,
|
|
16
|
+
minHeadingDepth = 2,
|
|
17
|
+
...restOptions
|
|
18
|
+
} = options;
|
|
19
|
+
|
|
20
|
+
const mdText = text || (typeof children === "string" ? children : "");
|
|
21
|
+
|
|
22
|
+
const linkAttrs = openLinksInNewTab
|
|
23
|
+
? { target: "_blank", rel: "noopener noreferrer" }
|
|
24
|
+
: {};
|
|
25
|
+
const components: Components = {
|
|
26
|
+
a: ({ node, ...props }) => (
|
|
27
|
+
<a {...props} {...linkAttrs} className="moveAbove" />
|
|
28
|
+
),
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<ReactMarkdown
|
|
33
|
+
/* biome-ignore lint/correctness/noChildrenProp: TODO: make sure other way is works */
|
|
34
|
+
children={mdText}
|
|
35
|
+
components={components}
|
|
36
|
+
skipHtml={true}
|
|
37
|
+
unwrapDisallowed={true}
|
|
38
|
+
remarkPlugins={[[remarkBehead, { minDepth: minHeadingDepth }]]}
|
|
39
|
+
{...restOptions}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
package/src/overlay/Overlay.tsx
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import styles from "./styles.module.css";
|
|
3
|
-
|
|
4
|
-
const Overlay = ({
|
|
5
|
-
children,
|
|
6
|
-
active,
|
|
7
|
-
}: {
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
active: boolean;
|
|
10
|
-
}) => {
|
|
11
|
-
return (
|
|
12
|
-
<div className={clsx(styles.overlay, active && styles.active)}>
|
|
13
|
-
{children}
|
|
14
|
-
</div>
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default Overlay;
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import styles from "./styles.module.css";
|
|
3
|
+
|
|
4
|
+
const Overlay = ({
|
|
5
|
+
children,
|
|
6
|
+
active,
|
|
7
|
+
}: {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
active: boolean;
|
|
10
|
+
}) => {
|
|
11
|
+
return (
|
|
12
|
+
<div className={clsx(styles.overlay, active && styles.active)}>
|
|
13
|
+
{children}
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default Overlay;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
.overlay {
|
|
2
|
-
display: none;
|
|
3
|
-
|
|
4
|
-
&.active {
|
|
5
|
-
position: absolute;
|
|
6
|
-
top: 0;
|
|
7
|
-
left: -1px;
|
|
8
|
-
z-index: 999;
|
|
9
|
-
display: block;
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: 100%;
|
|
12
|
-
background-color: rgba(255, 255, 255, 0.25);
|
|
13
|
-
backdrop-filter: blur(1px);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
.overlay {
|
|
2
|
+
display: none;
|
|
3
|
+
|
|
4
|
+
&.active {
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 0;
|
|
7
|
+
left: -1px;
|
|
8
|
+
z-index: 999;
|
|
9
|
+
display: block;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
background-color: rgba(255, 255, 255, 0.25);
|
|
13
|
+
backdrop-filter: blur(1px);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,144 +1,267 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import type { ElementType, HTMLAttributes, PropsWithChildren } from "react";
|
|
3
|
-
import { I18nextProvider, useTranslation } from "react-i18next";
|
|
4
|
-
import i18n from "../i18n";
|
|
5
|
-
import styles from "./styles.module.css";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import type { ElementType, HTMLAttributes, PropsWithChildren } from "react";
|
|
3
|
+
import { I18nextProvider, useTranslation } from "react-i18next";
|
|
4
|
+
import i18n from "../i18n";
|
|
5
|
+
import styles from "./styles.module.css";
|
|
6
|
+
|
|
7
|
+
/** @deprecated use only boolean */
|
|
8
|
+
type currentNumber = number;
|
|
9
|
+
interface PageLinkProps
|
|
10
|
+
extends Omit<
|
|
11
|
+
HTMLAttributes<HTMLAnchorElement> & HTMLAttributes<HTMLSpanElement>,
|
|
12
|
+
"onAbort"
|
|
13
|
+
> {
|
|
14
|
+
href: string;
|
|
15
|
+
label: number | string;
|
|
16
|
+
range?: [number, number];
|
|
17
|
+
index: number;
|
|
18
|
+
current: boolean | currentNumber;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface RelativeLinkProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
22
|
+
href: string;
|
|
23
|
+
label?: string | number;
|
|
24
|
+
position: "prev" | "next";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface AbsoluteLinkProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
28
|
+
href: string;
|
|
29
|
+
label?: string | number;
|
|
30
|
+
position: "first" | "last";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface PaginationProps extends HTMLAttributes<HTMLElement> {
|
|
34
|
+
links: Array<{
|
|
35
|
+
href: PageLinkProps["href"];
|
|
36
|
+
label: PageLinkProps["label"];
|
|
37
|
+
current: PageLinkProps["current"];
|
|
38
|
+
/** Range of shown items on this page; [begin, end] */
|
|
39
|
+
range?: PageLinkProps["range"];
|
|
40
|
+
}>;
|
|
41
|
+
first?:
|
|
42
|
+
| {
|
|
43
|
+
href: AbsoluteLinkProps["href"];
|
|
44
|
+
label: AbsoluteLinkProps["label"];
|
|
45
|
+
}
|
|
46
|
+
| false;
|
|
47
|
+
prev?:
|
|
48
|
+
| {
|
|
49
|
+
href: RelativeLinkProps["href"];
|
|
50
|
+
label?: RelativeLinkProps["label"];
|
|
51
|
+
}
|
|
52
|
+
| false;
|
|
53
|
+
ellipsisBefore?: boolean;
|
|
54
|
+
current?: PageLinkProps["current"];
|
|
55
|
+
ellipsisAfter?: boolean;
|
|
56
|
+
next?:
|
|
57
|
+
| {
|
|
58
|
+
href: RelativeLinkProps["href"];
|
|
59
|
+
label?: RelativeLinkProps["label"];
|
|
60
|
+
}
|
|
61
|
+
| false;
|
|
62
|
+
last?:
|
|
63
|
+
| {
|
|
64
|
+
href: AbsoluteLinkProps["href"];
|
|
65
|
+
label: AbsoluteLinkProps["label"];
|
|
66
|
+
}
|
|
67
|
+
| false;
|
|
68
|
+
className?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const PageLink = (props: PageLinkProps) => {
|
|
72
|
+
const { t } = useTranslation();
|
|
73
|
+
const { href, label, range, index, current, ...restProps } = props;
|
|
74
|
+
const isCurrent = typeof current === "boolean" ? current : index === current;
|
|
75
|
+
const element = !isCurrent ? "a" : "span";
|
|
76
|
+
const hrefAttr = !isCurrent && { href };
|
|
77
|
+
const count =
|
|
78
|
+
(range && (range[0] === range[1] ? 1 : range[1] - range[0])) || 0;
|
|
79
|
+
|
|
80
|
+
const Element = element as ElementType<
|
|
81
|
+
HTMLAttributes<HTMLAnchorElement | HTMLSpanElement>
|
|
82
|
+
>;
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Element
|
|
86
|
+
className={clsx(
|
|
87
|
+
"utrecht-pagination__page-link",
|
|
88
|
+
isCurrent && "utrecht-pagination__page-link--current",
|
|
89
|
+
)}
|
|
90
|
+
{...hrefAttr}
|
|
91
|
+
aria-current={isCurrent}
|
|
92
|
+
aria-label={
|
|
93
|
+
range && t(`components.page-and-results-range`, { label, range, count })
|
|
94
|
+
}
|
|
95
|
+
title={range && t(`components.results-range`, { range, count })}
|
|
96
|
+
{...restProps}
|
|
97
|
+
>
|
|
98
|
+
{label}
|
|
99
|
+
</Element>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const RelativeLink = (props: RelativeLinkProps) => {
|
|
104
|
+
const { t } = useTranslation();
|
|
105
|
+
const { href, label, position } = props;
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<a
|
|
109
|
+
href={href}
|
|
110
|
+
className={clsx(
|
|
111
|
+
"utrecht-pagination__relative-link",
|
|
112
|
+
`utrecht-pagination__relative-link--${position}`,
|
|
113
|
+
)}
|
|
114
|
+
rel={position}
|
|
115
|
+
aria-label={t(`components.position-page`, {
|
|
116
|
+
position,
|
|
117
|
+
label,
|
|
118
|
+
context: label ? "with-label" : undefined,
|
|
119
|
+
})}
|
|
120
|
+
title={t(`components.position-page`, {
|
|
121
|
+
position,
|
|
122
|
+
label,
|
|
123
|
+
context: label ? "with-label" : undefined,
|
|
124
|
+
})}
|
|
125
|
+
>
|
|
126
|
+
{t(`components.${position}`)}
|
|
127
|
+
</a>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const AbsoluteLink = (props: AbsoluteLinkProps) => {
|
|
132
|
+
const { t } = useTranslation();
|
|
133
|
+
const { href, label, position } = props;
|
|
134
|
+
|
|
135
|
+
const cssPositions = {
|
|
136
|
+
first: "prev",
|
|
137
|
+
last: "next",
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<a
|
|
142
|
+
href={href}
|
|
143
|
+
className={clsx(
|
|
144
|
+
"utrecht-pagination__page-link",
|
|
145
|
+
`utrecht-pagination__relative-link--${cssPositions[position]}`,
|
|
146
|
+
)}
|
|
147
|
+
rel={position}
|
|
148
|
+
aria-label={t(`components.position-page`, {
|
|
149
|
+
position,
|
|
150
|
+
label,
|
|
151
|
+
context: label ? "with-label" : undefined,
|
|
152
|
+
})}
|
|
153
|
+
title={t(`components.position-page`, { position })}
|
|
154
|
+
>
|
|
155
|
+
{label}
|
|
156
|
+
</a>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const Ellipsis = ({ position }: { position: "prev" | "next" }) => {
|
|
161
|
+
return (
|
|
162
|
+
<span
|
|
163
|
+
className={clsx(
|
|
164
|
+
styles.pagination__ellipsis,
|
|
165
|
+
`utrecht-pagination__relative-link--${position}`,
|
|
166
|
+
)}
|
|
167
|
+
aria-hidden="true"
|
|
168
|
+
>
|
|
169
|
+
…
|
|
170
|
+
</span>
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const Pagination = (props: PropsWithChildren<PaginationProps>) => {
|
|
175
|
+
const { t } = useTranslation();
|
|
176
|
+
const {
|
|
177
|
+
links,
|
|
178
|
+
first,
|
|
179
|
+
prev,
|
|
180
|
+
ellipsisBefore,
|
|
181
|
+
ellipsisAfter,
|
|
182
|
+
next,
|
|
183
|
+
last,
|
|
184
|
+
className,
|
|
185
|
+
} = props;
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<nav
|
|
189
|
+
className={clsx(
|
|
190
|
+
"utrecht-pagination",
|
|
191
|
+
"utrecht-pagination--distanced",
|
|
192
|
+
styles.pagination,
|
|
193
|
+
className,
|
|
194
|
+
)}
|
|
195
|
+
aria-label={t("components.pagination-landmark")}
|
|
196
|
+
>
|
|
197
|
+
{prev && (
|
|
198
|
+
<span className="utrecht-pagination__before">
|
|
199
|
+
<RelativeLink
|
|
200
|
+
href={String(prev.href)}
|
|
201
|
+
label={prev.label}
|
|
202
|
+
position="prev"
|
|
203
|
+
/>
|
|
204
|
+
</span>
|
|
205
|
+
)}
|
|
206
|
+
{first && (
|
|
207
|
+
<span className="utrecht-pagination__before">
|
|
208
|
+
<AbsoluteLink
|
|
209
|
+
href={String(first.href)}
|
|
210
|
+
label={first.label}
|
|
211
|
+
position="first"
|
|
212
|
+
/>
|
|
213
|
+
{ellipsisBefore && <Ellipsis position="prev" />}
|
|
214
|
+
</span>
|
|
215
|
+
)}
|
|
216
|
+
{/* biome-ignore-start lint/a11y/useSemanticElements: taken from NLDS example */}
|
|
217
|
+
<span
|
|
218
|
+
role="group"
|
|
219
|
+
aria-label={t("components.pages")}
|
|
220
|
+
className="utrecht-pagination__pages"
|
|
221
|
+
>
|
|
222
|
+
{/* biome-ignore-end lint/a11y/useSemanticElements: taken from NLDS example */}
|
|
223
|
+
{links &&
|
|
224
|
+
links.length > 0 &&
|
|
225
|
+
links.map(({ href, label, range, current }, index) => (
|
|
226
|
+
<PageLink
|
|
227
|
+
href={href}
|
|
228
|
+
label={label}
|
|
229
|
+
range={range}
|
|
230
|
+
index={index}
|
|
231
|
+
current={current}
|
|
232
|
+
key={label}
|
|
233
|
+
/>
|
|
234
|
+
))}
|
|
235
|
+
</span>
|
|
236
|
+
{last && (
|
|
237
|
+
<span className="utrecht-pagination__after">
|
|
238
|
+
{ellipsisAfter && <Ellipsis position="next" />}
|
|
239
|
+
<AbsoluteLink
|
|
240
|
+
href={String(last.href)}
|
|
241
|
+
label={last.label}
|
|
242
|
+
position="last"
|
|
243
|
+
/>
|
|
244
|
+
</span>
|
|
245
|
+
)}
|
|
246
|
+
{next && (
|
|
247
|
+
<span className="utrecht-pagination__after">
|
|
248
|
+
<RelativeLink
|
|
249
|
+
href={String(next.href)}
|
|
250
|
+
label={next.label}
|
|
251
|
+
position="next"
|
|
252
|
+
/>
|
|
253
|
+
</span>
|
|
254
|
+
)}
|
|
255
|
+
</nav>
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
const TranslatedPagination = (props: PaginationProps) => {
|
|
260
|
+
return (
|
|
261
|
+
<I18nextProvider i18n={i18n}>
|
|
262
|
+
<Pagination {...props} />
|
|
263
|
+
</I18nextProvider>
|
|
264
|
+
);
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export default TranslatedPagination;
|
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
.pagination {
|
|
2
|
-
text-align: center;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
.pagination {
|
|
2
|
+
text-align: center;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.pagination__ellipsis {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
padding-block-start: var(
|
|
8
|
+
--utrecht-pagination-relative-link-padding-block-start
|
|
9
|
+
);
|
|
10
|
+
padding-block-end: var(--utrecht-pagination-relative-link-padding-block-end);
|
|
11
|
+
padding-inline-start: var(
|
|
12
|
+
--utrecht-pagination-relative-link-padding-inline-start
|
|
13
|
+
);
|
|
14
|
+
padding-inline-end: var(
|
|
15
|
+
--utrecht-pagination-relative-link-padding-inline-end
|
|
16
|
+
);
|
|
17
|
+
color: var(--utrecht-pagination-relative-link-color);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:global(
|
|
21
|
+
.utrecht-pagination__page-link.utrecht-pagination__page-link--current:hover
|
|
22
|
+
) {
|
|
23
|
+
color: var(--utrecht-pagination-page-link-current-color);
|
|
24
|
+
background-color: var(
|
|
25
|
+
--utrecht-pagination-page-link-current-background-color
|
|
26
|
+
);
|
|
27
|
+
border-color: var(--utrecht-pagination-page-link-current-border-color);
|
|
28
|
+
}
|