@conduction/components 2.1.40 → 2.2.0
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/README.md +14 -0
- package/lib/components/card/horizontalImageCard/HorizontalImageCard.js +2 -2
- package/lib/components/card/horizontalImageCard/HorizontalImageCard.module.css +5 -1
- package/lib/components/card/richContentCard/RichContentCard.js +3 -4
- package/lib/components/card/richContentCard/RichContentCard.module.css +13 -3
- package/lib/components/formFields/createKeyValue/CreateKeyValue.js +2 -2
- package/lib/components/formFields/createKeyValue/CreateKeyValue.module.css +9 -0
- package/lib/components/formFields/index.d.ts +1 -2
- package/lib/components/formFields/index.js +1 -2
- package/lib/components/notificationPopUp/NotificationPopUp.js +2 -4
- package/lib/components/notificationPopUp/NotificationPopUp.module.css +4 -0
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.js +2 -2
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.module.css +4 -0
- package/lib/components/topNav/secondaryTopNav/SecondaryTopNav.js +3 -3
- package/lib/components/topNav/secondaryTopNav/SecondaryTopNav.module.css +4 -0
- package/lib/custom.d copy.d.ts +5 -0
- package/lib/custom.d copy.js +1 -0
- package/lib/index.d.ts +2 -3
- package/lib/index.js +2 -3
- package/package.json +1 -8
- package/src/components/card/horizontalImageCard/HorizontalImageCard.module.css +5 -1
- package/src/components/card/horizontalImageCard/HorizontalImageCard.tsx +4 -3
- package/src/components/card/richContentCard/RichContentCard.module.css +13 -3
- package/src/components/card/richContentCard/RichContentCard.tsx +6 -6
- package/src/components/formFields/createKeyValue/CreateKeyValue.module.css +9 -0
- package/src/components/formFields/createKeyValue/CreateKeyValue.tsx +13 -6
- package/src/components/formFields/index.tsx +0 -2
- package/src/components/notificationPopUp/NotificationPopUp.module.css +4 -0
- package/src/components/notificationPopUp/NotificationPopUp.tsx +24 -27
- 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/index.ts +0 -4
- 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
package/README.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## Changelog
|
|
4
4
|
|
|
5
|
+
- **Version 2.2 (breaking changes from 2.1.x)**
|
|
6
|
+
|
|
7
|
+
- 2.2.0:
|
|
8
|
+
- Removed Den Haag designTokensComponent.
|
|
9
|
+
- Removed Den Haag formControlLabel.
|
|
10
|
+
- Removed InputRadio component.
|
|
11
|
+
- Removed Den Haag stylesProvider.
|
|
12
|
+
- Removed Den Haag link.
|
|
13
|
+
- Removed Den Haag heading.
|
|
14
|
+
- Removed Den Haag paragraph.
|
|
15
|
+
- Removed Den Haag Table imports from CreateKeyValue component.
|
|
16
|
+
- Removed EditableTableRow component.
|
|
17
|
+
- Removed Den Haag divider.
|
|
18
|
+
|
|
5
19
|
- **Version 2.1 (breaking changes from 2.0.x)**
|
|
6
20
|
|
|
7
21
|
- 2.1.40:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as styles from "./HorizontalImageCard.module.css";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import { Link } from "@
|
|
4
|
+
import { Link } from "@utrecht/component-library-react";
|
|
5
5
|
import { navigate } from "gatsby";
|
|
6
6
|
import { ExternalLinkIcon, ArrowRightIcon } from "@gemeente-denhaag/icons";
|
|
7
7
|
export const HorizontalImageCard = ({ title, layoutClassName, external, link, iconOrImage, }) => {
|
|
8
|
-
return (_jsxs("div", { className: clsx(styles.container, [layoutClassName && layoutClassName]), onClick: () => navigate(link.href), children: [_jsx("div", { className: styles.imageOrIconContainer, children: iconOrImage }), _jsxs("div", { className: styles.
|
|
8
|
+
return (_jsxs("div", { className: clsx(styles.container, [layoutClassName && layoutClassName]), onClick: () => navigate(link.href), children: [_jsx("div", { className: styles.imageOrIconContainer, children: iconOrImage }), _jsxs("div", { className: styles.linkContainer, children: [_jsx("div", { className: styles.title, children: title }), _jsxs(Link, { className: styles.link, children: [external ? _jsx(ExternalLinkIcon, {}) : _jsx(ArrowRightIcon, {}), link.label] })] })] }));
|
|
9
9
|
};
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
border-radius: var(--skeleton-border-radius-md);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.
|
|
13
|
+
.linkContainer {
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
padding-block-start: var(--skeleton-size-lg);
|
|
@@ -32,3 +32,7 @@
|
|
|
32
32
|
font-weight: var(--skeleton-font-weight-bold);
|
|
33
33
|
font-size: var(--skeleton-font-size-xl);
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
.link > * {
|
|
37
|
+
margin-inline-end: 8px;
|
|
38
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
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
2
|
import * as styles from "./RichContentCard.module.css";
|
|
3
|
+
import { Link } from "@utrecht/component-library-react/dist/css-module";
|
|
4
|
+
import { navigate } from "gatsby";
|
|
6
5
|
import { ExternalLinkIcon, ArrowRightIcon } from "@gemeente-denhaag/icons";
|
|
7
6
|
import { Tag } from "../../tag/Tag";
|
|
8
7
|
export const RichContentCard = ({ link, labelsWithIcon, tags, contentLinks, linkIsExternal, }) => {
|
|
9
|
-
return (_jsxs("div", { className: styles.container, children: [_jsx("div", { className: styles.
|
|
8
|
+
return (_jsxs("div", { className: styles.container, children: [_jsx("div", { className: styles.linkContainer, onClick: () => navigate(link.href), children: _jsxs(Link, { className: styles.link, children: [linkIsExternal ? _jsx(ExternalLinkIcon, {}) : _jsx(ArrowRightIcon, {}), link.label] }) }), _jsx("div", { className: styles.labelsWithIcon, children: labelsWithIcon.map(({ label, icon }, idx) => (_jsx(LabelWithIcon, { ...{ label, icon } }, idx))) }), _jsx("div", { className: styles.tags, children: tags.map((tag, idx) => (_jsx(Tag, { label: tag }, idx))) }), contentLinks && (_jsxs("div", { className: styles.contentLinks, children: [_jsx("hr", { className: styles.divider }), contentLinks.map(({ title, subTitle, href }, idx) => (_jsx(ContentLink, { ...{ title, subTitle, href } }, idx)))] }))] }));
|
|
10
9
|
};
|
|
11
10
|
const LabelWithIcon = ({ label, icon }) => {
|
|
12
11
|
return (_jsxs("div", { className: styles.labelWithIcon, children: [_jsx("span", { className: styles.labelWithIcon_icon, children: icon }), _jsx("span", { className: styles.labelWithIcon_label, children: label })] }));
|
|
@@ -14,18 +14,22 @@
|
|
|
14
14
|
padding-block-end: var(--skeleton-size-md);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.container > *:not(.
|
|
17
|
+
.container > *:not(.linkContainer):not(:last-child) {
|
|
18
18
|
margin-block-end: var(--skeleton-size-md);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.
|
|
21
|
+
.linkContainer {
|
|
22
22
|
margin-block-end: var(--skeleton-size-xs);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
.
|
|
25
|
+
.linkContainer > :first-child {
|
|
26
26
|
display: flex;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
.link > * {
|
|
30
|
+
margin-inline-end: 8px;
|
|
31
|
+
}
|
|
32
|
+
|
|
29
33
|
.labelsWithIcon {
|
|
30
34
|
display: flex;
|
|
31
35
|
flex-wrap: wrap;
|
|
@@ -91,3 +95,9 @@
|
|
|
91
95
|
font-size: var(--conduction-content-link-font-size);
|
|
92
96
|
color: var(--denhaag-color-grey-3);
|
|
93
97
|
}
|
|
98
|
+
|
|
99
|
+
.divider {
|
|
100
|
+
width: 100%;
|
|
101
|
+
opacity: 0.5;
|
|
102
|
+
margin-block: var(--skeleton-size-lg);
|
|
103
|
+
}
|
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import * as styles from "./CreateKeyValue.module.css";
|
|
4
4
|
import { Controller } from "react-hook-form";
|
|
5
5
|
import { Button } from "@gemeente-denhaag/button";
|
|
6
|
-
import { Table, TableBody, TableCell,
|
|
6
|
+
import { Table, TableBody, TableCell, TableHeaderCell, TableHeader, TableRow, } from "@utrecht/component-library-react/dist/css-module";
|
|
7
7
|
import { ToolTip } from "../../toolTip/ToolTip";
|
|
8
8
|
import clsx from "clsx";
|
|
9
9
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
@@ -38,5 +38,5 @@ const KeyValueComponent = ({ defaultValue, handleChange, disabled, copyValue, })
|
|
|
38
38
|
React.useEffect(() => {
|
|
39
39
|
handleChange(keyValues);
|
|
40
40
|
}, [keyValues]);
|
|
41
|
-
return (_jsxs("div", { className: styles.keyValue, children: [keyValues && (_jsxs(Table, { className: styles.table, children: [_jsx(
|
|
41
|
+
return (_jsxs("div", { className: styles.keyValue, children: [keyValues && (_jsxs(Table, { className: styles.table, children: [_jsx(TableHeader, { className: styles.tableHeader, children: _jsxs(TableRow, { children: [_jsx(TableHeaderCell, { children: "Key" }), _jsx(TableHeaderCell, { children: "Value" }), _jsx(TableHeaderCell, {})] }) }), _jsx(TableBody, { children: keyValues.map((keyValue, idx) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: keyValue.key }), _jsx(TableCell, { children: keyValue.value }), _jsx(TableCell, { children: _jsxs("div", { className: styles.buttonsContainer, children: [copyValue && (_jsx(ToolTip, { tooltip: "Copy value", children: _jsx(Button, { ...{ disabled }, onClick: () => handleCopyToClipboard(keyValue.value, idx), variant: currentCopyIdx === idx ? "secondary-action" : "primary-action", children: _jsx(FontAwesomeIcon, { icon: faCopy }) }) })), _jsx(ToolTip, { tooltip: "Delete value", children: _jsx(Button, { ...{ disabled }, onClick: () => setKeyValues(keyValues.filter((_keyValue) => _keyValue !== keyValue)), className: clsx(styles.deleteButton), children: _jsx(FontAwesomeIcon, { icon: faTrash }) }) })] }) })] }, `${keyValue.key}${keyValue.value}${idx}`))) })] })), _jsxs("div", { className: styles.form, children: [_jsx("input", { type: "text", placeholder: "Key", value: currentKey, ref: currentKeyRef, className: "denhaag-textfield__input", onChange: (e) => setCurrentKey(e.target.value), ...{ disabled } }), _jsx("input", { type: "text", placeholder: "Value", value: currentValue, ref: currentValueRef, className: "denhaag-textfield__input", onChange: (e) => setCurrentValue(e.target.value), ...{ disabled } }), _jsx(Button, { onClick: handleCreate, disabled: !currentKey || !currentValue || disabled, children: "Add" })] })] }));
|
|
42
42
|
};
|
|
@@ -12,6 +12,15 @@
|
|
|
12
12
|
|
|
13
13
|
.table {
|
|
14
14
|
border-collapse: collapse;
|
|
15
|
+
background-color: var(--utrecht-table-background-color);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.tableHeader > * {
|
|
19
|
+
border-block-end: var(--utrecht-table-header-border-block-end-width) solid var(--utrecht-table-header-border-block-end-color);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.tableHeader {
|
|
23
|
+
font-family: var(--utrecht-table-header-font-family);
|
|
15
24
|
}
|
|
16
25
|
|
|
17
26
|
.table td,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { InputText, InputPassword, InputEmail, InputURL, InputNumber, InputFile } from "./input";
|
|
2
2
|
import { Textarea } from "./textarea";
|
|
3
3
|
import { InputCheckbox } from "./checkbox/checkbox";
|
|
4
|
-
import { InputRadio } from "./radio";
|
|
5
4
|
import { SelectSingle, SelectMultiple, SelectCreate } from "./select/select";
|
|
6
5
|
import { CreateKeyValue, IKeyValue } from "./createKeyValue/CreateKeyValue";
|
|
7
6
|
import { InputDate } from "./date/Date";
|
|
8
|
-
export {
|
|
7
|
+
export { InputText, InputPassword, InputEmail, InputURL, InputDate, InputNumber, InputCheckbox, InputFile, Textarea, SelectSingle, SelectMultiple, SelectCreate, CreateKeyValue, IKeyValue, };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { InputText, InputPassword, InputEmail, InputURL, InputNumber, InputFile } from "./input";
|
|
2
2
|
import { Textarea } from "./textarea";
|
|
3
3
|
import { InputCheckbox } from "./checkbox/checkbox";
|
|
4
|
-
import { InputRadio } from "./radio";
|
|
5
4
|
import { SelectSingle, SelectMultiple, SelectCreate } from "./select/select";
|
|
6
5
|
import { CreateKeyValue } from "./createKeyValue/CreateKeyValue";
|
|
7
6
|
import { InputDate } from "./date/Date";
|
|
8
|
-
export {
|
|
7
|
+
export { InputText, InputPassword, InputEmail, InputURL, InputDate, InputNumber, InputCheckbox, InputFile, Textarea, SelectSingle, SelectMultiple, SelectCreate, CreateKeyValue, };
|
|
@@ -3,11 +3,9 @@ import * as React from "react";
|
|
|
3
3
|
import * as styles from "./NotificationPopUp.module.css";
|
|
4
4
|
import ReactDOM from "react-dom";
|
|
5
5
|
import { Button } from "@gemeente-denhaag/button";
|
|
6
|
-
import { Heading3, Paragraph } from "@gemeente-denhaag/typography";
|
|
7
|
-
import { Link } from "@gemeente-denhaag/link";
|
|
8
|
-
import { StylesProvider } from "@gemeente-denhaag/stylesprovider";
|
|
9
6
|
import clsx from "clsx";
|
|
10
7
|
import { CloseIcon, ArrowRightIcon } from "@gemeente-denhaag/icons";
|
|
8
|
+
import { Heading3, Link, Paragraph } from "@utrecht/component-library-react";
|
|
11
9
|
export const NotificationPopUp = ({ title, description, isVisible, hide, primaryButton, secondaryButton, layoutClassName, }) => {
|
|
12
10
|
const [animationVisible, setAnimationVisible] = React.useState(true);
|
|
13
11
|
const animationDuration = parseInt(styles.animationDuration, 10);
|
|
@@ -19,7 +17,7 @@ export const NotificationPopUp = ({ title, description, isVisible, hide, primary
|
|
|
19
17
|
setAnimationVisible(true);
|
|
20
18
|
}, animationDuration);
|
|
21
19
|
};
|
|
22
|
-
const modal = (
|
|
20
|
+
const modal = (_jsxs("div", { style: { animationDuration: `${animationDuration}ms` }, className: clsx(styles.modal, animationVisible && styles.visible, layoutClassName), children: [_jsx(Heading3, { children: title }), _jsx(Paragraph, { children: description }), _jsxs("div", { className: styles.buttons, children: [secondaryButton && (_jsx("div", { onClick: () => handleClick(secondaryButton.handleClick), className: secondaryButton.layoutClassName, children: _jsxs(Link, { className: styles.link, children: [secondaryButton.icon ?? _jsx(CloseIcon, {}), secondaryButton.label] }) })), _jsx(Button, { icon: primaryButton.icon ?? _jsx(ArrowRightIcon, {}), onClick: () => handleClick(primaryButton.handleClick), className: primaryButton.layoutClassName, children: primaryButton.label })] })] }));
|
|
23
21
|
return isVisible ? ReactDOM.createPortal(modal, document.body) : null;
|
|
24
22
|
};
|
|
25
23
|
export const NotificationPopUpController = () => {
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as styles from "./PrimaryTopNav.module.css";
|
|
4
4
|
import clsx from "clsx";
|
|
5
|
-
import { Link } from "@
|
|
5
|
+
import { Link } from "@utrecht/component-library-react/dist/css-module";
|
|
6
6
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
7
7
|
import { faBars } from "@fortawesome/free-solid-svg-icons";
|
|
8
8
|
export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName }) => {
|
|
@@ -13,5 +13,5 @@ export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName }) => {
|
|
|
13
13
|
setIsOpen(false);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
return (_jsxs("div", { className: clsx(styles.container, layoutClassName && layoutClassName), children: [_jsxs("div", { className: styles.menuToggleContainer, children: [mobileLogo, _jsx("button", { className: styles.menuToggle, onClick: () => setIsOpen((o) => !o), children: _jsx(FontAwesomeIcon, { icon: faBars }) })] }), _jsx("nav", { className: clsx(styles.primary, isOpen && styles.isOpen), children: _jsx("ul", { className: styles.ul, children: items.map(({ label, icon, current, handleClick, subItems }, idx) => (_jsxs("li", { onClick: () => handleItemClick(handleClick), className: clsx(styles.li, current && styles.current), children: [
|
|
16
|
+
return (_jsxs("div", { className: clsx(styles.container, layoutClassName && layoutClassName), children: [_jsxs("div", { className: styles.menuToggleContainer, children: [mobileLogo, _jsx("button", { className: styles.menuToggle, onClick: () => setIsOpen((o) => !o), children: _jsx(FontAwesomeIcon, { icon: faBars }) })] }), _jsx("nav", { className: clsx(styles.primary, isOpen && styles.isOpen), children: _jsx("ul", { className: styles.ul, children: items.map(({ label, icon, current, handleClick, subItems }, idx) => (_jsxs("li", { onClick: () => handleItemClick(handleClick), className: clsx(styles.li, current && styles.current), children: [_jsxs(Link, { className: clsx(styles.link, styles.label), children: [icon, label] }), subItems && (_jsx("ul", { className: styles.dropdown, children: subItems.map(({ label, icon, current, handleClick }, idx) => (_jsx("li", { className: clsx(styles.li, current && styles.current), onClick: () => handleItemClick(handleClick), children: _jsxs(Link, { className: clsx(styles.link, styles.label), children: [icon, label] }) }, idx))) }))] }, idx))) }) })] }));
|
|
17
17
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as styles from "./SecondaryTopNav.module.css";
|
|
3
|
-
import { Link } from "@
|
|
3
|
+
import { Link } from "@utrecht/component-library-react/dist/css-module";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
export const SecondaryTopNav = ({ items, layoutClassName }) => {
|
|
6
|
-
return (_jsx("div", { className: clsx(styles.secondary, layoutClassName && layoutClassName), children: _jsx("nav", { children: _jsx("ul", { className: styles.ul, children: items.map(({ label, icon, current, handleClick }, idx) => (_jsx("li", { className: clsx(styles.li, current && styles.current), onClick: handleClick, children:
|
|
6
|
+
return (_jsx("div", { className: clsx(styles.secondary, layoutClassName && layoutClassName), children: _jsx("nav", { children: _jsx("ul", { className: styles.ul, children: items.map(({ label, icon, current, handleClick }, idx) => (_jsx("li", { className: clsx(styles.li, current && styles.current), onClick: handleClick, children: _jsxs(Link, { className: clsx(styles.link, styles.label), children: [icon, label] }) }, idx))) }) }) }));
|
|
7
7
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/lib/index.d.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { DownloadCard, HorizontalImageCard, ImageAndDetailsCard, RichContentCard, DetailsCard, InfoCard } from "./components/card";
|
|
3
3
|
import { Container } from "./components/container/Container";
|
|
4
4
|
import { Breadcrumbs } from "./components/denhaag-wrappers/breadcrumbs/Breadcrumbs";
|
|
5
|
-
import {
|
|
6
|
-
import { InputText, InputPassword, InputEmail, InputDate, InputNumber, Textarea, InputCheckbox, InputRadio, InputFile, SelectMultiple, SelectSingle } from "./components/formFields";
|
|
5
|
+
import { InputText, InputPassword, InputEmail, InputDate, InputNumber, Textarea, InputCheckbox, InputFile, SelectMultiple, SelectSingle } from "./components/formFields";
|
|
7
6
|
import { ImageDivider } from "./components/imageDivider/ImageDivider";
|
|
8
7
|
import { AuthenticatedLogo, UnauthenticatedLogo } from "./components/logo/Logo";
|
|
9
8
|
import { MetaIcon } from "./components/metaIcon/MetaIcon";
|
|
@@ -23,4 +22,4 @@ import { BadgeCounter } from "./components/badgeCounter/BadgeCounter";
|
|
|
23
22
|
import { CodeBlock } from "./components/codeBlock/CodeBlock";
|
|
24
23
|
import { ToolTip } from "./components/toolTip/ToolTip";
|
|
25
24
|
import { Pagination } from "./components/Pagination/Pagination";
|
|
26
|
-
export {
|
|
25
|
+
export { DownloadCard, HorizontalImageCard, ImageAndDetailsCard, RichContentCard, DetailsCard, InfoCard, Container, Breadcrumbs, InputText, InputPassword, InputEmail, InputDate, InputNumber, InputFile, Textarea, InputCheckbox, SelectMultiple, SelectSingle, ImageDivider, AuthenticatedLogo, UnauthenticatedLogo, MetaIcon, PrivateRoute, PrimaryTopNav, SecondaryTopNav, Tag, NotificationPopUp, QuoteWrapper, Pagination, BadgeCounter, CodeBlock, ToolTip, };
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { DownloadCard, HorizontalImageCard, ImageAndDetailsCard, RichContentCard, DetailsCard, InfoCard, } from "./components/card";
|
|
2
2
|
import { Container } from "./components/container/Container";
|
|
3
3
|
import { Breadcrumbs } from "./components/denhaag-wrappers/breadcrumbs/Breadcrumbs";
|
|
4
|
-
import {
|
|
5
|
-
import { InputText, InputPassword, InputEmail, InputDate, InputNumber, Textarea, InputCheckbox, InputRadio, InputFile, SelectMultiple, SelectSingle, } from "./components/formFields";
|
|
4
|
+
import { InputText, InputPassword, InputEmail, InputDate, InputNumber, Textarea, InputCheckbox, InputFile, SelectMultiple, SelectSingle, } from "./components/formFields";
|
|
6
5
|
import { ImageDivider } from "./components/imageDivider/ImageDivider";
|
|
7
6
|
import { AuthenticatedLogo, UnauthenticatedLogo } from "./components/logo/Logo";
|
|
8
7
|
import { MetaIcon } from "./components/metaIcon/MetaIcon";
|
|
@@ -16,4 +15,4 @@ import { BadgeCounter } from "./components/badgeCounter/BadgeCounter";
|
|
|
16
15
|
import { CodeBlock } from "./components/codeBlock/CodeBlock";
|
|
17
16
|
import { ToolTip } from "./components/toolTip/ToolTip";
|
|
18
17
|
import { Pagination } from "./components/Pagination/Pagination";
|
|
19
|
-
export {
|
|
18
|
+
export { DownloadCard, HorizontalImageCard, ImageAndDetailsCard, RichContentCard, DetailsCard, InfoCard, Container, Breadcrumbs, InputText, InputPassword, InputEmail, InputDate, InputNumber, InputFile, Textarea, InputCheckbox, SelectMultiple, SelectSingle, ImageDivider, AuthenticatedLogo, UnauthenticatedLogo, MetaIcon, PrivateRoute, PrimaryTopNav, SecondaryTopNav, Tag, NotificationPopUp, QuoteWrapper, Pagination, BadgeCounter, CodeBlock, ToolTip, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conduction/components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,19 +24,12 @@
|
|
|
24
24
|
"@fortawesome/free-solid-svg-icons": "^6.2.0",
|
|
25
25
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
26
26
|
"@gemeente-denhaag/button": "0.2.3-alpha.205",
|
|
27
|
-
"@gemeente-denhaag/design-tokens-components": "0.2.3-alpha.222",
|
|
28
|
-
"@gemeente-denhaag/divider": "0.2.3-alpha.205",
|
|
29
27
|
"@gemeente-denhaag/form-field": "0.1.1-alpha.98",
|
|
30
|
-
"@gemeente-denhaag/formcontrollabel": "0.2.3-alpha.222",
|
|
31
28
|
"@gemeente-denhaag/icons": "^0.2.3-alpha.317",
|
|
32
|
-
"@gemeente-denhaag/link": "0.2.3-alpha.205",
|
|
33
29
|
"@gemeente-denhaag/process-steps": "0.1.0-alpha.51",
|
|
34
30
|
"@gemeente-denhaag/sidenav": "0.1.0-alpha.40",
|
|
35
|
-
"@gemeente-denhaag/stylesprovider": "0.1.1-alpha.222",
|
|
36
|
-
"@gemeente-denhaag/table": "0.1.1-alpha.123",
|
|
37
31
|
"@gemeente-denhaag/textarea": "0.1.1-alpha.95",
|
|
38
32
|
"@gemeente-denhaag/textfield": "0.2.3-alpha.205",
|
|
39
|
-
"@gemeente-denhaag/typography": "0.2.3-alpha.205",
|
|
40
33
|
"@utrecht/component-library-react": "^1.0.0-alpha.319",
|
|
41
34
|
"clsx": "^1.1.1",
|
|
42
35
|
"gatsby": "^4.11.1",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
border-radius: var(--skeleton-border-radius-md);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.
|
|
13
|
+
.linkContainer {
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
padding-block-start: var(--skeleton-size-lg);
|
|
@@ -32,3 +32,7 @@
|
|
|
32
32
|
font-weight: var(--skeleton-font-weight-bold);
|
|
33
33
|
font-size: var(--skeleton-font-size-xl);
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
.link > * {
|
|
37
|
+
margin-inline-end: 8px;
|
|
38
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as styles from "./HorizontalImageCard.module.css";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import { Link } from "@
|
|
4
|
+
import { Link } from "@utrecht/component-library-react";
|
|
5
5
|
import { navigate } from "gatsby";
|
|
6
6
|
import { ExternalLinkIcon, ArrowRightIcon } from "@gemeente-denhaag/icons";
|
|
7
7
|
|
|
@@ -26,9 +26,10 @@ export const HorizontalImageCard = ({
|
|
|
26
26
|
return (
|
|
27
27
|
<div className={clsx(styles.container, [layoutClassName && layoutClassName])} onClick={() => navigate(link.href)}>
|
|
28
28
|
<div className={styles.imageOrIconContainer}>{iconOrImage}</div>
|
|
29
|
-
<div className={styles.
|
|
29
|
+
<div className={styles.linkContainer}>
|
|
30
30
|
<div className={styles.title}>{title}</div>
|
|
31
|
-
<Link
|
|
31
|
+
<Link className={styles.link}>
|
|
32
|
+
{external ? <ExternalLinkIcon /> : <ArrowRightIcon />}
|
|
32
33
|
{link.label}
|
|
33
34
|
</Link>
|
|
34
35
|
</div>
|
|
@@ -14,18 +14,22 @@
|
|
|
14
14
|
padding-block-end: var(--skeleton-size-md);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.container > *:not(.
|
|
17
|
+
.container > *:not(.linkContainer):not(:last-child) {
|
|
18
18
|
margin-block-end: var(--skeleton-size-md);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.
|
|
21
|
+
.linkContainer {
|
|
22
22
|
margin-block-end: var(--skeleton-size-xs);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
.
|
|
25
|
+
.linkContainer > :first-child {
|
|
26
26
|
display: flex;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
.link > * {
|
|
30
|
+
margin-inline-end: 8px;
|
|
31
|
+
}
|
|
32
|
+
|
|
29
33
|
.labelsWithIcon {
|
|
30
34
|
display: flex;
|
|
31
35
|
flex-wrap: wrap;
|
|
@@ -91,3 +95,9 @@
|
|
|
91
95
|
font-size: var(--conduction-content-link-font-size);
|
|
92
96
|
color: var(--denhaag-color-grey-3);
|
|
93
97
|
}
|
|
98
|
+
|
|
99
|
+
.divider {
|
|
100
|
+
width: 100%;
|
|
101
|
+
opacity: 0.5;
|
|
102
|
+
margin-block: var(--skeleton-size-lg);
|
|
103
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Divider } from "@gemeente-denhaag/divider";
|
|
2
|
-
import { Link } from "@gemeente-denhaag/link";
|
|
3
|
-
import { navigate } from "gatsby";
|
|
4
1
|
import * as React from "react";
|
|
5
2
|
import * as styles from "./RichContentCard.module.css";
|
|
3
|
+
import { Link } from "@utrecht/component-library-react/dist/css-module";
|
|
4
|
+
import { navigate } from "gatsby";
|
|
6
5
|
import { ExternalLinkIcon, ArrowRightIcon } from "@gemeente-denhaag/icons";
|
|
7
6
|
import { Tag } from "../../tag/Tag";
|
|
8
7
|
|
|
@@ -33,8 +32,9 @@ export const RichContentCard = ({
|
|
|
33
32
|
}: RichContentCardProps): JSX.Element => {
|
|
34
33
|
return (
|
|
35
34
|
<div className={styles.container}>
|
|
36
|
-
<div className={styles.
|
|
37
|
-
<Link
|
|
35
|
+
<div className={styles.linkContainer} onClick={() => navigate(link.href)}>
|
|
36
|
+
<Link className={styles.link}>
|
|
37
|
+
{linkIsExternal ? <ExternalLinkIcon /> : <ArrowRightIcon />}
|
|
38
38
|
{link.label}
|
|
39
39
|
</Link>
|
|
40
40
|
</div>
|
|
@@ -53,7 +53,7 @@ export const RichContentCard = ({
|
|
|
53
53
|
|
|
54
54
|
{contentLinks && (
|
|
55
55
|
<div className={styles.contentLinks}>
|
|
56
|
-
<
|
|
56
|
+
<hr className={styles.divider} />
|
|
57
57
|
{contentLinks.map(({ title, subTitle, href }, idx) => (
|
|
58
58
|
<ContentLink key={idx} {...{ title, subTitle, href }} />
|
|
59
59
|
))}
|
|
@@ -12,6 +12,15 @@
|
|
|
12
12
|
|
|
13
13
|
.table {
|
|
14
14
|
border-collapse: collapse;
|
|
15
|
+
background-color: var(--utrecht-table-background-color);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.tableHeader > * {
|
|
19
|
+
border-block-end: var(--utrecht-table-header-border-block-end-width) solid var(--utrecht-table-header-border-block-end-color);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.tableHeader {
|
|
23
|
+
font-family: var(--utrecht-table-header-font-family);
|
|
15
24
|
}
|
|
16
25
|
|
|
17
26
|
.table td,
|
|
@@ -3,7 +3,14 @@ import * as styles from "./CreateKeyValue.module.css";
|
|
|
3
3
|
import { Control, Controller, FieldValues } from "react-hook-form";
|
|
4
4
|
import { IReactHookFormProps } from "../types";
|
|
5
5
|
import { Button } from "@gemeente-denhaag/button";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
Table,
|
|
8
|
+
TableBody,
|
|
9
|
+
TableCell,
|
|
10
|
+
TableHeaderCell,
|
|
11
|
+
TableHeader,
|
|
12
|
+
TableRow,
|
|
13
|
+
} from "@utrecht/component-library-react/dist/css-module";
|
|
7
14
|
import { ToolTip } from "../../toolTip/ToolTip";
|
|
8
15
|
import clsx from "clsx";
|
|
9
16
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
@@ -110,13 +117,13 @@ const KeyValueComponent = ({
|
|
|
110
117
|
<div className={styles.keyValue}>
|
|
111
118
|
{keyValues && (
|
|
112
119
|
<Table className={styles.table}>
|
|
113
|
-
<
|
|
120
|
+
<TableHeader className={styles.tableHeader}>
|
|
114
121
|
<TableRow>
|
|
115
|
-
<
|
|
116
|
-
<
|
|
117
|
-
<
|
|
122
|
+
<TableHeaderCell>Key</TableHeaderCell>
|
|
123
|
+
<TableHeaderCell>Value</TableHeaderCell>
|
|
124
|
+
<TableHeaderCell />
|
|
118
125
|
</TableRow>
|
|
119
|
-
</
|
|
126
|
+
</TableHeader>
|
|
120
127
|
<TableBody>
|
|
121
128
|
{keyValues.map((keyValue, idx) => (
|
|
122
129
|
<TableRow key={`${keyValue.key}${keyValue.value}${idx}`}>
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { InputText, InputPassword, InputEmail, InputURL, InputNumber, InputFile } from "./input";
|
|
2
2
|
import { Textarea } from "./textarea";
|
|
3
3
|
import { InputCheckbox } from "./checkbox/checkbox";
|
|
4
|
-
import { InputRadio } from "./radio";
|
|
5
4
|
import { SelectSingle, SelectMultiple, SelectCreate } from "./select/select";
|
|
6
5
|
import { CreateKeyValue, IKeyValue } from "./createKeyValue/CreateKeyValue";
|
|
7
6
|
import { InputDate } from "./date/Date";
|
|
8
7
|
|
|
9
8
|
export {
|
|
10
|
-
InputRadio,
|
|
11
9
|
InputText,
|
|
12
10
|
InputPassword,
|
|
13
11
|
InputEmail,
|
|
@@ -2,11 +2,9 @@ import * as React from "react";
|
|
|
2
2
|
import * as styles from "./NotificationPopUp.module.css";
|
|
3
3
|
import ReactDOM from "react-dom";
|
|
4
4
|
import { Button } from "@gemeente-denhaag/button";
|
|
5
|
-
import { Heading3, Paragraph } from "@gemeente-denhaag/typography";
|
|
6
|
-
import { Link } from "@gemeente-denhaag/link";
|
|
7
|
-
import { StylesProvider } from "@gemeente-denhaag/stylesprovider";
|
|
8
5
|
import clsx from "clsx";
|
|
9
6
|
import { CloseIcon, ArrowRightIcon } from "@gemeente-denhaag/icons";
|
|
7
|
+
import { Heading3, Link, Paragraph } from "@utrecht/component-library-react";
|
|
10
8
|
|
|
11
9
|
export interface NotificationPopUpProps {
|
|
12
10
|
title: string;
|
|
@@ -51,34 +49,33 @@ export const NotificationPopUp = ({
|
|
|
51
49
|
};
|
|
52
50
|
|
|
53
51
|
const modal = (
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
>
|
|
59
|
-
<Heading3>{title}</Heading3>
|
|
52
|
+
<div
|
|
53
|
+
style={{ animationDuration: `${animationDuration}ms` }}
|
|
54
|
+
className={clsx(styles.modal, animationVisible && styles.visible, layoutClassName)}
|
|
55
|
+
>
|
|
56
|
+
<Heading3>{title}</Heading3>
|
|
60
57
|
|
|
61
|
-
|
|
58
|
+
<Paragraph>{description}</Paragraph>
|
|
62
59
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
</
|
|
70
|
-
|
|
60
|
+
<div className={styles.buttons}>
|
|
61
|
+
{secondaryButton && (
|
|
62
|
+
<div onClick={() => handleClick(secondaryButton.handleClick)} className={secondaryButton.layoutClassName}>
|
|
63
|
+
<Link className={styles.link}>
|
|
64
|
+
{secondaryButton.icon ?? <CloseIcon />}
|
|
65
|
+
{secondaryButton.label}
|
|
66
|
+
</Link>
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
</div>
|
|
70
|
+
<Button
|
|
71
|
+
icon={primaryButton.icon ?? <ArrowRightIcon />}
|
|
72
|
+
onClick={() => handleClick(primaryButton.handleClick)}
|
|
73
|
+
className={primaryButton.layoutClassName}
|
|
74
|
+
>
|
|
75
|
+
{primaryButton.label}
|
|
76
|
+
</Button>
|
|
80
77
|
</div>
|
|
81
|
-
</
|
|
78
|
+
</div>
|
|
82
79
|
);
|
|
83
80
|
|
|
84
81
|
return isVisible ? ReactDOM.createPortal(modal, document.body) : null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as styles from "./PrimaryTopNav.module.css";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import { Link } from "@
|
|
4
|
+
import { Link } from "@utrecht/component-library-react/dist/css-module";
|
|
5
5
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
6
6
|
import { faBars } from "@fortawesome/free-solid-svg-icons";
|
|
7
7
|
|
|
@@ -53,7 +53,8 @@ export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName }: TopNavProp
|
|
|
53
53
|
className={clsx(styles.li, current && styles.current)}
|
|
54
54
|
key={idx}
|
|
55
55
|
>
|
|
56
|
-
<Link className={clsx(styles.link, styles.label)}
|
|
56
|
+
<Link className={clsx(styles.link, styles.label)}>
|
|
57
|
+
{icon}
|
|
57
58
|
{label}
|
|
58
59
|
</Link>
|
|
59
60
|
|
|
@@ -65,7 +66,8 @@ export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName }: TopNavProp
|
|
|
65
66
|
className={clsx(styles.li, current && styles.current)}
|
|
66
67
|
onClick={() => handleItemClick(handleClick)}
|
|
67
68
|
>
|
|
68
|
-
<Link className={clsx(styles.link, styles.label)}
|
|
69
|
+
<Link className={clsx(styles.link, styles.label)}>
|
|
70
|
+
{icon}
|
|
69
71
|
{label}
|
|
70
72
|
</Link>
|
|
71
73
|
</li>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as styles from "./SecondaryTopNav.module.css";
|
|
3
|
-
import { Link } from "@
|
|
3
|
+
import { Link } from "@utrecht/component-library-react/dist/css-module";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
|
|
6
6
|
interface TopNavProps {
|
|
@@ -15,7 +15,8 @@ export const SecondaryTopNav = ({ items, layoutClassName }: TopNavProps): JSX.El
|
|
|
15
15
|
<ul className={styles.ul}>
|
|
16
16
|
{items.map(({ label, icon, current, handleClick }, idx) => (
|
|
17
17
|
<li className={clsx(styles.li, current && styles.current)} key={idx} onClick={handleClick}>
|
|
18
|
-
<Link className={clsx(styles.link, styles.label)}
|
|
18
|
+
<Link className={clsx(styles.link, styles.label)}>
|
|
19
|
+
{icon}
|
|
19
20
|
{label}
|
|
20
21
|
</Link>
|
|
21
22
|
</li>
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
} from "./components/card";
|
|
9
9
|
import { Container } from "./components/container/Container";
|
|
10
10
|
import { Breadcrumbs } from "./components/denhaag-wrappers/breadcrumbs/Breadcrumbs";
|
|
11
|
-
import { EditableTableRow } from "./components/editableTableRow/EditableTableRow";
|
|
12
11
|
import {
|
|
13
12
|
InputText,
|
|
14
13
|
InputPassword,
|
|
@@ -17,7 +16,6 @@ import {
|
|
|
17
16
|
InputNumber,
|
|
18
17
|
Textarea,
|
|
19
18
|
InputCheckbox,
|
|
20
|
-
InputRadio,
|
|
21
19
|
InputFile,
|
|
22
20
|
SelectMultiple,
|
|
23
21
|
SelectSingle,
|
|
@@ -40,7 +38,6 @@ import { ToolTip } from "./components/toolTip/ToolTip";
|
|
|
40
38
|
import { Pagination } from "./components/Pagination/Pagination";
|
|
41
39
|
|
|
42
40
|
export {
|
|
43
|
-
InputRadio,
|
|
44
41
|
DownloadCard,
|
|
45
42
|
HorizontalImageCard,
|
|
46
43
|
ImageAndDetailsCard,
|
|
@@ -49,7 +46,6 @@ export {
|
|
|
49
46
|
InfoCard,
|
|
50
47
|
Container,
|
|
51
48
|
Breadcrumbs,
|
|
52
|
-
EditableTableRow,
|
|
53
49
|
InputText,
|
|
54
50
|
InputPassword,
|
|
55
51
|
InputEmail,
|
|
@@ -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
|
-
);
|