@conduction/components 2.1.40 → 2.2.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.
- package/.github/workflows/github-actions.yml +4 -2
- package/.prettierrc +30 -30
- package/README.md +15 -0
- package/lib/components/Pagination/Pagination.d.ts +9 -9
- package/lib/components/Pagination/Pagination.js +12 -12
- package/lib/components/badgeCounter/BadgeCounter.d.ts +8 -8
- package/lib/components/badgeCounter/BadgeCounter.js +4 -4
- package/lib/components/badgeCounter/BadgeCounter.module.css +27 -27
- package/lib/components/card/cardHeader/CardHeader.d.ts +4 -4
- package/lib/components/card/cardHeader/CardHeader.js +14 -14
- package/lib/components/card/cardWrapper/CardWrapper.d.ts +2 -2
- package/lib/components/card/cardWrapper/CardWrapper.js +6 -6
- package/lib/components/card/detailsCard/DetailsCard.d.ts +14 -14
- package/lib/components/card/detailsCard/DetailsCard.js +11 -11
- package/lib/components/card/downloadCard/DownloadCard.d.ts +11 -11
- package/lib/components/card/downloadCard/DownloadCard.js +9 -9
- package/lib/components/card/horizontalImageCard/HorizontalImageCard.d.ts +13 -13
- package/lib/components/card/horizontalImageCard/HorizontalImageCard.js +10 -9
- package/lib/components/card/horizontalImageCard/HorizontalImageCard.module.css +5 -1
- package/lib/components/card/imageAndDetailsCard/ImageAndDetailsCard.d.ts +14 -14
- package/lib/components/card/imageAndDetailsCard/ImageAndDetailsCard.js +10 -10
- package/lib/components/card/index.d.ts +8 -9
- package/lib/components/card/index.js +8 -9
- package/lib/components/card/infoCard/InfoCard.d.ts +8 -8
- package/lib/components/card/infoCard/InfoCard.js +6 -6
- package/lib/components/card/infoCard/InfoCard.module.css +26 -26
- package/lib/components/card/richContentCard/RichContentCard.d.ts +19 -19
- package/lib/components/card/richContentCard/RichContentCard.js +16 -16
- package/lib/components/card/richContentCard/RichContentCard.module.css +13 -3
- package/lib/components/codeBlock/CodeBlock.d.ts +6 -6
- package/lib/components/codeBlock/CodeBlock.js +3 -3
- package/lib/components/codeBlock/CodeBlock.module.css +6 -6
- package/lib/components/container/Container.d.ts +6 -6
- package/lib/components/container/Container.js +4 -4
- package/lib/components/denhaag-wrappers/breadcrumbs/Breadcrumbs.css +222 -222
- package/lib/components/denhaag-wrappers/breadcrumbs/Breadcrumbs.d.ts +17 -17
- package/lib/components/denhaag-wrappers/breadcrumbs/Breadcrumbs.js +20 -20
- package/lib/components/denhaag-wrappers/pagination/Pagination.css +120 -120
- package/lib/components/denhaag-wrappers/pagination/Pagination.d.ts +9 -9
- package/lib/components/denhaag-wrappers/pagination/Pagination.js +15 -15
- package/lib/components/editableTableRow/EditableTableRow.d.ts +14 -14
- package/lib/components/editableTableRow/EditableTableRow.js +31 -31
- package/lib/components/editableTableRow/EditableTableRow.module.css +25 -25
- package/lib/components/formFields/checkbox/Checkbox.module.css +7 -7
- package/lib/components/formFields/checkbox/checkbox.d.ts +9 -9
- package/lib/components/formFields/checkbox/checkbox.js +3 -3
- package/lib/components/formFields/createKeyValue/CreateKeyValue.d.ts +23 -23
- package/lib/components/formFields/createKeyValue/CreateKeyValue.js +42 -42
- package/lib/components/formFields/createKeyValue/CreateKeyValue.module.css +9 -0
- package/lib/components/formFields/date/Date.d.ts +12 -12
- package/lib/components/formFields/date/Date.js +10 -10
- package/lib/components/formFields/date/Date.module.css +12 -12
- package/lib/components/formFields/errorMessage/ErrorMessage.d.ts +5 -5
- package/lib/components/formFields/errorMessage/ErrorMessage.js +3 -3
- package/lib/components/formFields/index.d.ts +7 -8
- package/lib/components/formFields/index.js +7 -8
- package/lib/components/formFields/input.d.ts +21 -21
- package/lib/components/formFields/input.js +12 -12
- package/lib/components/formFields/radio.d.ts +9 -9
- package/lib/components/formFields/radio.js +3 -3
- package/lib/components/formFields/select/select.d.ts +23 -23
- package/lib/components/formFields/select/select.js +58 -58
- package/lib/components/formFields/textarea.d.ts +9 -9
- package/lib/components/formFields/textarea.js +4 -4
- package/lib/components/formFields/types.d.ts +6 -6
- package/lib/components/formFields/types.js +1 -1
- package/lib/components/imageDivider/ImageDivider.d.ts +7 -7
- package/lib/components/imageDivider/ImageDivider.js +6 -6
- package/lib/components/imageDivider/imageDivider.module.css +5 -5
- package/lib/components/logo/Logo.d.ts +8 -8
- package/lib/components/logo/Logo.js +10 -10
- package/lib/components/logo/Logo.module.css +15 -15
- package/lib/components/metaIcon/MetaIcon.d.ts +7 -7
- package/lib/components/metaIcon/MetaIcon.js +3 -3
- package/lib/components/metaIcon/MetaIcon.module.css +29 -29
- package/lib/components/notificationPopUp/NotificationPopUp.d.ts +26 -26
- package/lib/components/notificationPopUp/NotificationPopUp.js +33 -34
- package/lib/components/notificationPopUp/NotificationPopUp.module.css +4 -0
- package/lib/components/privateRoute/PrivateRoute.d.ts +6 -6
- package/lib/components/privateRoute/PrivateRoute.js +15 -15
- package/lib/components/quoteWrapper/QuoteWrapper.d.ts +7 -7
- package/lib/components/quoteWrapper/QuoteWrapper.js +5 -5
- package/lib/components/quoteWrapper/QuoteWrapper.module.css +12 -12
- package/lib/components/tag/Tag.d.ts +10 -10
- package/lib/components/tag/Tag.js +6 -6
- package/lib/components/tag/Tag.module.css +44 -44
- package/lib/components/toolTip/ToolTip.d.ts +9 -9
- package/lib/components/toolTip/ToolTip.js +8 -8
- package/lib/components/topNav/index.d.ts +3 -3
- package/lib/components/topNav/index.js +3 -3
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.d.ts +20 -20
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.js +17 -17
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.module.css +4 -0
- package/lib/components/topNav/secondaryTopNav/SecondaryTopNav.d.ts +12 -12
- package/lib/components/topNav/secondaryTopNav/SecondaryTopNav.js +7 -7
- package/lib/components/topNav/secondaryTopNav/SecondaryTopNav.module.css +4 -0
- package/lib/index.d.ts +25 -26
- package/lib/index.js +18 -19
- package/package.json +1 -9
- package/src/components/badgeCounter/BadgeCounter.module.css +27 -27
- package/src/components/card/horizontalImageCard/HorizontalImageCard.module.css +5 -1
- package/src/components/card/horizontalImageCard/HorizontalImageCard.tsx +6 -4
- package/src/components/card/index.js +5 -5
- package/src/components/card/index.tsx +0 -2
- package/src/components/card/infoCard/InfoCard.module.css +26 -26
- package/src/components/codeBlock/CodeBlock.module.css +6 -6
- package/src/components/container/Container.js +3 -3
- package/src/components/denhaag-wrappers/breadcrumbs/Breadcrumbs.css +222 -222
- package/src/components/denhaag-wrappers/breadcrumbs/Breadcrumbs.js +84 -84
- package/src/components/formFields/checkbox/Checkbox.module.css +7 -7
- package/src/components/formFields/createKeyValue/CreateKeyValue.module.css +9 -0
- package/src/components/formFields/createKeyValue/CreateKeyValue.tsx +13 -6
- package/src/components/formFields/date/Date.module.css +12 -12
- package/src/components/formFields/index.js +4 -4
- package/src/components/formFields/index.tsx +0 -2
- package/src/components/formFields/textarea.js +3 -3
- package/src/components/formFields/types.js +1 -1
- package/src/components/imageDivider/ImageDivider.js +6 -6
- package/src/components/imageDivider/imageDivider.module.css +5 -5
- package/src/components/logo/Logo.js +10 -10
- package/src/components/logo/Logo.module.css +15 -15
- package/src/components/metaIcon/MetaIcon.js +3 -3
- package/src/components/metaIcon/MetaIcon.module.css +29 -29
- package/src/components/notificationPopUp/NotificationPopUp.module.css +4 -0
- package/src/components/notificationPopUp/NotificationPopUp.tsx +26 -28
- package/src/components/privateRoute/PrivateRoute.js +15 -15
- package/src/components/quoteWrapper/QuoteWrapper.module.css +12 -12
- package/src/components/tag/Tag.module.css +44 -44
- package/src/components/topNav/index.ts +4 -4
- package/src/components/topNav/primaryTopNav/PrimaryTopNav.module.css +4 -0
- package/src/components/topNav/primaryTopNav/PrimaryTopNav.tsx +5 -3
- package/src/components/topNav/secondaryTopNav/SecondaryTopNav.module.css +4 -0
- package/src/components/topNav/secondaryTopNav/SecondaryTopNav.tsx +3 -2
- package/src/custom.d.ts +4 -4
- package/src/index.ts +1 -13
- package/.github/workflows/npm-publish.yml +0 -39
- package/lib/components/statusSteps/StatusSteps.d.ts +0 -13
- package/lib/components/statusSteps/StatusSteps.js +0 -5
- package/src/components/card/richContentCard/RichContentCard.js +0 -18
- package/src/components/card/richContentCard/RichContentCard.module.css +0 -93
- package/src/components/card/richContentCard/RichContentCard.tsx +0 -99
- package/src/components/editableTableRow/EditableTableRow.js +0 -34
- package/src/components/editableTableRow/EditableTableRow.module.css +0 -25
- package/src/components/editableTableRow/EditableTableRow.tsx +0 -138
- package/src/components/formFields/radio.tsx +0 -21
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
interface IStatusStep {
|
|
3
|
-
title: string;
|
|
4
|
-
checked?: boolean;
|
|
5
|
-
current?: boolean;
|
|
6
|
-
expanded?: boolean;
|
|
7
|
-
subSteps?: string[];
|
|
8
|
-
}
|
|
9
|
-
interface StatusStepsProps {
|
|
10
|
-
steps: IStatusStep[];
|
|
11
|
-
}
|
|
12
|
-
export declare const StatusSteps: ({ steps }: StatusStepsProps) => JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Step, StepExpandedIcon, StepHeader, StepHeading, StepList, StepMarker, StepSection, SubStep, SubStepHeading, SubStepList, SubStepMarker, } from "@gemeente-denhaag/process-steps";
|
|
3
|
-
export const StatusSteps = ({ steps }) => {
|
|
4
|
-
return (_jsx(StepList, { children: steps.map(({ title, checked, current, expanded, subSteps }, idx) => (_jsxs(Step, { ...{ checked, current, expanded }, children: [_jsx(StepSection, { children: _jsxs(StepHeader, { children: [_jsx(StepMarker, { children: idx + 1 }), _jsx(StepHeading, { children: title }), subSteps && _jsx(StepExpandedIcon, {})] }) }), subSteps && (_jsx(SubStepList, { children: subSteps.map((subStep) => (_jsxs(SubStep, { children: [_jsx(SubStepMarker, {}), _jsx(SubStepHeading, { children: subStep })] }, idx))) }))] }, idx))) }));
|
|
5
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Divider } from "@gemeente-denhaag/divider";
|
|
3
|
-
import { Link } from "@gemeente-denhaag/link";
|
|
4
|
-
import { navigate } from "gatsby";
|
|
5
|
-
import * as styles from "./RichContentCard.module.css";
|
|
6
|
-
import { ExternalLinkIcon, ArrowRightIcon } from "@gemeente-denhaag/icons";
|
|
7
|
-
export const RichContentCard = ({ link, labelsWithIcon, tags, contentLinks, linkIsExternal, }) => {
|
|
8
|
-
return (_jsxs("div", { className: styles.container, children: [_jsx("div", { className: styles.link, onClick: () => navigate(link.href), children: _jsx(Link, { icon: linkIsExternal ? _jsx(ExternalLinkIcon, {}) : _jsx(ArrowRightIcon, {}), iconAlign: "start", children: link.label }) }), _jsx("div", { className: styles.labelsWithIcon, children: labelsWithIcon.map(({ label, icon }) => (_jsx(LabelWithIcon, { ...{ label, icon } }))) }), _jsx("div", { className: styles.tags, children: tags.map((tag) => (_jsx(Tag, { ...{ tag } }))) }), contentLinks && (_jsxs("div", { className: styles.contentLinks, children: [_jsx(Divider, {}), contentLinks.map(({ title, subTitle, href }) => (_jsx(ContentLink, { ...{ title, subTitle, href } })))] }))] }));
|
|
9
|
-
};
|
|
10
|
-
const LabelWithIcon = ({ label, icon }) => {
|
|
11
|
-
return (_jsxs("div", { className: styles.labelWithIcon, children: [_jsx("span", { className: styles.labelWithIcon_icon, children: icon }), _jsx("span", { className: styles.labelWithIcon_label, children: label })] }));
|
|
12
|
-
};
|
|
13
|
-
const Tag = ({ tag }) => {
|
|
14
|
-
return _jsx("span", { className: styles.tag, children: tag });
|
|
15
|
-
};
|
|
16
|
-
const ContentLink = ({ title, subTitle, href }) => {
|
|
17
|
-
return (_jsxs(Link, { className: styles.contentLink, children: [_jsxs("div", { className: styles.contentLink_content, children: [_jsx("span", { className: styles.contentLink_title, children: title }), _jsx("span", { className: styles.contentLink_subTitle, children: subTitle })] }), _jsx("div", { children: _jsx(ArrowRightIcon, {}) })] }));
|
|
18
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--conduction-rich-content-card-border: 1px solid var(--skeleton-color-grey-2);
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.container {
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
border: var(--conduction-rich-content-card-border);
|
|
9
|
-
border-radius: var(--skeleton-border-radius-md);
|
|
10
|
-
|
|
11
|
-
padding-inline-start: var(--skeleton-size-md);
|
|
12
|
-
padding-inline-end: var(--skeleton-size-md);
|
|
13
|
-
padding-block-start: var(--skeleton-size-md);
|
|
14
|
-
padding-block-end: var(--skeleton-size-md);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.container > *:not(.link):not(:last-child) {
|
|
18
|
-
margin-block-end: var(--skeleton-size-md);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.link {
|
|
22
|
-
margin-block-end: var(--skeleton-size-xs);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.link > :first-child {
|
|
26
|
-
display: flex;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.labelsWithIcon {
|
|
30
|
-
display: flex;
|
|
31
|
-
flex-wrap: wrap;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.labelsWithIcon > *:not(:last-child) {
|
|
35
|
-
margin-inline-end: var(--skeleton-size-md);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.tags > *:not(:last-child) {
|
|
39
|
-
margin-inline-end: var(--skeleton-size-md);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.contentLinks > *:not(:last-child):not(hr) {
|
|
43
|
-
margin-block-end: var(--skeleton-size-xs);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/* Component: LabelWithIcon */
|
|
47
|
-
.labelWithIcon {
|
|
48
|
-
display: flex;
|
|
49
|
-
align-items: center;
|
|
50
|
-
color: var(--skeleton-color-grey-3);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.labelWithIcon > .labelWithIcon_icon > svg {
|
|
54
|
-
height: var(--skeleton-size-sm);
|
|
55
|
-
width: var(--skeleton-size-sm);
|
|
56
|
-
margin-inline-end: var(--skeleton-size-xs);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.labelWithIcon > .labelWithIcon_label {
|
|
60
|
-
font-size: var(--skeleton-size-sm);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/* Content Link */
|
|
64
|
-
.contentLink {
|
|
65
|
-
display: flex;
|
|
66
|
-
padding-block-start: var(--skeleton-size-xs);
|
|
67
|
-
padding-block-end: var(--skeleton-size-xs);
|
|
68
|
-
text-decoration: none !important;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.contentLink > span {
|
|
72
|
-
width: 100%;
|
|
73
|
-
display: flex;
|
|
74
|
-
justify-content: space-between;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.contentLink:hover {
|
|
78
|
-
cursor: pointer;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.contentLink_content {
|
|
82
|
-
display: flex;
|
|
83
|
-
flex-direction: column;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.contentLink_title {
|
|
87
|
-
font-size: var(--conduction-content-link-font-size);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.contentLink_subTitle {
|
|
91
|
-
font-size: var(--conduction-content-link-font-size);
|
|
92
|
-
color: var(--denhaag-color-grey-3);
|
|
93
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Divider } from "@gemeente-denhaag/divider";
|
|
2
|
-
import { Link } from "@gemeente-denhaag/link";
|
|
3
|
-
import { navigate } from "gatsby";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import * as styles from "./RichContentCard.module.css";
|
|
6
|
-
import { ExternalLinkIcon, ArrowRightIcon } from "@gemeente-denhaag/icons";
|
|
7
|
-
import { Tag } from "../../tag/Tag";
|
|
8
|
-
|
|
9
|
-
export interface RichContentCardProps {
|
|
10
|
-
link: {
|
|
11
|
-
label: string;
|
|
12
|
-
href: string;
|
|
13
|
-
};
|
|
14
|
-
labelsWithIcon: {
|
|
15
|
-
label: string;
|
|
16
|
-
icon: JSX.Element;
|
|
17
|
-
}[];
|
|
18
|
-
tags: string[];
|
|
19
|
-
contentLinks?: {
|
|
20
|
-
title: string;
|
|
21
|
-
subTitle: string;
|
|
22
|
-
href: string;
|
|
23
|
-
}[];
|
|
24
|
-
linkIsExternal?: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const RichContentCard = ({
|
|
28
|
-
link,
|
|
29
|
-
labelsWithIcon,
|
|
30
|
-
tags,
|
|
31
|
-
contentLinks,
|
|
32
|
-
linkIsExternal,
|
|
33
|
-
}: RichContentCardProps): JSX.Element => {
|
|
34
|
-
return (
|
|
35
|
-
<div className={styles.container}>
|
|
36
|
-
<div className={styles.link} onClick={() => navigate(link.href)}>
|
|
37
|
-
<Link icon={linkIsExternal ? <ExternalLinkIcon /> : <ArrowRightIcon />} iconAlign="start">
|
|
38
|
-
{link.label}
|
|
39
|
-
</Link>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<div className={styles.labelsWithIcon}>
|
|
43
|
-
{labelsWithIcon.map(({ label, icon }, idx) => (
|
|
44
|
-
<LabelWithIcon key={idx} {...{ label, icon }} />
|
|
45
|
-
))}
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
<div className={styles.tags}>
|
|
49
|
-
{tags.map((tag, idx) => (
|
|
50
|
-
<Tag key={idx} label={tag} />
|
|
51
|
-
))}
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
{contentLinks && (
|
|
55
|
-
<div className={styles.contentLinks}>
|
|
56
|
-
<Divider />
|
|
57
|
-
{contentLinks.map(({ title, subTitle, href }, idx) => (
|
|
58
|
-
<ContentLink key={idx} {...{ title, subTitle, href }} />
|
|
59
|
-
))}
|
|
60
|
-
</div>
|
|
61
|
-
)}
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
interface LabelWithIconProps {
|
|
67
|
-
label: string;
|
|
68
|
-
icon: JSX.Element;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const LabelWithIcon = ({ label, icon }: LabelWithIconProps): JSX.Element => {
|
|
72
|
-
return (
|
|
73
|
-
<div className={styles.labelWithIcon}>
|
|
74
|
-
<span className={styles.labelWithIcon_icon}>{icon}</span>
|
|
75
|
-
<span className={styles.labelWithIcon_label}>{label}</span>
|
|
76
|
-
</div>
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
interface ContentLinkProps {
|
|
81
|
-
title: string;
|
|
82
|
-
subTitle: string;
|
|
83
|
-
href: string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const ContentLink = ({ title, subTitle, href }: ContentLinkProps): JSX.Element => {
|
|
87
|
-
return (
|
|
88
|
-
<Link className={styles.contentLink}>
|
|
89
|
-
<div className={styles.contentLink_content}>
|
|
90
|
-
<span className={styles.contentLink_title}>{title}</span>
|
|
91
|
-
<span className={styles.contentLink_subTitle}>{subTitle}</span>
|
|
92
|
-
</div>
|
|
93
|
-
|
|
94
|
-
<div>
|
|
95
|
-
<ArrowRightIcon />
|
|
96
|
-
</div>
|
|
97
|
-
</Link>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { TableCell, TableHeader, TableRow } from "@gemeente-denhaag/table";
|
|
3
|
-
import * as styles from "./EditableTableRow.module.css";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import { useTranslation } from "react-i18next";
|
|
6
|
-
import { Link } from "@gemeente-denhaag/link";
|
|
7
|
-
import { CheckedIcon, CloseIcon, EditIcon } from "@gemeente-denhaag/icons";
|
|
8
|
-
import { useForm } from "react-hook-form";
|
|
9
|
-
import { InputEmail, InputText } from "../formFields";
|
|
10
|
-
export const EditableTableRow = ({ thead, value, inputType, handleSave, }) => {
|
|
11
|
-
const [editing, setEditing] = React.useState(false);
|
|
12
|
-
return (_jsxs(TableRow, { children: [_jsx(TableHeader, { className: styles.th, children: thead }), editing && _jsx(EditingTableRow, { ...{ value, inputType, handleSave, setEditing } }), !editing && _jsx(RegularTableRow, { ...{ value, setEditing } })] }));
|
|
13
|
-
};
|
|
14
|
-
const RegularTableRow = ({ value, setEditing }) => {
|
|
15
|
-
const { t } = useTranslation();
|
|
16
|
-
return (_jsxs(_Fragment, { children: [_jsx(TableCell, { children: value }), _jsx(TableCell, { children: _jsx("div", { className: styles.editButton, onClick: () => setEditing(true), children: _jsx(Link, { icon: _jsx(EditIcon, {}), iconAlign: "start", children: t("Edit") }) }) })] }));
|
|
17
|
-
};
|
|
18
|
-
const EditingTableRow = ({ value, setEditing, handleSave, inputType, }) => {
|
|
19
|
-
const { t } = useTranslation();
|
|
20
|
-
const { register, handleSubmit, formState: { errors }, } = useForm();
|
|
21
|
-
const onSubmit = (data) => {
|
|
22
|
-
handleSave(data.value);
|
|
23
|
-
setEditing(false);
|
|
24
|
-
};
|
|
25
|
-
return (_jsxs(_Fragment, { children: [_jsx(TableCell, { children: _jsxs("form", { onSubmit: handleSubmit(onSubmit), children: [_jsx(FormField, { ...{ inputType, value, register, errors } }), _jsxs("div", { className: styles.editButtonsContainer, children: [_jsx("button", { type: "submit", className: styles.submit, children: _jsx(Link, { icon: _jsx(CheckedIcon, {}), iconAlign: "start", children: t("Save") }) }), _jsx("div", { onClick: () => setEditing(false), children: _jsx(Link, { icon: _jsx(CloseIcon, {}), iconAlign: "start", className: styles.cancel, children: t("Cancel") }) })] })] }) }), _jsx(TableCell, {})] }));
|
|
26
|
-
};
|
|
27
|
-
const FormField = ({ inputType, value, register, errors }) => {
|
|
28
|
-
switch (inputType) {
|
|
29
|
-
case "email":
|
|
30
|
-
return _jsx(InputEmail, { defaultValue: value, ...{ register, errors }, name: "value", validation: { required: true } });
|
|
31
|
-
case "text":
|
|
32
|
-
return _jsx(InputText, { defaultValue: value, ...{ register, errors }, name: "value", validation: { required: true } });
|
|
33
|
-
}
|
|
34
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
.th {
|
|
2
|
-
width: 35%;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.cancel {
|
|
6
|
-
color: var(--skeleton-color-grey-3) !important;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.editButtonsContainer {
|
|
10
|
-
display: flex;
|
|
11
|
-
margin-block-start: var(--skeleton-size-xs);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.editButtonsContainer > *:not(:last-child) {
|
|
15
|
-
margin-inline-end: var(--skeleton-size-md);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.submit {
|
|
19
|
-
all: unset;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.editButton {
|
|
23
|
-
display: flex;
|
|
24
|
-
justify-content: flex-end;
|
|
25
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { TableCell, TableHeader, TableRow } from "@gemeente-denhaag/table";
|
|
2
|
-
import * as styles from "./EditableTableRow.module.css";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { Link } from "@gemeente-denhaag/link";
|
|
5
|
-
import { CheckedIcon, CloseIcon, EditIcon } from "@gemeente-denhaag/icons";
|
|
6
|
-
import { FieldValues, useForm, UseFormRegister } from "react-hook-form";
|
|
7
|
-
import { InputEmail, InputText } from "../formFields";
|
|
8
|
-
|
|
9
|
-
interface InputTypes {
|
|
10
|
-
inputType: "text" | "email";
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface EditableTableRowProps {
|
|
14
|
-
thead: string;
|
|
15
|
-
value: string;
|
|
16
|
-
saveLabel: string;
|
|
17
|
-
cancelLabel: string;
|
|
18
|
-
editLabel: string;
|
|
19
|
-
handleSave: (value: any) => void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const EditableTableRow = ({
|
|
23
|
-
thead,
|
|
24
|
-
value,
|
|
25
|
-
inputType,
|
|
26
|
-
editLabel,
|
|
27
|
-
cancelLabel,
|
|
28
|
-
saveLabel,
|
|
29
|
-
handleSave,
|
|
30
|
-
}: EditableTableRowProps & InputTypes): JSX.Element => {
|
|
31
|
-
const [editing, setEditing] = React.useState<boolean>(false);
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<TableRow>
|
|
35
|
-
<TableHeader className={styles.th}>{thead}</TableHeader>
|
|
36
|
-
|
|
37
|
-
{editing && <EditingTableRow {...{ value, inputType, handleSave, setEditing, saveLabel, cancelLabel }} />}
|
|
38
|
-
{!editing && <RegularTableRow {...{ value, setEditing, editLabel }} />}
|
|
39
|
-
</TableRow>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Specific rows based on editing (Regular: not editing & Editing: editing)
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
interface RegularTableRowProps {
|
|
48
|
-
value: string;
|
|
49
|
-
editLabel: string;
|
|
50
|
-
setEditing: React.Dispatch<React.SetStateAction<boolean>>;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const RegularTableRow = ({ value, editLabel, setEditing }: RegularTableRowProps): JSX.Element => {
|
|
54
|
-
return (
|
|
55
|
-
<>
|
|
56
|
-
<TableCell>{value}</TableCell>
|
|
57
|
-
|
|
58
|
-
<TableCell>
|
|
59
|
-
<div className={styles.editButton} onClick={() => setEditing(true)}>
|
|
60
|
-
<Link icon={<EditIcon />} iconAlign="start">
|
|
61
|
-
{editLabel}
|
|
62
|
-
</Link>
|
|
63
|
-
</div>
|
|
64
|
-
</TableCell>
|
|
65
|
-
</>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
interface EditingTableRowProps {
|
|
70
|
-
value: string;
|
|
71
|
-
setEditing: React.Dispatch<React.SetStateAction<boolean>>;
|
|
72
|
-
saveLabel: string;
|
|
73
|
-
cancelLabel: string;
|
|
74
|
-
handleSave: (value: any) => void;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const EditingTableRow = ({
|
|
78
|
-
value,
|
|
79
|
-
setEditing,
|
|
80
|
-
handleSave,
|
|
81
|
-
inputType,
|
|
82
|
-
saveLabel,
|
|
83
|
-
cancelLabel,
|
|
84
|
-
}: EditingTableRowProps & InputTypes): JSX.Element => {
|
|
85
|
-
const {
|
|
86
|
-
register,
|
|
87
|
-
handleSubmit,
|
|
88
|
-
formState: { errors },
|
|
89
|
-
} = useForm();
|
|
90
|
-
|
|
91
|
-
const onSubmit = (data: any): void => {
|
|
92
|
-
handleSave(data.value);
|
|
93
|
-
setEditing(false);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<>
|
|
98
|
-
<TableCell>
|
|
99
|
-
<form onSubmit={handleSubmit(onSubmit)}>
|
|
100
|
-
<FormField {...{ inputType, value, register, errors }} />
|
|
101
|
-
|
|
102
|
-
<div className={styles.editButtonsContainer}>
|
|
103
|
-
<button type="submit" className={styles.submit}>
|
|
104
|
-
<Link icon={<CheckedIcon />} iconAlign="start">
|
|
105
|
-
{saveLabel}
|
|
106
|
-
</Link>
|
|
107
|
-
</button>
|
|
108
|
-
|
|
109
|
-
<div onClick={() => setEditing(false)}>
|
|
110
|
-
<Link icon={<CloseIcon />} iconAlign="start" className={styles.cancel}>
|
|
111
|
-
{cancelLabel}
|
|
112
|
-
</Link>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
</form>
|
|
116
|
-
</TableCell>
|
|
117
|
-
|
|
118
|
-
<TableCell />
|
|
119
|
-
</>
|
|
120
|
-
);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
interface FormFieldProps {
|
|
124
|
-
value: string;
|
|
125
|
-
register: UseFormRegister<FieldValues>;
|
|
126
|
-
errors: {
|
|
127
|
-
[x: string]: any;
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const FormField = ({ inputType, value, register, errors }: FormFieldProps & InputTypes): JSX.Element => {
|
|
132
|
-
switch (inputType) {
|
|
133
|
-
case "email":
|
|
134
|
-
return <InputEmail defaultValue={value} {...{ register, errors }} name="value" validation={{ required: true }} />;
|
|
135
|
-
case "text":
|
|
136
|
-
return <InputText defaultValue={value} {...{ register, errors }} name="value" validation={{ required: true }} />;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { FormControlLabel } from "@gemeente-denhaag/formcontrollabel";
|
|
2
|
-
import { IReactHookFormProps } from "./types";
|
|
3
|
-
|
|
4
|
-
interface IRadioProps {
|
|
5
|
-
label: string;
|
|
6
|
-
name: string;
|
|
7
|
-
value: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const InputRadio = ({
|
|
11
|
-
name,
|
|
12
|
-
validation,
|
|
13
|
-
register,
|
|
14
|
-
label,
|
|
15
|
-
value,
|
|
16
|
-
}: IRadioProps & IReactHookFormProps): JSX.Element => (
|
|
17
|
-
<FormControlLabel
|
|
18
|
-
input={<input type="radio" {...{ value }} {...register(name, { ...validation })} />}
|
|
19
|
-
{...{ label }}
|
|
20
|
-
/>
|
|
21
|
-
);
|