@developer-overheid-nl/don-register-components 1.0.0 → 1.0.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 (61) hide show
  1. package/LICENSE.md +291 -291
  2. package/README.md +20 -20
  3. package/package.json +1 -1
  4. package/src/alert/Alert.tsx +19 -19
  5. package/src/alert/styles.module.css +3 -3
  6. package/src/alignBox/AlignBox.tsx +110 -110
  7. package/src/alignBox/styles.module.css +106 -106
  8. package/src/article/Article.tsx +10 -10
  9. package/src/block/Block.tsx +35 -35
  10. package/src/block/styles.module.css +29 -29
  11. package/src/button/Button.tsx +3 -3
  12. package/src/cardAsLink/CardAsLink.tsx +21 -21
  13. package/src/cardAsLink/styles.module.css +23 -23
  14. package/src/cardsList/CardsList.tsx +54 -54
  15. package/src/cardsList/styles.module.css +19 -19
  16. package/src/client.ts +2 -2
  17. package/src/container/Container.tsx +10 -10
  18. package/src/container/styles.module.css +28 -28
  19. package/src/copyButton/CopyButton.tsx +39 -39
  20. package/src/copyButton/styles.module.css +13 -13
  21. package/src/dataBadgeLink/DataBadgeLink.tsx +50 -50
  22. package/src/dataBadgeLink/styles.module.css +43 -43
  23. package/src/dataSummary/DataSummary.tsx +22 -22
  24. package/src/dataSummary/DataSummaryItem.tsx +21 -21
  25. package/src/dataSummary/styles.module.css +70 -70
  26. package/src/fieldset/FieldSet.tsx +3 -3
  27. package/src/filters/Filters.tsx +115 -115
  28. package/src/filters/styles.module.css +26 -26
  29. package/src/footer/Footer.tsx +76 -76
  30. package/src/footer/styles.module.css +103 -103
  31. package/src/formFieldLabel/FormFieldLabel.tsx +23 -23
  32. package/src/formFieldTextInput/FormFieldTextInput.tsx +3 -3
  33. package/src/header/Header.tsx +137 -137
  34. package/src/header/styles.module.css +71 -71
  35. package/src/heading/Heading.tsx +10 -10
  36. package/src/headingGroup/HeadingGroup.tsx +48 -48
  37. package/src/headingGroup/styles.module.css +3 -3
  38. package/src/i18n.ts +24 -24
  39. package/src/iconBadge/IconBadge.tsx +32 -32
  40. package/src/iconBadge/getAppearance.ts +47 -47
  41. package/src/iconBadge/styles.module.css +19 -19
  42. package/src/iconsSprite/Icon.tsx +17 -17
  43. package/src/iconsSprite/IconsSprite.tsx +5 -5
  44. package/src/index.ts +80 -80
  45. package/src/link/Link.tsx +10 -10
  46. package/src/markdown/Markdown.tsx +42 -42
  47. package/src/pagination/Pagination.tsx +144 -144
  48. package/src/pagination/styles.module.css +13 -13
  49. package/src/paragraph/Paragraph.tsx +10 -10
  50. package/src/pillBadge/PillBadge.examples.tsx +107 -107
  51. package/src/pillBadge/PillBadge.tsx +51 -51
  52. package/src/pillBadge/styles.module.css +194 -194
  53. package/src/readOnlyTextInput/ReadOnlyTextInput.tsx +24 -24
  54. package/src/readOnlyTextInput/styles.module.css +19 -19
  55. package/src/scoreBadge/ScoreBadge.tsx +132 -132
  56. package/src/search/Search.tsx +66 -66
  57. package/src/search/styles.module.css +39 -39
  58. package/src/siteLogo/SiteLogo.tsx +24 -24
  59. package/src/topNavigation/TopNavigation.tsx +67 -64
  60. package/src/topNavigation/styles.module.css +54 -54
  61. package/tsconfig.json +121 -121
@@ -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
+ }
@@ -1,144 +1,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
- interface PageLinkProps
8
- extends Omit<
9
- HTMLAttributes<HTMLAnchorElement> & HTMLAttributes<HTMLSpanElement>,
10
- "onAbort"
11
- > {
12
- href: string;
13
- label: number | string;
14
- range?: [number, number];
15
- index: number;
16
- current: number;
17
- }
18
-
19
- interface RelativeLinkProps extends HTMLAttributes<HTMLAnchorElement> {
20
- href: string;
21
- position: "prev" | "next";
22
- }
23
-
24
- export interface PaginationProps extends HTMLAttributes<HTMLElement> {
25
- links: Array<{
26
- href: PageLinkProps["href"];
27
- label: PageLinkProps["label"];
28
- /** Range of shown items on this page; [begin, end] */
29
- range?: PageLinkProps["range"];
30
- }>;
31
- current?: PageLinkProps["current"];
32
- prev?: string | false;
33
- next?: string | false;
34
- className?: string;
35
- }
36
-
37
- const PageLink = (props: PageLinkProps) => {
38
- const { t } = useTranslation();
39
- const { href, label, range, index, current, ...restProps } = props;
40
- const isCurrent = index === current;
41
- const element = !isCurrent ? "a" : "span";
42
- const hrefAttr = !isCurrent && { href };
43
- const count =
44
- (range && (range[0] === range[1] ? 1 : range[1] - range[0])) || 0;
45
-
46
- const Element = element as ElementType<
47
- HTMLAttributes<HTMLAnchorElement | HTMLSpanElement>
48
- >;
49
-
50
- return (
51
- <Element
52
- className={clsx(
53
- "utrecht-pagination__page-link",
54
- isCurrent && "utrecht-pagination__page-link--current",
55
- )}
56
- {...hrefAttr}
57
- aria-current={isCurrent}
58
- aria-label={
59
- range && t(`components.page-and-results-range`, { label, range, count })
60
- }
61
- title={range && t(`components.results-range`, { range, count })}
62
- {...restProps}
63
- >
64
- {label}
65
- </Element>
66
- );
67
- };
68
-
69
- const RelativeLink = (props: RelativeLinkProps) => {
70
- const { t } = useTranslation();
71
- const { href, position } = props;
72
-
73
- return (
74
- <a
75
- href={href}
76
- className={clsx(
77
- "utrecht-pagination__relative-link",
78
- "utrecht-pagination__relative-link--disabled",
79
- `utrecht-pagination__relative-link--${position}`,
80
- )}
81
- rel={position}
82
- >
83
- {t(`components.${position}`)}
84
- </a>
85
- );
86
- };
87
-
88
- const Pagination = (props: PropsWithChildren<PaginationProps>) => {
89
- const { t } = useTranslation();
90
- const { links, current = 0, prev, next, className } = props;
91
-
92
- return (
93
- <nav
94
- className={clsx(
95
- "utrecht-pagination",
96
- "utrecht-pagination--distanced",
97
- styles.pagination,
98
- className,
99
- )}
100
- aria-label={t("components.pagination-landmark")}
101
- >
102
- {prev && (
103
- <span className="utrecht-pagination__before">
104
- <RelativeLink href={String(prev)} position="prev" />
105
- </span>
106
- )}
107
- {/* biome-ignore-start lint/a11y/useSemanticElements: taken from NLDS example */}
108
- <span
109
- role="group"
110
- aria-label={t("components.pages")}
111
- className="utrecht-pagination__pages"
112
- >
113
- {/* biome-ignore-end lint/a11y/useSemanticElements: taken from NLDS example */}
114
- {links &&
115
- links.length > 0 &&
116
- links.map(({ href, label, range }, index) => (
117
- <PageLink
118
- href={href}
119
- label={label}
120
- range={range}
121
- index={index}
122
- current={current}
123
- key={label}
124
- />
125
- ))}
126
- </span>
127
- {next && (
128
- <span className="utrecht-pagination__after">
129
- <RelativeLink href={String(next)} position="next" />
130
- </span>
131
- )}
132
- </nav>
133
- );
134
- };
135
-
136
- const TranslatedPagination = (props: PaginationProps) => {
137
- return (
138
- <I18nextProvider i18n={i18n}>
139
- <Pagination {...props} />
140
- </I18nextProvider>
141
- );
142
- };
143
-
144
- export default TranslatedPagination;
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
+ interface PageLinkProps
8
+ extends Omit<
9
+ HTMLAttributes<HTMLAnchorElement> & HTMLAttributes<HTMLSpanElement>,
10
+ "onAbort"
11
+ > {
12
+ href: string;
13
+ label: number | string;
14
+ range?: [number, number];
15
+ index: number;
16
+ current: number;
17
+ }
18
+
19
+ interface RelativeLinkProps extends HTMLAttributes<HTMLAnchorElement> {
20
+ href: string;
21
+ position: "prev" | "next";
22
+ }
23
+
24
+ export interface PaginationProps extends HTMLAttributes<HTMLElement> {
25
+ links: Array<{
26
+ href: PageLinkProps["href"];
27
+ label: PageLinkProps["label"];
28
+ /** Range of shown items on this page; [begin, end] */
29
+ range?: PageLinkProps["range"];
30
+ }>;
31
+ current?: PageLinkProps["current"];
32
+ prev?: string | false;
33
+ next?: string | false;
34
+ className?: string;
35
+ }
36
+
37
+ const PageLink = (props: PageLinkProps) => {
38
+ const { t } = useTranslation();
39
+ const { href, label, range, index, current, ...restProps } = props;
40
+ const isCurrent = index === current;
41
+ const element = !isCurrent ? "a" : "span";
42
+ const hrefAttr = !isCurrent && { href };
43
+ const count =
44
+ (range && (range[0] === range[1] ? 1 : range[1] - range[0])) || 0;
45
+
46
+ const Element = element as ElementType<
47
+ HTMLAttributes<HTMLAnchorElement | HTMLSpanElement>
48
+ >;
49
+
50
+ return (
51
+ <Element
52
+ className={clsx(
53
+ "utrecht-pagination__page-link",
54
+ isCurrent && "utrecht-pagination__page-link--current",
55
+ )}
56
+ {...hrefAttr}
57
+ aria-current={isCurrent}
58
+ aria-label={
59
+ range && t(`components.page-and-results-range`, { label, range, count })
60
+ }
61
+ title={range && t(`components.results-range`, { range, count })}
62
+ {...restProps}
63
+ >
64
+ {label}
65
+ </Element>
66
+ );
67
+ };
68
+
69
+ const RelativeLink = (props: RelativeLinkProps) => {
70
+ const { t } = useTranslation();
71
+ const { href, position } = props;
72
+
73
+ return (
74
+ <a
75
+ href={href}
76
+ className={clsx(
77
+ "utrecht-pagination__relative-link",
78
+ "utrecht-pagination__relative-link--disabled",
79
+ `utrecht-pagination__relative-link--${position}`,
80
+ )}
81
+ rel={position}
82
+ >
83
+ {t(`components.${position}`)}
84
+ </a>
85
+ );
86
+ };
87
+
88
+ const Pagination = (props: PropsWithChildren<PaginationProps>) => {
89
+ const { t } = useTranslation();
90
+ const { links, current = 0, prev, next, className } = props;
91
+
92
+ return (
93
+ <nav
94
+ className={clsx(
95
+ "utrecht-pagination",
96
+ "utrecht-pagination--distanced",
97
+ styles.pagination,
98
+ className,
99
+ )}
100
+ aria-label={t("components.pagination-landmark")}
101
+ >
102
+ {prev && (
103
+ <span className="utrecht-pagination__before">
104
+ <RelativeLink href={String(prev)} position="prev" />
105
+ </span>
106
+ )}
107
+ {/* biome-ignore-start lint/a11y/useSemanticElements: taken from NLDS example */}
108
+ <span
109
+ role="group"
110
+ aria-label={t("components.pages")}
111
+ className="utrecht-pagination__pages"
112
+ >
113
+ {/* biome-ignore-end lint/a11y/useSemanticElements: taken from NLDS example */}
114
+ {links &&
115
+ links.length > 0 &&
116
+ links.map(({ href, label, range }, index) => (
117
+ <PageLink
118
+ href={href}
119
+ label={label}
120
+ range={range}
121
+ index={index}
122
+ current={current}
123
+ key={label}
124
+ />
125
+ ))}
126
+ </span>
127
+ {next && (
128
+ <span className="utrecht-pagination__after">
129
+ <RelativeLink href={String(next)} position="next" />
130
+ </span>
131
+ )}
132
+ </nav>
133
+ );
134
+ };
135
+
136
+ const TranslatedPagination = (props: PaginationProps) => {
137
+ return (
138
+ <I18nextProvider i18n={i18n}>
139
+ <Pagination {...props} />
140
+ </I18nextProvider>
141
+ );
142
+ };
143
+
144
+ export default TranslatedPagination;
@@ -1,13 +1,13 @@
1
- .pagination {
2
- text-align: center;
3
- }
4
-
5
- :global(
6
- .utrecht-pagination__page-link.utrecht-pagination__page-link--current:hover
7
- ) {
8
- color: var(--utrecht-pagination-page-link-current-color);
9
- background-color: var(
10
- --utrecht-pagination-page-link-current-background-color
11
- );
12
- border-color: var(--utrecht-pagination-page-link-current-border-color);
13
- }
1
+ .pagination {
2
+ text-align: center;
3
+ }
4
+
5
+ :global(
6
+ .utrecht-pagination__page-link.utrecht-pagination__page-link--current:hover
7
+ ) {
8
+ color: var(--utrecht-pagination-page-link-current-color);
9
+ background-color: var(
10
+ --utrecht-pagination-page-link-current-background-color
11
+ );
12
+ border-color: var(--utrecht-pagination-page-link-current-border-color);
13
+ }
@@ -1,10 +1,10 @@
1
- import {
2
- type ParagraphProps,
3
- Paragraph as RHCParagraph,
4
- } from "@rijkshuisstijl-community/components-react";
5
-
6
- const Paragraph = (props: ParagraphProps) => {
7
- return <RHCParagraph {...props} />;
8
- };
9
-
10
- export default Paragraph;
1
+ import {
2
+ type ParagraphProps,
3
+ Paragraph as RHCParagraph,
4
+ } from "@rijkshuisstijl-community/components-react";
5
+
6
+ const Paragraph = (props: ParagraphProps) => {
7
+ return <RHCParagraph {...props} />;
8
+ };
9
+
10
+ export default Paragraph;
@@ -1,107 +1,107 @@
1
- /* Temporary file to showcase PillBadge examples in e.g. Storybook later */
2
-
3
- import Block from "../block/Block";
4
- import PillBadge from "./PillBadge";
5
-
6
- export const PillBadgeExamples = () => {
7
- return (
8
- <Block layout="flex-col">
9
- <PillBadge
10
- startValue="Kleur"
11
- endValue="robijnrood"
12
- type="color"
13
- color="robijnrood"
14
- />
15
- <PillBadge startValue="Kleur" endValue="roze" type="color" color="roze" />
16
- <PillBadge startValue="Kleur" endValue="rood" type="color" color="rood" />
17
- <PillBadge
18
- startValue="Kleur"
19
- endValue="oranje"
20
- type="color"
21
- color="oranje"
22
- />
23
- <PillBadge
24
- startValue="Kleur"
25
- endValue="donkergeel"
26
- type="color"
27
- color="donkergeel"
28
- />
29
- <PillBadge startValue="Kleur" endValue="geel" type="color" color="geel" />
30
- <PillBadge
31
- startValue="Kleur"
32
- endValue="donkergroen"
33
- type="color"
34
- color="donkergroen"
35
- />
36
- <PillBadge
37
- startValue="Kleur"
38
- endValue="groen"
39
- type="color"
40
- color="groen"
41
- />
42
- <PillBadge
43
- startValue="Kleur"
44
- endValue="mosgroen"
45
- type="color"
46
- color="mosgroen"
47
- />
48
- <PillBadge
49
- startValue="Kleur"
50
- endValue="mintgroen"
51
- type="color"
52
- color="mintgroen"
53
- />
54
- <PillBadge
55
- startValue="Kleur"
56
- endValue="donkerblauw"
57
- type="color"
58
- color="donkerblauw"
59
- />
60
- <PillBadge
61
- startValue="Kleur"
62
- endValue="hemelblauw"
63
- type="color"
64
- color="hemelblauw"
65
- />
66
- <PillBadge
67
- startValue="Kleur"
68
- endValue="paars"
69
- type="color"
70
- color="paars"
71
- />
72
- <PillBadge
73
- startValue="Kleur"
74
- endValue="violet"
75
- type="color"
76
- color="violet"
77
- />
78
- <PillBadge
79
- startValue="Kleur"
80
- endValue="lichtblauw"
81
- type="color"
82
- color="lichtblauw"
83
- />
84
- <PillBadge
85
- startValue="Kleur"
86
- endValue="coolgrey"
87
- type="color"
88
- color="coolgrey"
89
- />
90
- <PillBadge startValue="Percentage" endValue="76" type="percentage" />
91
- <PillBadge
92
- startValue="Percentage & Kleur"
93
- endValue="42"
94
- type="percentage"
95
- color="robijnrood"
96
- />
97
- <PillBadge
98
- startValue="Percentage & Kleur"
99
- endValue="21"
100
- type="percentage"
101
- color="rood"
102
- />
103
- </Block>
104
- );
105
- };
106
-
107
- export default PillBadgeExamples;
1
+ /* Temporary file to showcase PillBadge examples in e.g. Storybook later */
2
+
3
+ import Block from "../block/Block";
4
+ import PillBadge from "./PillBadge";
5
+
6
+ export const PillBadgeExamples = () => {
7
+ return (
8
+ <Block layout="flex-col">
9
+ <PillBadge
10
+ startValue="Kleur"
11
+ endValue="robijnrood"
12
+ type="color"
13
+ color="robijnrood"
14
+ />
15
+ <PillBadge startValue="Kleur" endValue="roze" type="color" color="roze" />
16
+ <PillBadge startValue="Kleur" endValue="rood" type="color" color="rood" />
17
+ <PillBadge
18
+ startValue="Kleur"
19
+ endValue="oranje"
20
+ type="color"
21
+ color="oranje"
22
+ />
23
+ <PillBadge
24
+ startValue="Kleur"
25
+ endValue="donkergeel"
26
+ type="color"
27
+ color="donkergeel"
28
+ />
29
+ <PillBadge startValue="Kleur" endValue="geel" type="color" color="geel" />
30
+ <PillBadge
31
+ startValue="Kleur"
32
+ endValue="donkergroen"
33
+ type="color"
34
+ color="donkergroen"
35
+ />
36
+ <PillBadge
37
+ startValue="Kleur"
38
+ endValue="groen"
39
+ type="color"
40
+ color="groen"
41
+ />
42
+ <PillBadge
43
+ startValue="Kleur"
44
+ endValue="mosgroen"
45
+ type="color"
46
+ color="mosgroen"
47
+ />
48
+ <PillBadge
49
+ startValue="Kleur"
50
+ endValue="mintgroen"
51
+ type="color"
52
+ color="mintgroen"
53
+ />
54
+ <PillBadge
55
+ startValue="Kleur"
56
+ endValue="donkerblauw"
57
+ type="color"
58
+ color="donkerblauw"
59
+ />
60
+ <PillBadge
61
+ startValue="Kleur"
62
+ endValue="hemelblauw"
63
+ type="color"
64
+ color="hemelblauw"
65
+ />
66
+ <PillBadge
67
+ startValue="Kleur"
68
+ endValue="paars"
69
+ type="color"
70
+ color="paars"
71
+ />
72
+ <PillBadge
73
+ startValue="Kleur"
74
+ endValue="violet"
75
+ type="color"
76
+ color="violet"
77
+ />
78
+ <PillBadge
79
+ startValue="Kleur"
80
+ endValue="lichtblauw"
81
+ type="color"
82
+ color="lichtblauw"
83
+ />
84
+ <PillBadge
85
+ startValue="Kleur"
86
+ endValue="coolgrey"
87
+ type="color"
88
+ color="coolgrey"
89
+ />
90
+ <PillBadge startValue="Percentage" endValue="76" type="percentage" />
91
+ <PillBadge
92
+ startValue="Percentage & Kleur"
93
+ endValue="42"
94
+ type="percentage"
95
+ color="robijnrood"
96
+ />
97
+ <PillBadge
98
+ startValue="Percentage & Kleur"
99
+ endValue="21"
100
+ type="percentage"
101
+ color="rood"
102
+ />
103
+ </Block>
104
+ );
105
+ };
106
+
107
+ export default PillBadgeExamples;