@developer-overheid-nl/don-register-components 1.3.1 → 1.6.2
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 +176 -130
- package/LICENSE.md +291 -291
- package/README.md +20 -20
- package/package.json +10 -8
- package/src/Introduction.mdx +52 -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
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
|
|
13
|
-
default as
|
|
14
|
-
} from "./
|
|
15
|
-
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} from "./
|
|
27
|
-
export {
|
|
28
|
-
type
|
|
29
|
-
default as
|
|
30
|
-
} from "./
|
|
31
|
-
export {
|
|
32
|
-
type
|
|
33
|
-
default as
|
|
34
|
-
} from "./dataSummary/
|
|
35
|
-
export {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
export { default as
|
|
54
|
-
export { default as
|
|
55
|
-
export { default as
|
|
56
|
-
export { default as
|
|
57
|
-
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
} from "./
|
|
62
|
-
export {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
export {
|
|
68
|
-
default as
|
|
69
|
-
type
|
|
70
|
-
} from "./
|
|
71
|
-
export { default as
|
|
72
|
-
export {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
} from "./
|
|
77
|
-
export { default as
|
|
78
|
-
export {
|
|
79
|
-
default as
|
|
80
|
-
type
|
|
81
|
-
|
|
82
|
-
} from "./
|
|
83
|
-
export {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
type
|
|
87
|
-
} from "./
|
|
88
|
-
export { default as
|
|
89
|
-
export {
|
|
90
|
-
default as
|
|
91
|
-
type
|
|
92
|
-
} from "./
|
|
93
|
-
export { default as
|
|
94
|
-
export {
|
|
95
|
-
default as
|
|
96
|
-
type
|
|
97
|
-
} from "./
|
|
98
|
-
export { default as
|
|
99
|
-
export {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
+
}
|