@developer-overheid-nl/don-register-components 1.3.0 → 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 -118
  2. package/LICENSE.md +291 -291
  3. package/README.md +20 -20
  4. package/package.json +10 -8
  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 -54
  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 -367
  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
@@ -1,48 +1,48 @@
1
- import {
2
- Heading,
3
- type HeadingProps,
4
- Paragraph,
5
- HeadingGroup as RHCHeadingGroup,
6
- type HeadingGroupProps as RHCHeadingGroupProps,
7
- } from "@rijkshuisstijl-community/components-react";
8
- import clsx from "clsx";
9
- import type { HTMLProps, PropsWithChildren, ReactNode } from "react";
10
- import styles from "./styles.module.css";
11
-
12
- export interface HeadingGroupProps extends RHCHeadingGroupProps {
13
- title: string;
14
- subTitle?: string | ReactNode;
15
- level: HeadingProps["level"];
16
- appearanceLevel?: HeadingProps["appearanceLevel"];
17
- subTitleProps?: HTMLProps<Paragraph>;
18
- }
19
-
20
- const HeadingGroup = (props: PropsWithChildren<HeadingGroupProps>) => {
21
- const {
22
- title,
23
- subTitle,
24
- level,
25
- appearanceLevel,
26
- className,
27
- subTitleProps,
28
- children,
29
- ...restProps
30
- } = props;
31
- return (
32
- <RHCHeadingGroup
33
- className={clsx(className, styles.headingGroup)}
34
- {...restProps}
35
- >
36
- <Heading appearanceLevel={appearanceLevel} level={level}>
37
- {title}
38
- </Heading>
39
- {typeof subTitle === "string" ? (
40
- <Paragraph {...subTitleProps}>{subTitle}</Paragraph>
41
- ) : (
42
- subTitle || children
43
- )}
44
- </RHCHeadingGroup>
45
- );
46
- };
47
-
48
- export default HeadingGroup;
1
+ import {
2
+ Heading,
3
+ type HeadingProps,
4
+ Paragraph,
5
+ HeadingGroup as RHCHeadingGroup,
6
+ type HeadingGroupProps as RHCHeadingGroupProps,
7
+ } from "@rijkshuisstijl-community/components-react";
8
+ import clsx from "clsx";
9
+ import type { HTMLProps, PropsWithChildren, ReactNode } from "react";
10
+ import styles from "./styles.module.css";
11
+
12
+ export interface HeadingGroupProps extends RHCHeadingGroupProps {
13
+ title: string;
14
+ subTitle?: string | ReactNode;
15
+ level: HeadingProps["level"];
16
+ appearanceLevel?: HeadingProps["appearanceLevel"];
17
+ subTitleProps?: HTMLProps<Paragraph>;
18
+ }
19
+
20
+ const HeadingGroup = (props: PropsWithChildren<HeadingGroupProps>) => {
21
+ const {
22
+ title,
23
+ subTitle,
24
+ level,
25
+ appearanceLevel,
26
+ className,
27
+ subTitleProps,
28
+ children,
29
+ ...restProps
30
+ } = props;
31
+ return (
32
+ <RHCHeadingGroup
33
+ className={clsx(className, styles.headingGroup)}
34
+ {...restProps}
35
+ >
36
+ <Heading appearanceLevel={appearanceLevel} level={level}>
37
+ {title}
38
+ </Heading>
39
+ {typeof subTitle === "string" ? (
40
+ <Paragraph {...subTitleProps}>{subTitle}</Paragraph>
41
+ ) : (
42
+ subTitle || children
43
+ )}
44
+ </RHCHeadingGroup>
45
+ );
46
+ };
47
+
48
+ export default HeadingGroup;
@@ -1,3 +1,3 @@
1
- .headingGroup {
2
- inline-size: 100%;
3
- }
1
+ .headingGroup {
2
+ inline-size: 100%;
3
+ }
package/src/i18n.ts CHANGED
@@ -1,25 +1,24 @@
1
- import resources from "@developer-overheid-nl/don-register-locales/nl" with {
2
- type: "json",
3
- };
4
- import { createInstance, type i18n } from "i18next";
5
-
6
- const i18nInstance: i18n = createInstance({
7
- lng: "nl",
8
- fallbackLng: "nl",
9
- // debug: true,
10
- showSupportNotice: false,
11
-
12
- interpolation: {
13
- escapeValue: false, // not needed for react as it escapes by default
14
- },
15
-
16
- resources: {
17
- nl: {
18
- translation: resources,
19
- },
20
- },
21
- });
22
-
23
- i18nInstance.init();
24
-
25
- export default i18nInstance;
1
+ import resources from "@developer-overheid-nl/don-register-locales/nl" with {
2
+ type: "json",
3
+ };
4
+ import { createInstance, type i18n } from "i18next";
5
+
6
+ const i18nInstance: i18n = createInstance({
7
+ lng: "nl",
8
+ fallbackLng: "nl",
9
+ // debug: true,
10
+
11
+ interpolation: {
12
+ escapeValue: false, // not needed for react as it escapes by default
13
+ },
14
+
15
+ resources: {
16
+ nl: {
17
+ translation: resources,
18
+ },
19
+ },
20
+ });
21
+
22
+ i18nInstance.init();
23
+
24
+ export default i18nInstance;
@@ -0,0 +1,46 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import IconBadge from "./IconBadge";
3
+
4
+ /**
5
+ * IconBadge toont een icoon-badge voor een levensfase-status (actief,
6
+ * verouderd, aflopend of uit gebruik genomen).
7
+ *
8
+ * Verouderd: API Register-specifiek en niet meer in gebruik.
9
+ */
10
+ const meta = {
11
+ title: "Components/IconBadge",
12
+ component: IconBadge,
13
+ tags: ["autodocs", "deprecated", "custom"],
14
+ argTypes: {
15
+ name: {
16
+ control: "select",
17
+ options: ["active", "deprecated", "sunset", "retired"],
18
+ },
19
+ },
20
+ args: {
21
+ name: "active",
22
+ },
23
+ } satisfies Meta<typeof IconBadge>;
24
+
25
+ export default meta;
26
+ type Story = StoryObj<typeof meta>;
27
+
28
+ export const Active: Story = {};
29
+
30
+ export const Deprecated: Story = {
31
+ args: {
32
+ name: "deprecated",
33
+ },
34
+ };
35
+
36
+ export const Sunset: Story = {
37
+ args: {
38
+ name: "sunset",
39
+ },
40
+ };
41
+
42
+ export const Retired: Story = {
43
+ args: {
44
+ name: "retired",
45
+ },
46
+ };
@@ -1,35 +1,35 @@
1
- import clsx from "clsx";
2
- import type { HTMLProps } from "react";
3
- import Icon from "../iconsSprite/Icon";
4
- import styles from "./styles.module.css";
5
-
6
- export interface IconBadgeProps extends HTMLProps<HTMLSpanElement> {
7
- name: string;
8
- appearance?: string;
9
- }
10
-
11
- /**
12
- * @deprecated API Register specific component (and not used anymore)
13
- */
14
- export default function IconBadge(props: IconBadgeProps) {
15
- const { className, name, appearance, ...restProps } = props;
16
- const iconClassName = `don-icon don-icon-${name} ${className || ""}`.trim();
17
-
18
- return (
19
- <span
20
- className={clsx(
21
- "utrecht-data-badge",
22
- `utrecht-data-badge--${appearance || name}`,
23
- styles,
24
- )}
25
- {...restProps}
26
- >
27
- <Icon
28
- width="1.5rem"
29
- height="1.5rem"
30
- className={`${iconClassName}`}
31
- name={name}
32
- />
33
- </span>
34
- );
35
- }
1
+ import clsx from "clsx";
2
+ import type { HTMLProps } from "react";
3
+ import Icon from "../iconsSprite/Icon";
4
+ import styles from "./styles.module.css";
5
+
6
+ export interface IconBadgeProps extends HTMLProps<HTMLSpanElement> {
7
+ name: string;
8
+ appearance?: string;
9
+ }
10
+
11
+ /**
12
+ * @deprecated API Register specific component (and not used anymore)
13
+ */
14
+ export default function IconBadge(props: IconBadgeProps) {
15
+ const { className, name, appearance, ...restProps } = props;
16
+ const iconClassName = `don-icon don-icon-${name} ${className || ""}`.trim();
17
+
18
+ return (
19
+ <span
20
+ className={clsx(
21
+ "utrecht-data-badge",
22
+ `utrecht-data-badge--${appearance || name}`,
23
+ styles,
24
+ )}
25
+ {...restProps}
26
+ >
27
+ <Icon
28
+ width="1.5rem"
29
+ height="1.5rem"
30
+ className={`${iconClassName}`}
31
+ name={name}
32
+ />
33
+ </span>
34
+ );
35
+ }
@@ -1,53 +1,53 @@
1
- /* biome-ignore-all lint: is deprecated and refactored */
2
- type status = "active" | "deprecated" | "sunset" | "retired";
3
-
4
- /**
5
- * @deprecated API Register specific function (moved and refactored to `apps/api-register/src/components/`)
6
- */
7
- export function getDate(object?: Partial<Record<"status" | status, any>>) {
8
- if (!object) return;
9
-
10
- const keys = Object.keys(object);
11
- const statuses: status[] = ["deprecated", "sunset"];
12
- let date;
13
-
14
- statuses.forEach((status) => {
15
- if (keys.includes(status) && object[status]) {
16
- date = object[status];
17
- }
18
- });
19
-
20
- return (
21
- date &&
22
- new Date(date).toLocaleDateString("nl-NL", {
23
- year: "numeric",
24
- month: "long",
25
- day: "numeric",
26
- })
27
- );
28
- }
29
-
30
- /**
31
- * @deprecated API Register specific function (moved and refactored to `apps/api-register/src/components/`)
32
- */
33
- export default function getAppearance(
34
- object?: Partial<Record<"status" | status, any>>,
35
- ) {
36
- if (!object) return;
37
-
38
- const keys = Object.keys(object);
39
- const statuses: status[] = ["active", "deprecated", "sunset", "retired"];
40
- let appearance;
41
-
42
- statuses.forEach((status) => {
43
- if (keys.includes(status) && object[status]) {
44
- // If upcoming status is more serious than current status, use that one
45
- appearance =
46
- statuses.indexOf(status) > statuses.indexOf(object.status)
47
- ? status
48
- : object.status;
49
- }
50
- });
51
-
52
- return appearance;
53
- }
1
+ /* biome-ignore-all lint: is deprecated and refactored */
2
+ type status = "active" | "deprecated" | "sunset" | "retired";
3
+
4
+ /**
5
+ * @deprecated API Register specific function (moved and refactored to `apps/api-register/src/components/`)
6
+ */
7
+ export function getDate(object?: Partial<Record<"status" | status, any>>) {
8
+ if (!object) return;
9
+
10
+ const keys = Object.keys(object);
11
+ const statuses: status[] = ["deprecated", "sunset"];
12
+ let date;
13
+
14
+ statuses.forEach((status) => {
15
+ if (keys.includes(status) && object[status]) {
16
+ date = object[status];
17
+ }
18
+ });
19
+
20
+ return (
21
+ date &&
22
+ new Date(date).toLocaleDateString("nl-NL", {
23
+ year: "numeric",
24
+ month: "long",
25
+ day: "numeric",
26
+ })
27
+ );
28
+ }
29
+
30
+ /**
31
+ * @deprecated API Register specific function (moved and refactored to `apps/api-register/src/components/`)
32
+ */
33
+ export default function getAppearance(
34
+ object?: Partial<Record<"status" | status, any>>,
35
+ ) {
36
+ if (!object) return;
37
+
38
+ const keys = Object.keys(object);
39
+ const statuses: status[] = ["active", "deprecated", "sunset", "retired"];
40
+ let appearance;
41
+
42
+ statuses.forEach((status) => {
43
+ if (keys.includes(status) && object[status]) {
44
+ // If upcoming status is more serious than current status, use that one
45
+ appearance =
46
+ statuses.indexOf(status) > statuses.indexOf(object.status)
47
+ ? status
48
+ : object.status;
49
+ }
50
+ });
51
+
52
+ return appearance;
53
+ }
@@ -1,19 +1,19 @@
1
- :global(.utrecht-data-badge--active) {
2
- --utrecht-data-badge-background-color: var(--rhc-color-groen-100);
3
- --utrecht-data-badge-color: var(--rhc-color-groen-500);
4
- }
5
-
6
- :global(.utrecht-data-badge--deprecated) {
7
- --utrecht-data-badge-background-color: var(--rhc-color-donkergeel-100);
8
- --utrecht-data-badge-color: var(--rhc-color-donkergeel-500);
9
- }
10
-
11
- :global(.utrecht-data-badge--sunset) {
12
- --utrecht-data-badge-background-color: var(--rhc-color-oranje-100);
13
- --utrecht-data-badge-color: var(--rhc-color-oranje-500);
14
- }
15
-
16
- :global(.utrecht-data-badge--retired) {
17
- --utrecht-data-badge-background-color: var(--rhc-color-rood-100);
18
- --utrecht-data-badge-color: var(--rhc-color-rood-500);
19
- }
1
+ :global(.utrecht-data-badge--active) {
2
+ --utrecht-data-badge-background-color: var(--rhc-color-groen-100);
3
+ --utrecht-data-badge-color: var(--rhc-color-groen-500);
4
+ }
5
+
6
+ :global(.utrecht-data-badge--deprecated) {
7
+ --utrecht-data-badge-background-color: var(--rhc-color-donkergeel-100);
8
+ --utrecht-data-badge-color: var(--rhc-color-donkergeel-500);
9
+ }
10
+
11
+ :global(.utrecht-data-badge--sunset) {
12
+ --utrecht-data-badge-background-color: var(--rhc-color-oranje-100);
13
+ --utrecht-data-badge-color: var(--rhc-color-oranje-500);
14
+ }
15
+
16
+ :global(.utrecht-data-badge--retired) {
17
+ --utrecht-data-badge-background-color: var(--rhc-color-rood-100);
18
+ --utrecht-data-badge-color: var(--rhc-color-rood-500);
19
+ }
@@ -0,0 +1,73 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import AlignBox from "../alignBox/AlignBox";
3
+ import Grid from "../grid/Grid";
4
+ import Icon from "./Icon";
5
+
6
+ const iconNames = [
7
+ "externe-link-inline",
8
+ "plus-cirkel-inline",
9
+ "kruis-inline",
10
+ "delta-naar-rechts-inline",
11
+ "active",
12
+ "deprecated",
13
+ "retired",
14
+ "sunset",
15
+ "kopieer-inline",
16
+ "zoek-inline",
17
+ "info",
18
+ "trechter",
19
+ "git-fork-inline",
20
+ "variant-fork-inline",
21
+ "lade-archiefkast",
22
+ ];
23
+
24
+ /**
25
+ * Icon rendert een icoon uit de sprite door middel van `name`, via een
26
+ * `<svg><use></use></svg>`-referentie naar `#icon-{name}`. Vereist dat
27
+ * `IconsSprite` ergens in het document is gerenderd, bijvoorbeeld eenmalig
28
+ * in de layout:
29
+ *
30
+ * ```tsx
31
+ * import { IconsSprite } from "@developer-overheid-nl/don-register-components";
32
+ *
33
+ * <IconsSprite />
34
+ * ```
35
+ *
36
+ * In Storybook gebeurt dit al globaal, via een decorator in
37
+ * `.storybook/preview.tsx`.
38
+ */
39
+ const meta = {
40
+ title: "Components/Icon",
41
+ component: Icon,
42
+ tags: ["autodocs", "custom"],
43
+ args: {
44
+ name: "info",
45
+ "aria-label": "Info",
46
+ },
47
+ } satisfies Meta<typeof Icon>;
48
+
49
+ export default meta;
50
+ type Story = StoryObj<typeof meta>;
51
+
52
+ export const Default: Story = {};
53
+
54
+ export const AllIcons: Story = {
55
+ name: "Alle iconen in de sprite",
56
+ decorators: [
57
+ (Story) => (
58
+ <Grid minColumnWidth="6rem" gap="medium">
59
+ <Story />
60
+ </Grid>
61
+ ),
62
+ ],
63
+ render: () => (
64
+ <>
65
+ {iconNames.map((name) => (
66
+ <AlignBox key={name} direction="column" gap="small">
67
+ <Icon name={name} aria-label={name} width="2rem" height="2rem" />
68
+ <code>{name}</code>
69
+ </AlignBox>
70
+ ))}
71
+ </>
72
+ ),
73
+ };
@@ -1,17 +1,17 @@
1
- export default function Icon(props: React.HTMLProps<SVGSVGElement>) {
2
- const { className, name, ...restProps } = props;
3
- const iconClassName = `don-icon don-icon-${name} ${className || ""}`.trim();
4
-
5
- return (
6
- <svg
7
- width="1rem"
8
- height="1rem"
9
- className={`${iconClassName}`}
10
- role={props.role || "img"}
11
- aria-label={props["aria-label"]}
12
- {...restProps}
13
- >
14
- <use href={`#icon-${name}`} />
15
- </svg>
16
- );
17
- }
1
+ export default function Icon(props: React.HTMLProps<SVGSVGElement>) {
2
+ const { className, name, ...restProps } = props;
3
+ const iconClassName = `don-icon don-icon-${name} ${className || ""}`.trim();
4
+
5
+ return (
6
+ <svg
7
+ width="1rem"
8
+ height="1rem"
9
+ className={`${iconClassName}`}
10
+ role={props.role || "img"}
11
+ aria-label={props["aria-label"]}
12
+ {...restProps}
13
+ >
14
+ <use href={`#icon-${name}`} />
15
+ </svg>
16
+ );
17
+ }
@@ -1,5 +1,5 @@
1
- import { Sprite } from "@developer-overheid-nl/proprietary/icons";
2
-
3
- export default function IconsSprite() {
4
- return <Sprite />;
5
- }
1
+ import { Sprite } from "@developer-overheid-nl/proprietary/icons";
2
+
3
+ export default function IconsSprite() {
4
+ return <Sprite />;
5
+ }