@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.
Files changed (139) hide show
  1. package/CHANGELOG.md +170 -130
  2. package/LICENSE.md +291 -291
  3. package/README.md +20 -20
  4. package/package.json +10 -6
  5. package/src/Introduction.mdx +31 -0
  6. package/src/alert/Alert.stories.tsx +57 -0
  7. package/src/alert/Alert.tsx +19 -19
  8. package/src/alert/styles.module.css +3 -3
  9. package/src/alignBox/AlignBox.stories.tsx +84 -0
  10. package/src/alignBox/AlignBox.tsx +114 -114
  11. package/src/alignBox/styles.module.css +110 -110
  12. package/src/amountLabel/AmountLabel.stories.tsx +28 -0
  13. package/src/amountLabel/AmountLabel.tsx +21 -16
  14. package/src/amountLabel/styles.module.css +11 -11
  15. package/src/analytics/PiwikPro.tsx +94 -94
  16. package/src/analytics/index.ts +1 -1
  17. package/src/article/Article.stories.tsx +53 -0
  18. package/src/article/Article.tsx +10 -10
  19. package/src/badgeList/BadgeList.tsx +34 -34
  20. package/src/badgeList/styles.module.css +37 -37
  21. package/src/block/Block.stories.tsx +58 -0
  22. package/src/block/Block.tsx +35 -35
  23. package/src/block/styles.module.css +29 -29
  24. package/src/button/Button.stories.tsx +56 -0
  25. package/src/button/Button.tsx +3 -3
  26. package/src/button/ButtonAction.stories.tsx +62 -0
  27. package/src/button/ButtonAction.tsx +51 -0
  28. package/src/cardAsLink/CardAsLink.stories.tsx +81 -0
  29. package/src/cardAsLink/CardAsLink.tsx +21 -21
  30. package/src/cardAsLink/styles.module.css +23 -23
  31. package/src/cardsList/CardsList.tsx +56 -56
  32. package/src/cardsList/styles.module.css +18 -19
  33. package/src/client.ts +7 -7
  34. package/src/container/Container.stories.tsx +21 -0
  35. package/src/container/Container.tsx +10 -10
  36. package/src/container/styles.module.css +28 -28
  37. package/src/copyButton/CopyButton.stories.tsx +41 -0
  38. package/src/copyButton/CopyButton.tsx +45 -39
  39. package/src/copyButton/styles.module.css +13 -13
  40. package/src/dataBadgeLink/DataBadgeLink.stories.tsx +137 -0
  41. package/src/dataBadgeLink/DataBadgeLink.tsx +59 -53
  42. package/src/dataBadgeLink/styles.module.css +89 -89
  43. package/src/dataSummary/DataSummary.tsx +22 -22
  44. package/src/dataSummary/DataSummaryItem.tsx +21 -21
  45. package/src/dataSummary/styles.module.css +75 -75
  46. package/src/facetFilters/FacetFilters.stories.tsx +93 -0
  47. package/src/facetFilters/FacetFilters.tsx +424 -419
  48. package/src/facetFilters/styles.module.css +3 -3
  49. package/src/fieldset/FieldSet.stories.tsx +45 -0
  50. package/src/fieldset/FieldSet.tsx +3 -3
  51. package/src/filters/Filters.stories.tsx +45 -0
  52. package/src/filters/Filters.tsx +116 -116
  53. package/src/filters/styles.module.css +26 -26
  54. package/src/footer/Footer.stories.tsx +127 -0
  55. package/src/footer/Footer.tsx +81 -76
  56. package/src/footer/styles.module.css +103 -103
  57. package/src/formFieldCheckboxGroup/FormFieldCheckboxGroup.stories.tsx +48 -0
  58. package/src/formFieldCheckboxGroup/FormFieldCheckboxGroup.tsx +16 -16
  59. package/src/formFieldCheckboxGroup/styles.module.css +5 -5
  60. package/src/formFieldCheckboxOption/FormFieldCheckboxOption.stories.tsx +61 -0
  61. package/src/formFieldCheckboxOption/FormFieldCheckboxOption.tsx +26 -26
  62. package/src/formFieldCheckboxOption/styles.module.css +22 -22
  63. package/src/formFieldLabel/FormFieldLabel.stories.tsx +21 -0
  64. package/src/formFieldLabel/FormFieldLabel.tsx +23 -23
  65. package/src/formFieldRadioGroup/FormFieldRadioGroup.stories.tsx +57 -0
  66. package/src/formFieldRadioGroup/FormFieldRadioGroup.tsx +13 -13
  67. package/src/formFieldRadioGroup/styles.module.css +5 -5
  68. package/src/formFieldRadioOption/FormFieldRadioOption.stories.tsx +48 -0
  69. package/src/formFieldRadioOption/FormFieldRadioOption.tsx +75 -75
  70. package/src/formFieldRadioOption/styles.module.css +49 -49
  71. package/src/formFieldSwitch/FormFieldSwitch.stories.tsx +61 -0
  72. package/src/formFieldSwitch/FormFieldSwitch.tsx +82 -79
  73. package/src/formFieldSwitch/styles.module.css +32 -32
  74. package/src/formFieldTextInput/FormFieldTextInput.stories.tsx +45 -0
  75. package/src/formFieldTextInput/FormFieldTextInput.tsx +3 -3
  76. package/src/grid/Grid.stories.tsx +37 -0
  77. package/src/grid/Grid.tsx +48 -0
  78. package/src/grid/styles.module.css +24 -0
  79. package/src/header/Header.stories.tsx +54 -0
  80. package/src/header/Header.tsx +137 -137
  81. package/src/header/styles.module.css +71 -71
  82. package/src/heading/Heading.stories.tsx +60 -0
  83. package/src/heading/Heading.tsx +15 -15
  84. package/src/headingGroup/HeadingGroup.stories.tsx +57 -0
  85. package/src/headingGroup/HeadingGroup.tsx +48 -48
  86. package/src/headingGroup/styles.module.css +3 -3
  87. package/src/i18n.ts +24 -25
  88. package/src/iconBadge/IconBadge.stories.tsx +46 -0
  89. package/src/iconBadge/IconBadge.tsx +35 -35
  90. package/src/iconBadge/getAppearance.ts +53 -53
  91. package/src/iconBadge/styles.module.css +19 -19
  92. package/src/iconsSprite/Icon.stories.tsx +73 -0
  93. package/src/iconsSprite/Icon.tsx +17 -17
  94. package/src/iconsSprite/IconsSprite.tsx +5 -5
  95. package/src/index.ts +117 -107
  96. package/src/infoButton/InfoButton.stories.tsx +52 -0
  97. package/src/infoButton/InfoButton.tsx +45 -45
  98. package/src/infoButton/styles.module.css +43 -43
  99. package/src/link/Link.stories.tsx +49 -0
  100. package/src/link/Link.tsx +10 -10
  101. package/src/markdown/Markdown.stories.tsx +48 -0
  102. package/src/markdown/Markdown.tsx +42 -42
  103. package/src/overlay/Overlay.stories.tsx +38 -0
  104. package/src/overlay/Overlay.tsx +18 -18
  105. package/src/overlay/styles.module.css +15 -15
  106. package/src/pagination/Pagination.stories.tsx +91 -0
  107. package/src/pagination/Pagination.tsx +267 -267
  108. package/src/pagination/styles.module.css +28 -28
  109. package/src/paragraph/Paragraph.stories.tsx +45 -0
  110. package/src/paragraph/Paragraph.tsx +24 -24
  111. package/src/paragraph/styles.module.css +6 -6
  112. package/src/pillBadge/PillBadge.examples.tsx +107 -107
  113. package/src/pillBadge/PillBadge.stories.tsx +257 -0
  114. package/src/pillBadge/PillBadge.tsx +60 -51
  115. package/src/pillBadge/styles.module.css +214 -214
  116. package/src/readOnlyTextInput/ReadOnlyTextInput.stories.tsx +49 -0
  117. package/src/readOnlyTextInput/ReadOnlyTextInput.tsx +24 -24
  118. package/src/readOnlyTextInput/styles.module.css +19 -19
  119. package/src/scoreBadge/ScoreBadge.stories.tsx +45 -0
  120. package/src/scoreBadge/ScoreBadge.tsx +135 -133
  121. package/src/search/Search.stories.tsx +65 -0
  122. package/src/search/Search.tsx +82 -82
  123. package/src/search/styles.module.css +40 -39
  124. package/src/siteLogo/ExampleLogo.stories.tsx +40 -0
  125. package/src/siteLogo/SiteLogo.stories.tsx +28 -0
  126. package/src/siteLogo/SiteLogo.tsx +24 -24
  127. package/src/sortForm/SortForm.stories.tsx +111 -0
  128. package/src/sortForm/SortForm.tsx +121 -0
  129. package/src/sortForm/styles.module.css +40 -0
  130. package/src/switch/Switch.stories.tsx +68 -0
  131. package/src/switch/Switch.tsx +152 -86
  132. package/src/switch/styles.module.css +54 -7
  133. package/src/toolTip/ToolTip.stories.tsx +131 -0
  134. package/src/toolTip/ToolTip.tsx +55 -55
  135. package/src/toolTip/styles.module.css +49 -49
  136. package/src/topNavigation/TopNavigation.stories.tsx +71 -0
  137. package/src/topNavigation/TopNavigation.tsx +67 -67
  138. package/src/topNavigation/styles.module.css +54 -54
  139. package/tsconfig.json +122 -121
package/src/index.ts CHANGED
@@ -1,107 +1,117 @@
1
- // Barrel export for all components
2
- export { type AlertProps, default as Alert } from "./alert/Alert";
3
- export { type AlignBoxProps, default as AlignBox } from "./alignBox/AlignBox";
4
- export { default as Article } from "./article/Article";
5
- export {
6
- type BadgeListProps,
7
- default as BadgeList,
8
- } from "./badgeList/BadgeList";
9
- export { type BlockProps, default as Block } from "./block/Block";
10
- export { default as Button } from "./button/Button";
11
- export {
12
- type CardAsLinksProps,
13
- default as CardAsLink,
14
- } from "./cardAsLink/CardAsLink";
15
- export {
16
- CardsListItem,
17
- type CardsListItemProps,
18
- type CardsListProps,
19
- default as CardsList,
20
- } from "./cardsList/CardsList";
21
- export { default as Container } from "./container/Container";
22
- export { default as CopyButton } from "./copyButton/CopyButton"; // client component
23
- export {
24
- type DataBadgeLinkProps,
25
- default as DataBadgeLink,
26
- } from "./dataBadgeLink/DataBadgeLink";
27
- export {
28
- type DataSummaryProps,
29
- default as DataSummary,
30
- } from "./dataSummary/DataSummary";
31
- export {
32
- type DataSummaryItemProps,
33
- default as DataSummaryItem,
34
- } from "./dataSummary/DataSummaryItem";
35
- export {
36
- default as FacetFilters,
37
- type FacetFiltersProps,
38
- type FilterData,
39
- getSelectedFilters,
40
- getSelectedFiltersMap,
41
- } from "./facetFilters/FacetFilters";
42
- export { default as Fieldset } from "./fieldset/FieldSet";
43
- export { default as Filters } from "./filters/Filters";
44
- export {
45
- type ColumnProps,
46
- default as Footer,
47
- type FooterProps,
48
- } from "./footer/Footer";
49
- export { default as FormFieldCheckboxGroup } from "./formFieldCheckboxGroup/FormFieldCheckboxGroup";
50
- export { default as FormFieldCheckboxOption } from "./formFieldCheckboxOption/FormFieldCheckboxOption";
51
- export { default as FormFieldLabel } from "./formFieldLabel/FormFieldLabel";
52
- export { default as FormFieldRadioGroup } from "./formFieldRadioGroup/FormFieldRadioGroup";
53
- export { default as FormFieldRadioOption } from "./formFieldRadioOption/FormFieldRadioOption";
54
- export { default as FormFieldSwitch } from "./formFieldSwitch/FormFieldSwitch";
55
- export { default as FormFieldTextInput } from "./formFieldTextInput/FormFieldTextInput";
56
- export { default as Header, type HeaderProps } from "./header/Header";
57
- export {
58
- clampHeadingLevel,
59
- default as Heading,
60
- type HeadingProps,
61
- } from "./heading/Heading";
62
- export {
63
- default as HeadingGroup,
64
- type HeadingGroupProps,
65
- } from "./headingGroup/HeadingGroup";
66
- export { default as getAppearance, getDate } from "./iconBadge/getAppearance";
67
- export {
68
- default as IconBadge,
69
- type IconBadgeProps,
70
- } from "./iconBadge/IconBadge";
71
- export { default as Icon } from "./iconsSprite/Icon";
72
- export { default as IconsSprite } from "./iconsSprite/IconsSprite";
73
- export {
74
- default as InfoButton,
75
- type InfoButtonProps,
76
- } from "./infoButton/InfoButton";
77
- export { default as Link } from "./link/Link";
78
- export {
79
- default as Markdown,
80
- type HeadingLevels,
81
- type MarkdownProps,
82
- } from "./markdown/Markdown";
83
- export { default as Overlay } from "./overlay/Overlay";
84
- export {
85
- default as Pagination,
86
- type PaginationProps,
87
- } from "./pagination/Pagination";
88
- export { default as Paragraph } from "./paragraph/Paragraph";
89
- export {
90
- default as PillBadge,
91
- type PillBadgeProps,
92
- } from "./pillBadge/PillBadge";
93
- export { default as ReadOnlyTextInput } from "./readOnlyTextInput/ReadOnlyTextInput";
94
- export {
95
- default as ScoreBadge,
96
- type ScoreBadgeProps,
97
- } from "./scoreBadge/ScoreBadge";
98
- export { default as Search, type SearchProps } from "./search/Search";
99
- export { default as SiteLogo } from "./siteLogo/SiteLogo";
100
- export { default as Switch, type SwitchProps } from "./switch/Switch";
101
- export { default as ToolTip } from "./toolTip/ToolTip";
102
- export {
103
- default as TopNavigation,
104
- type NavBarItem,
105
- processNavBarItems,
106
- type TopNavigationProps,
107
- } from "./topNavigation/TopNavigation";
1
+ // Barrel export for all components
2
+ export { type AlertProps, default as Alert } from "./alert/Alert";
3
+ export { type AlignBoxProps, default as AlignBox } from "./alignBox/AlignBox";
4
+ export { default as Article } from "./article/Article";
5
+ export {
6
+ type BadgeListProps,
7
+ default as BadgeList,
8
+ } from "./badgeList/BadgeList";
9
+ export { type BlockProps, default as Block } from "./block/Block";
10
+ export { default as Button } from "./button/Button";
11
+ export {
12
+ type ButtonActionProps,
13
+ default as ButtonAction,
14
+ } from "./button/ButtonAction";
15
+ export {
16
+ type CardAsLinksProps,
17
+ default as CardAsLink,
18
+ } from "./cardAsLink/CardAsLink";
19
+ export {
20
+ CardsListItem,
21
+ type CardsListItemProps,
22
+ type CardsListProps,
23
+ default as CardsList,
24
+ } from "./cardsList/CardsList";
25
+ export { default as Container } from "./container/Container";
26
+ export { default as CopyButton } from "./copyButton/CopyButton"; // client component
27
+ export {
28
+ type DataBadgeLinkProps,
29
+ default as DataBadgeLink,
30
+ } from "./dataBadgeLink/DataBadgeLink";
31
+ export {
32
+ type DataSummaryProps,
33
+ default as DataSummary,
34
+ } from "./dataSummary/DataSummary";
35
+ export {
36
+ type DataSummaryItemProps,
37
+ default as DataSummaryItem,
38
+ } from "./dataSummary/DataSummaryItem";
39
+ export {
40
+ default as FacetFilters,
41
+ type FacetFiltersProps,
42
+ type FilterData,
43
+ getSelectedFilters,
44
+ getSelectedFiltersMap,
45
+ } from "./facetFilters/FacetFilters";
46
+ export { default as Fieldset } from "./fieldset/FieldSet";
47
+ export { default as Filters } from "./filters/Filters";
48
+ export {
49
+ type ColumnProps,
50
+ default as Footer,
51
+ type FooterProps,
52
+ } from "./footer/Footer";
53
+ export { default as FormFieldCheckboxGroup } from "./formFieldCheckboxGroup/FormFieldCheckboxGroup";
54
+ export { default as FormFieldCheckboxOption } from "./formFieldCheckboxOption/FormFieldCheckboxOption";
55
+ export { default as FormFieldLabel } from "./formFieldLabel/FormFieldLabel";
56
+ export { default as FormFieldRadioGroup } from "./formFieldRadioGroup/FormFieldRadioGroup";
57
+ export { default as FormFieldRadioOption } from "./formFieldRadioOption/FormFieldRadioOption";
58
+ export { default as FormFieldSwitch } from "./formFieldSwitch/FormFieldSwitch";
59
+ export { default as FormFieldTextInput } from "./formFieldTextInput/FormFieldTextInput";
60
+ export { default as Grid, type GridProps } from "./grid/Grid";
61
+ export { default as Header, type HeaderProps } from "./header/Header";
62
+ export {
63
+ clampHeadingLevel,
64
+ default as Heading,
65
+ type HeadingProps,
66
+ } from "./heading/Heading";
67
+ export {
68
+ default as HeadingGroup,
69
+ type HeadingGroupProps,
70
+ } from "./headingGroup/HeadingGroup";
71
+ export { default as getAppearance, getDate } from "./iconBadge/getAppearance";
72
+ export {
73
+ default as IconBadge,
74
+ type IconBadgeProps,
75
+ } from "./iconBadge/IconBadge";
76
+ export { default as Icon } from "./iconsSprite/Icon";
77
+ export { default as IconsSprite } from "./iconsSprite/IconsSprite";
78
+ export {
79
+ default as InfoButton,
80
+ type InfoButtonProps,
81
+ } from "./infoButton/InfoButton";
82
+ export { default as Link } from "./link/Link";
83
+ export {
84
+ default as Markdown,
85
+ type HeadingLevels,
86
+ type MarkdownProps,
87
+ } from "./markdown/Markdown";
88
+ export { default as Overlay } from "./overlay/Overlay";
89
+ export {
90
+ default as Pagination,
91
+ type PaginationProps,
92
+ } from "./pagination/Pagination";
93
+ export { default as Paragraph } from "./paragraph/Paragraph";
94
+ export {
95
+ default as PillBadge,
96
+ type PillBadgeProps,
97
+ } from "./pillBadge/PillBadge";
98
+ export { default as ReadOnlyTextInput } from "./readOnlyTextInput/ReadOnlyTextInput";
99
+ export {
100
+ default as ScoreBadge,
101
+ type ScoreBadgeProps,
102
+ } from "./scoreBadge/ScoreBadge";
103
+ export { default as Search, type SearchProps } from "./search/Search";
104
+ export { default as SiteLogo } from "./siteLogo/SiteLogo";
105
+ export {
106
+ default as SortForm,
107
+ type SortFormProps,
108
+ type SortOption,
109
+ } from "./sortForm/SortForm";
110
+ export { default as Switch, type SwitchProps } from "./switch/Switch";
111
+ export { default as ToolTip } from "./toolTip/ToolTip";
112
+ export {
113
+ default as TopNavigation,
114
+ type NavBarItem,
115
+ processNavBarItems,
116
+ type TopNavigationProps,
117
+ } from "./topNavigation/TopNavigation";
@@ -0,0 +1,52 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import InfoButton from "./InfoButton";
3
+
4
+ /**
5
+ * InfoButton is een knop met een info-icoon, met instelbare grootte
6
+ * (`iconSize`) en kleur (`iconColor`). Wordt onder andere gebruikt als
7
+ * standaard trigger-element van `ToolTip`.
8
+ */
9
+ const meta = {
10
+ title: "Components/InfoButton",
11
+ component: InfoButton,
12
+ tags: ["autodocs", "custom"],
13
+ argTypes: {
14
+ iconSize: {
15
+ control: "select",
16
+ options: ["small", "default", "large"],
17
+ },
18
+ iconColor: {
19
+ control: "select",
20
+ options: ["default", "current"],
21
+ },
22
+ },
23
+ args: {
24
+ "aria-label": "Meer informatie",
25
+ },
26
+ } satisfies Meta<typeof InfoButton>;
27
+
28
+ export default meta;
29
+ type Story = StoryObj<typeof meta>;
30
+
31
+ export const Default: Story = {};
32
+
33
+ export const Small: Story = {
34
+ args: {
35
+ iconSize: "small",
36
+ },
37
+ };
38
+
39
+ export const Large: Story = {
40
+ args: {
41
+ iconSize: "large",
42
+ },
43
+ };
44
+
45
+ export const CurrentColor: Story = {
46
+ name: "Current color (erft tekstkleur)",
47
+ render: (args) => (
48
+ <span style={{ color: "rebeccapurple" }}>
49
+ <InfoButton {...args} iconColor="current" />
50
+ </span>
51
+ ),
52
+ };
@@ -1,45 +1,45 @@
1
- import clsx from "clsx";
2
- import type { ButtonHTMLAttributes, HTMLProps } from "react";
3
- import Icon from "../iconsSprite/Icon";
4
- import styles from "./styles.module.css";
5
-
6
- export interface InfoButtonProps extends HTMLProps<HTMLButtonElement> {
7
- iconSize?: "small" | "default" | "large";
8
- iconColor?: "default" | "current";
9
- type?: ButtonHTMLAttributes<HTMLButtonElement>["type"];
10
- commandfor?: string;
11
- command?:
12
- | "show-modal"
13
- | "close"
14
- | "request-close"
15
- | "show-popover"
16
- | "hide-popover"
17
- | "toggle-popover"
18
- | `--${string}`;
19
- interestfor?: string;
20
- }
21
-
22
- const InfoButton = (props: InfoButtonProps) => {
23
- const {
24
- iconSize = "default",
25
- iconColor = "default",
26
- type = "button",
27
- ...restProps
28
- } = props;
29
-
30
- return (
31
- <button
32
- className={clsx(
33
- styles.infoButton,
34
- styles[`${iconSize}Size`],
35
- styles[`${iconColor}Color`],
36
- )}
37
- type={type}
38
- {...restProps}
39
- >
40
- <Icon name="info" />
41
- </button>
42
- );
43
- };
44
-
45
- export default InfoButton;
1
+ import clsx from "clsx";
2
+ import type { ButtonHTMLAttributes, HTMLProps } from "react";
3
+ import Icon from "../iconsSprite/Icon";
4
+ import styles from "./styles.module.css";
5
+
6
+ export interface InfoButtonProps extends HTMLProps<HTMLButtonElement> {
7
+ iconSize?: "small" | "default" | "large";
8
+ iconColor?: "default" | "current";
9
+ type?: ButtonHTMLAttributes<HTMLButtonElement>["type"];
10
+ commandfor?: string;
11
+ command?:
12
+ | "show-modal"
13
+ | "close"
14
+ | "request-close"
15
+ | "show-popover"
16
+ | "hide-popover"
17
+ | "toggle-popover"
18
+ | `--${string}`;
19
+ interestfor?: string;
20
+ }
21
+
22
+ const InfoButton = (props: InfoButtonProps) => {
23
+ const {
24
+ iconSize = "default",
25
+ iconColor = "default",
26
+ type = "button",
27
+ ...restProps
28
+ } = props;
29
+
30
+ return (
31
+ <button
32
+ className={clsx(
33
+ styles.infoButton,
34
+ styles[`${iconSize}Size`],
35
+ styles[`${iconColor}Color`],
36
+ )}
37
+ type={type}
38
+ {...restProps}
39
+ >
40
+ <Icon name="info" aria-hidden />
41
+ </button>
42
+ );
43
+ };
44
+
45
+ export default InfoButton;
@@ -1,43 +1,43 @@
1
- :root {
2
- --don-info-button-color: var(--rhc-color-hemelblauw-500);
3
- }
4
-
5
- .infoButton {
6
- display: grid;
7
- place-content: center;
8
- padding: 0;
9
- margin: 0;
10
- appearance: none;
11
- cursor: pointer;
12
- background: none;
13
- border: none;
14
- }
15
-
16
- .defaultColor {
17
- color: var(--don-info-button-color, currentColor);
18
- }
19
-
20
- .currentColor {
21
- color: currentColor;
22
- }
23
-
24
- .smallSize {
25
- svg {
26
- width: 1rem;
27
- height: 1rem;
28
- }
29
- }
30
-
31
- .defaultSize {
32
- svg {
33
- width: 1.5rem;
34
- height: 1.5rem;
35
- }
36
- }
37
-
38
- .largeSize {
39
- svg {
40
- width: 2rem;
41
- height: 2rem;
42
- }
43
- }
1
+ :root {
2
+ --don-info-button-color: var(--rhc-color-hemelblauw-500);
3
+ }
4
+
5
+ .infoButton {
6
+ display: grid;
7
+ place-content: center;
8
+ padding: 0;
9
+ margin: 0;
10
+ appearance: none;
11
+ cursor: pointer;
12
+ background: none;
13
+ border: none;
14
+ }
15
+
16
+ .defaultColor {
17
+ color: var(--don-info-button-color, currentColor);
18
+ }
19
+
20
+ .currentColor {
21
+ color: currentColor;
22
+ }
23
+
24
+ .smallSize {
25
+ svg {
26
+ width: 1rem;
27
+ height: 1rem;
28
+ }
29
+ }
30
+
31
+ .defaultSize {
32
+ svg {
33
+ width: 1.5rem;
34
+ height: 1.5rem;
35
+ }
36
+ }
37
+
38
+ .largeSize {
39
+ svg {
40
+ width: 2rem;
41
+ height: 2rem;
42
+ }
43
+ }
@@ -0,0 +1,49 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import Icon from "../iconsSprite/Icon";
3
+ import Link from "./Link";
4
+
5
+ /**
6
+ * Link is een tekstuele link. `current` markeert de link als de huidige
7
+ * pagina (`aria-current`), `inline` past de RHC-inline-stijl toe.
8
+ */
9
+ const meta = {
10
+ title: "Components/Link",
11
+ component: Link,
12
+ tags: ["autodocs", "re-export"],
13
+ args: {
14
+ href: "https://developer.overheid.nl",
15
+ children: "developer.overheid.nl",
16
+ },
17
+ } satisfies Meta<typeof Link>;
18
+
19
+ export default meta;
20
+ type Story = StoryObj<typeof meta>;
21
+
22
+ export const Default: Story = {};
23
+
24
+ export const OpensInNewTab: Story = {
25
+ name: "Opent in nieuw tabblad",
26
+ args: {
27
+ target: "_blank",
28
+ rel: "noopener noreferrer",
29
+ children: (
30
+ <>
31
+ developer.overheid.nl
32
+ <Icon name="externe-link-inline" aria-label="Externe link naar" />
33
+ </>
34
+ ),
35
+ },
36
+ };
37
+
38
+ export const Inline: Story = {
39
+ args: {
40
+ inline: true,
41
+ },
42
+ };
43
+
44
+ export const Current: Story = {
45
+ name: "Huidige pagina",
46
+ args: {
47
+ current: "page",
48
+ },
49
+ };
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;
@@ -0,0 +1,48 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import Markdown from "./Markdown";
3
+
4
+ const sampleText = `## Over deze API
5
+
6
+ Deze API biedt toegang tot **adresgegevens** uit de BAG.
7
+
8
+ - Adressen
9
+ - Panden
10
+ - Verblijfsobjecten
11
+
12
+ Lees meer op [de documentatie](https://developer.overheid.nl).`;
13
+
14
+ /**
15
+ * Markdown rendert `text` (of een string-`children`) via `react-markdown`.
16
+ * Kopniveaus worden verschoven zodat het hoogste niveau nooit dieper is dan
17
+ * `minHeadingDepth` (standaard 2), `openLinksInNewTab` opent links in een
18
+ * nieuw tabblad, en `allowedElements` beperkt welke elementen gerenderd
19
+ * worden.
20
+ */
21
+ const meta = {
22
+ title: "Components/Markdown",
23
+ component: Markdown,
24
+ tags: ["autodocs", "custom"],
25
+ args: {
26
+ text: sampleText,
27
+ },
28
+ } satisfies Meta<typeof Markdown>;
29
+
30
+ export default meta;
31
+ type Story = StoryObj<typeof meta>;
32
+
33
+ export const Default: Story = {};
34
+
35
+ export const OpenLinksInNewTab: Story = {
36
+ args: {
37
+ openLinksInNewTab: true,
38
+ },
39
+ };
40
+
41
+ export const RestrictedElements: Story = {
42
+ name: "Beperkte elementen (bijv. kaartbeschrijving)",
43
+ args: {
44
+ text: "API voor het zoeken en raadplegen van adressen, panden, verblijfsobjecten en gerelateerde gegevens uit de BAG.\n\nLees meer op [de documentatie](https://developer.overheid.nl).",
45
+ allowedElements: ["p", "a", "ul", "ol", "li"],
46
+ openLinksInNewTab: true,
47
+ },
48
+ };
@@ -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
+ }