@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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
.short {
|
|
2
|
-
--nl-paragraph-font-size: 0.875rem;
|
|
3
|
-
--nl-paragraph-margin-block-end: 0.5rem;
|
|
4
|
-
padding-inline-start: 0.25rem;
|
|
5
|
-
border-inline-start: 1px solid var(--rhc-color-cool-grey-300);
|
|
6
|
-
}
|
|
1
|
+
.short {
|
|
2
|
+
--nl-paragraph-font-size: 0.875rem;
|
|
3
|
+
--nl-paragraph-margin-block-end: 0.5rem;
|
|
4
|
+
padding-inline-start: 0.25rem;
|
|
5
|
+
border-inline-start: 1px solid var(--rhc-color-cool-grey-300);
|
|
6
|
+
}
|
|
@@ -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;
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import Block from "../block/Block";
|
|
3
|
+
import PillBadge from "./PillBadge";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* PillBadge toont een start- en eindwaarde naast elkaar in een pil-vorm,
|
|
7
|
+
* bijvoorbeeld een status met kleur of een percentage.
|
|
8
|
+
*/
|
|
9
|
+
const meta = {
|
|
10
|
+
title: "Components/PillBadge",
|
|
11
|
+
component: PillBadge,
|
|
12
|
+
tags: ["autodocs", "custom"],
|
|
13
|
+
// args: {
|
|
14
|
+
// type: 'color',
|
|
15
|
+
// },
|
|
16
|
+
argTypes: {
|
|
17
|
+
startValue: {
|
|
18
|
+
control: "text",
|
|
19
|
+
},
|
|
20
|
+
endValue: {
|
|
21
|
+
control: "text",
|
|
22
|
+
},
|
|
23
|
+
color: {
|
|
24
|
+
control: { type: "select" },
|
|
25
|
+
table: {
|
|
26
|
+
defaultValue: {
|
|
27
|
+
detail:
|
|
28
|
+
"deze kleur is niet los te kiezen, werkt goed met percentages",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
options: [
|
|
32
|
+
"robijnrood",
|
|
33
|
+
"roze",
|
|
34
|
+
"rood",
|
|
35
|
+
"oranje",
|
|
36
|
+
"donkergeel",
|
|
37
|
+
"geel",
|
|
38
|
+
"donkergroen",
|
|
39
|
+
"groen",
|
|
40
|
+
"mosgroen",
|
|
41
|
+
"mintgroen",
|
|
42
|
+
"donkerblauw",
|
|
43
|
+
"hemelblauw",
|
|
44
|
+
"paars",
|
|
45
|
+
"violet",
|
|
46
|
+
"lichtblauw",
|
|
47
|
+
"coolgrey",
|
|
48
|
+
"grijs",
|
|
49
|
+
"grey",
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
decorators: [
|
|
54
|
+
(Story) => (
|
|
55
|
+
<Block layout="flex-col">
|
|
56
|
+
<Story />
|
|
57
|
+
</Block>
|
|
58
|
+
),
|
|
59
|
+
],
|
|
60
|
+
parameters: {
|
|
61
|
+
a11y: {
|
|
62
|
+
config: {
|
|
63
|
+
checks: [
|
|
64
|
+
{
|
|
65
|
+
id: "color-contrast",
|
|
66
|
+
options: {
|
|
67
|
+
ignorePseudo: true,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
} satisfies Meta<typeof PillBadge>;
|
|
75
|
+
|
|
76
|
+
export default meta;
|
|
77
|
+
|
|
78
|
+
type Story = StoryObj<typeof meta>;
|
|
79
|
+
|
|
80
|
+
const colorExamples = [
|
|
81
|
+
{
|
|
82
|
+
startValue: "Kleur",
|
|
83
|
+
endValue: "robijnrood",
|
|
84
|
+
type: "color" as const,
|
|
85
|
+
color: "robijnrood",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
startValue: "Kleur",
|
|
89
|
+
endValue: "roze",
|
|
90
|
+
type: "color" as const,
|
|
91
|
+
color: "roze",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
startValue: "Kleur",
|
|
95
|
+
endValue: "rood",
|
|
96
|
+
type: "color" as const,
|
|
97
|
+
color: "rood",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
startValue: "Kleur",
|
|
101
|
+
endValue: "oranje",
|
|
102
|
+
type: "color" as const,
|
|
103
|
+
color: "oranje",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
startValue: "Kleur",
|
|
107
|
+
endValue: "donkergeel",
|
|
108
|
+
type: "color" as const,
|
|
109
|
+
color: "donkergeel",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
startValue: "Kleur",
|
|
113
|
+
endValue: "geel",
|
|
114
|
+
type: "color" as const,
|
|
115
|
+
color: "geel",
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
startValue: "Kleur",
|
|
119
|
+
endValue: "donkergroen",
|
|
120
|
+
type: "color" as const,
|
|
121
|
+
color: "donkergroen",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
startValue: "Kleur",
|
|
125
|
+
endValue: "groen",
|
|
126
|
+
type: "color" as const,
|
|
127
|
+
color: "groen",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
startValue: "Kleur",
|
|
131
|
+
endValue: "mosgroen",
|
|
132
|
+
type: "color" as const,
|
|
133
|
+
color: "mosgroen",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
startValue: "Kleur",
|
|
137
|
+
endValue: "mintgroen",
|
|
138
|
+
type: "color" as const,
|
|
139
|
+
color: "mintgroen",
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
startValue: "Kleur",
|
|
143
|
+
endValue: "donkerblauw",
|
|
144
|
+
type: "color" as const,
|
|
145
|
+
color: "donkerblauw",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
startValue: "Kleur",
|
|
149
|
+
endValue: "hemelblauw",
|
|
150
|
+
type: "color" as const,
|
|
151
|
+
color: "hemelblauw",
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
startValue: "Kleur",
|
|
155
|
+
endValue: "paars",
|
|
156
|
+
type: "color" as const,
|
|
157
|
+
color: "paars",
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
startValue: "Kleur",
|
|
161
|
+
endValue: "violet",
|
|
162
|
+
type: "color" as const,
|
|
163
|
+
color: "violet",
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
startValue: "Kleur",
|
|
167
|
+
endValue: "lichtblauw",
|
|
168
|
+
type: "color" as const,
|
|
169
|
+
color: "lichtblauw",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
startValue: "Kleur",
|
|
173
|
+
endValue: "coolgrey",
|
|
174
|
+
type: "color" as const,
|
|
175
|
+
color: "coolgrey",
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
|
|
179
|
+
const percentageExamples = [
|
|
180
|
+
{ startValue: "Percentage", endValue: "76", type: "percentage" as const },
|
|
181
|
+
{
|
|
182
|
+
startValue: "Percentage & Kleur",
|
|
183
|
+
endValue: "42",
|
|
184
|
+
type: "percentage" as const,
|
|
185
|
+
color: "robijnrood",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
startValue: "Percentage & Kleur",
|
|
189
|
+
endValue: "21",
|
|
190
|
+
type: "percentage" as const,
|
|
191
|
+
color: "rood",
|
|
192
|
+
},
|
|
193
|
+
];
|
|
194
|
+
|
|
195
|
+
export const Default: Story = {
|
|
196
|
+
args: {
|
|
197
|
+
startValue: "startValue",
|
|
198
|
+
endValue: "endValue",
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export const ColorExamples: Story = {
|
|
203
|
+
args: {
|
|
204
|
+
startValue: "",
|
|
205
|
+
endValue: "",
|
|
206
|
+
},
|
|
207
|
+
render: () => (
|
|
208
|
+
<>
|
|
209
|
+
{colorExamples.map((example) => (
|
|
210
|
+
<PillBadge
|
|
211
|
+
key={`${example.startValue}-${example.endValue}`}
|
|
212
|
+
{...example}
|
|
213
|
+
/>
|
|
214
|
+
))}
|
|
215
|
+
</>
|
|
216
|
+
),
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export const PercentageExamples: Story = {
|
|
220
|
+
args: {
|
|
221
|
+
startValue: "",
|
|
222
|
+
endValue: "",
|
|
223
|
+
},
|
|
224
|
+
render: () => (
|
|
225
|
+
<>
|
|
226
|
+
{percentageExamples.map((example) => (
|
|
227
|
+
<PillBadge
|
|
228
|
+
key={`${example.startValue}-${example.endValue}`}
|
|
229
|
+
{...example}
|
|
230
|
+
/>
|
|
231
|
+
))}
|
|
232
|
+
</>
|
|
233
|
+
),
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export const AllExamples: Story = {
|
|
237
|
+
args: {
|
|
238
|
+
startValue: "",
|
|
239
|
+
endValue: "",
|
|
240
|
+
},
|
|
241
|
+
render: () => (
|
|
242
|
+
<>
|
|
243
|
+
{colorExamples.map((example) => (
|
|
244
|
+
<PillBadge
|
|
245
|
+
key={`color-${example.startValue}-${example.endValue}`}
|
|
246
|
+
{...example}
|
|
247
|
+
/>
|
|
248
|
+
))}
|
|
249
|
+
{percentageExamples.map((example) => (
|
|
250
|
+
<PillBadge
|
|
251
|
+
key={`percentage-${example.startValue}-${example.endValue}`}
|
|
252
|
+
{...example}
|
|
253
|
+
/>
|
|
254
|
+
))}
|
|
255
|
+
</>
|
|
256
|
+
),
|
|
257
|
+
};
|
|
@@ -1,51 +1,60 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import type { PropsWithChildren } from "react";
|
|
3
|
-
import styles from "./styles.module.css";
|
|
4
|
-
|
|
5
|
-
export interface PillBadgeProps {
|
|
6
|
-
className?: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import type { PropsWithChildren } from "react";
|
|
3
|
+
import styles from "./styles.module.css";
|
|
4
|
+
|
|
5
|
+
export interface PillBadgeProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Text on the start-side of the pill */
|
|
8
|
+
startValue: string | number | null | undefined;
|
|
9
|
+
/** Text on the end-side of the pill */
|
|
10
|
+
endValue: string | number | null | undefined;
|
|
11
|
+
/** Figure Caption text */
|
|
12
|
+
caption?: string;
|
|
13
|
+
/** Type of Pill badge
|
|
14
|
+
* @default color
|
|
15
|
+
*/
|
|
16
|
+
type?: "color" | "percentage";
|
|
17
|
+
/** Color of the end-side of the pill
|
|
18
|
+
* @default lichtgroen
|
|
19
|
+
*/
|
|
20
|
+
color?: string; // todo: enum
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const PillBadge = (props: PropsWithChildren<PillBadgeProps>) => {
|
|
24
|
+
const {
|
|
25
|
+
className,
|
|
26
|
+
startValue,
|
|
27
|
+
endValue,
|
|
28
|
+
caption,
|
|
29
|
+
type = "color",
|
|
30
|
+
color,
|
|
31
|
+
children,
|
|
32
|
+
...restProps
|
|
33
|
+
} = props;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<figure
|
|
37
|
+
className={clsx(styles["pill-badge-figure"], className)}
|
|
38
|
+
{...restProps}
|
|
39
|
+
>
|
|
40
|
+
<div
|
|
41
|
+
className={clsx(
|
|
42
|
+
styles["pill-badge"],
|
|
43
|
+
type === "percentage" && styles["pill-badge--type-percentage"],
|
|
44
|
+
)}
|
|
45
|
+
data-percentage={type === "percentage" ? endValue : undefined}
|
|
46
|
+
data-color={color}
|
|
47
|
+
>
|
|
48
|
+
<span className={styles["pill-badge__start"]}>{startValue || "■"}</span>
|
|
49
|
+
<span className={styles["pill-badge__end"]}>
|
|
50
|
+
{endValue || "-"}
|
|
51
|
+
{type === "percentage" ? "%" : ""}
|
|
52
|
+
</span>
|
|
53
|
+
</div>
|
|
54
|
+
{children}
|
|
55
|
+
{caption && <figcaption>{caption}</figcaption>}
|
|
56
|
+
</figure>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default PillBadge;
|