@conduction/components 1.0.6 → 1.0.9
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/lib/components/container/Container.d.ts +5 -1
- package/lib/components/container/Container.js +2 -1
- package/lib/components/container/Container.module.css +5 -1
- package/lib/components/denhaag-wrappers/paginations/Paginations.css +10 -0
- package/lib/components/denhaag-wrappers/paginations/Paginations.d.ts +20 -0
- package/lib/components/denhaag-wrappers/paginations/Paginations.js +10 -0
- package/lib/components/formFields/select/select.d.ts +16 -0
- package/lib/components/formFields/select/select.js +14 -0
- package/lib/components/formFields/select/select.module.css +65 -0
- package/lib/components/modals/NotificationModal.d.ts +25 -0
- package/lib/components/modals/NotificationModal.js +34 -0
- package/lib/components/modals/NotificationModal.module.css +56 -0
- package/lib/components/privateRoute/PrivateRoute.d.ts +1 -1
- package/lib/components/privateRoute/PrivateRoute.js +6 -6
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/package.json +1 -1
- package/src/components/container/Container.module.css +5 -1
- package/src/components/container/Container.tsx +8 -1
- package/src/components/privateRoute/PrivateRoute.tsx +7 -7
- package/lib/components/pagination/Pagination.d.ts +0 -2
- package/lib/components/pagination/Pagination.js +0 -6
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as styles from "./Container.module.css";
|
|
3
|
-
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
export const Container = ({ children, layoutClassName }) => (_jsx("div", { className: clsx(styles.container, [layoutClassName && layoutClassName]), children: children }));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a wrapper element based on https://nl-design-system.github.io/denhaag/?path=/docs/css-navigation-pagination--default-story
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: DO NOT MAKE CHANGES TO THIS FILE, AS ALL CHANGES WILL BE LOST UPON PACKAGE IMPLEMENTATION
|
|
5
|
+
*
|
|
6
|
+
* Note: we do not use css modules here due to this component being a wrapper
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import "./Paginations.css";
|
|
10
|
+
interface PaginationsProps {
|
|
11
|
+
pages: {
|
|
12
|
+
ariaLabel: string;
|
|
13
|
+
label: string;
|
|
14
|
+
href: string;
|
|
15
|
+
}[];
|
|
16
|
+
nextPageHref: string;
|
|
17
|
+
previousPageHref: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const Paginations: React.FC<PaginationsProps>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./Paginations.css";
|
|
3
|
+
import { Link } from "gatsby";
|
|
4
|
+
export const Paginations = ({ pages, previousPageHref, nextPageHref }) => {
|
|
5
|
+
return (_jsxs("nav", { className: "denhaag-pagination", children: [_jsx(PreviousPage, { href: previousPageHref }), _jsx("span", { className: "denhaag-pagination__links", role: "group", children: pages.map((page) => {
|
|
6
|
+
return (_jsx(Link, { "aria-label": page.ariaLabel, className: "denhaag-pagination__link", to: page.href, children: page.label }));
|
|
7
|
+
}) }), _jsx(NextPage, { href: nextPageHref })] }));
|
|
8
|
+
};
|
|
9
|
+
const PreviousPage = ({ href }) => (_jsx(Link, { "aria-label": "Previous page", className: "denhaag-pagination__link denhaag-pagination__link--arrow", to: href, rel: "prev", children: _jsx("svg", { "aria-hidden": "true", className: "denhaag-icon", fill: "none", height: "1em", viewBox: "0 0 7 12", width: "1em", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M4.9921 10.8143C5.36382 11.1914 5.97222 11.1914 6.34393 10.8143C6.7079 10.4451 6.70822 9.8521 6.34466 9.48248L3.36315 6.45123C2.98039 6.06209 2.98039 5.43791 3.36315 5.04877L6.34466 2.01752C6.70822 1.6479 6.7079 1.05492 6.34394 0.685696C5.97222 0.308599 5.36382 0.308599 4.9921 0.685695L0.692003 5.04799C0.308224 5.43732 0.308224 6.06268 0.692003 6.45201L4.9921 10.8143Z", fill: "currentColor" }) }) }));
|
|
10
|
+
const NextPage = ({ href }) => (_jsx(Link, { "aria-label": "Next page", className: "denhaag-pagination__link denhaag-pagination__link--arrow", to: href, rel: "next", children: _jsx("svg", { "aria-hidden": "true", className: "denhaag-icon", fill: "none", height: "1em", viewBox: "0 0 7 12", width: "1em", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M2.0079 1.1857C1.63618 0.8086 1.02778 0.8086 0.656065 1.18569V1.18569C0.292103 1.55492 0.291779 2.1479 0.655339 2.51752L3.63685 5.54877C4.01961 5.93791 4.01961 6.56209 3.63686 6.95123L0.655339 9.98248C0.291779 10.3521 0.292102 10.9451 0.656065 11.3143V11.3143C1.02778 11.6914 1.63618 11.6914 2.0079 11.3143L6.308 6.95201C6.69178 6.56268 6.69178 5.93732 6.308 5.54799L2.0079 1.1857Z", fill: "currentColor" }) }) }));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { IReactHookFormProps } from "../types";
|
|
3
|
+
export interface ISelectValue {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
interface ISelectProps {
|
|
8
|
+
control: any;
|
|
9
|
+
options: ISelectValue[];
|
|
10
|
+
name: string;
|
|
11
|
+
defaultValue?: any;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const SelectMultiple: React.FC<ISelectProps & IReactHookFormProps>;
|
|
15
|
+
export declare const SelectSingle: React.FC<ISelectProps & IReactHookFormProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as styles from "./select.module.css";
|
|
3
|
+
import { Controller } from "react-hook-form";
|
|
4
|
+
import ReactSelect from "react-select";
|
|
5
|
+
export const SelectMultiple = ({ name, options, errors, control, validation, defaultValue, disabled, }) => {
|
|
6
|
+
return (_jsx(Controller, { ...{ control, name }, rules: validation, render: ({ field: { onChange, value } }) => {
|
|
7
|
+
return (_jsx(ReactSelect, { className: styles.select, isMulti: true, isDisabled: disabled, ...{ options, value, onChange, errors, defaultValue } }));
|
|
8
|
+
} }));
|
|
9
|
+
};
|
|
10
|
+
export const SelectSingle = ({ name, options, errors, control, validation, }) => {
|
|
11
|
+
return (_jsx(Controller, { ...{ control, name }, rules: validation, render: ({ field: { onChange, value } }) => {
|
|
12
|
+
return _jsx(ReactSelect, { className: styles.select, ...{ options, onChange, value, errors }, isClearable: true });
|
|
13
|
+
} }));
|
|
14
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.select > div {
|
|
2
|
+
background-color: var(
|
|
3
|
+
--utrecht-textbox-background-color,
|
|
4
|
+
var(--utrecht-form-input-background-color)
|
|
5
|
+
);
|
|
6
|
+
border-width: var(
|
|
7
|
+
--utrecht-textbox-border-width,
|
|
8
|
+
var(--utrecht-form-input-border-width)
|
|
9
|
+
);
|
|
10
|
+
border-bottom-width: var(
|
|
11
|
+
--utrecht-textbox-border-bottom-width,
|
|
12
|
+
var(--utrecht-textbox-border-width, var(--utrecht-form-input-border-width))
|
|
13
|
+
);
|
|
14
|
+
border-color: var(
|
|
15
|
+
--utrecht-textbox-border-color,
|
|
16
|
+
var(--utrecht-form-input-border-color)
|
|
17
|
+
);
|
|
18
|
+
border-radius: var(
|
|
19
|
+
--utrecht-textbox-border-radius,
|
|
20
|
+
var(--utrecht-form-input-border-radius, 0)
|
|
21
|
+
);
|
|
22
|
+
border-style: solid;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
color: var(--utrecht-textbox-color, var(--utrecht-form-input-color));
|
|
25
|
+
font-family: var(
|
|
26
|
+
--utrecht-textbox-font-family,
|
|
27
|
+
var(--utrecht-form-input-font-family)
|
|
28
|
+
);
|
|
29
|
+
font-size: var(
|
|
30
|
+
--utrecht-textbox-font-size,
|
|
31
|
+
var(--utrecht-form-input-font-size, 1em)
|
|
32
|
+
);
|
|
33
|
+
max-inline-size: var(
|
|
34
|
+
--utrecht-textbox-max-inline-size,
|
|
35
|
+
var(--utrecht-form-input-max-inline-size)
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
padding-block-start: 6.5px;
|
|
39
|
+
padding-block-end: 6.5px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.select > div:hover {
|
|
43
|
+
border-color: var(
|
|
44
|
+
--utrecht-textbox-border-color,
|
|
45
|
+
var(--utrecht-form-input-border-color)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.select > div:focus-within {
|
|
50
|
+
outline: none;
|
|
51
|
+
box-shadow: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.select > div:focus-within::after {
|
|
55
|
+
pointer-events: none;
|
|
56
|
+
border: var(--denhaag-focus-border);
|
|
57
|
+
border-radius: var(--denhaag-border-radius);
|
|
58
|
+
bottom: -3px;
|
|
59
|
+
content: "";
|
|
60
|
+
display: block;
|
|
61
|
+
left: -3px;
|
|
62
|
+
position: absolute;
|
|
63
|
+
right: -3px;
|
|
64
|
+
top: -3px;
|
|
65
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ModalProps {
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
isShown: boolean;
|
|
6
|
+
hide: () => void;
|
|
7
|
+
layoutClassName: string;
|
|
8
|
+
primaryButton: {
|
|
9
|
+
label: string;
|
|
10
|
+
handleClick(): any;
|
|
11
|
+
};
|
|
12
|
+
closeButton?: {
|
|
13
|
+
label: string;
|
|
14
|
+
};
|
|
15
|
+
infoLink?: {
|
|
16
|
+
label: string;
|
|
17
|
+
link: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare const NotificationModal: React.FC<ModalProps>;
|
|
21
|
+
export declare const toggleNotificationModal: () => {
|
|
22
|
+
isShown: boolean;
|
|
23
|
+
show: () => void;
|
|
24
|
+
hide: () => void;
|
|
25
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as styles from "./NotificationModal.module.css";
|
|
4
|
+
import ReactDOM from "react-dom";
|
|
5
|
+
import { Button, Heading3, Link, Paragraph } from "@gemeente-denhaag/components-react";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import { CloseIcon, ArrowRightIcon } from "@gemeente-denhaag/icons";
|
|
8
|
+
export const NotificationModal = ({ title, description, isShown, hide, primaryButton, closeButton, infoLink, layoutClassName, }) => {
|
|
9
|
+
const [fadeOut, setFadeOut] = React.useState(true);
|
|
10
|
+
const stylesContainer = document.getElementById("stylesContainer");
|
|
11
|
+
const animationDurationToken = getComputedStyle(document.documentElement).getPropertyValue("--conduction-notification-animation-duration");
|
|
12
|
+
const animationDurationString = animationDurationToken.replace(/\D/g, "");
|
|
13
|
+
const animationDuration = parseInt(animationDurationString);
|
|
14
|
+
const handleClick = (clickFunction) => {
|
|
15
|
+
setFadeOut(!setFadeOut);
|
|
16
|
+
clickFunction && clickFunction();
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
hide();
|
|
19
|
+
setFadeOut(true);
|
|
20
|
+
}, animationDuration);
|
|
21
|
+
};
|
|
22
|
+
const modal = (_jsx("div", { className: clsx(styles.cssanimation, fadeOut ? styles.fadeInBottom : styles.fadeOutBottom, layoutClassName), children: _jsxs("div", { className: styles.modal, children: [_jsx(Heading3, { children: title }), _jsx("div", { children: _jsxs(Paragraph, { children: [description, " ", infoLink ? _jsx(Link, { href: infoLink.link, children: infoLink.label }) : _jsx(_Fragment, {})] }) }), _jsxs("div", { className: styles.buttons, children: [closeButton ? (_jsx("div", { onClick: () => handleClick(), children: _jsx(Link, { icon: _jsx(CloseIcon, {}), iconAlign: "start", children: closeButton.label }) })) : (_jsx(_Fragment, {})), _jsx(Button, { icon: _jsx(ArrowRightIcon, {}), onClick: () => handleClick(primaryButton.handleClick), children: primaryButton.label })] })] }) }));
|
|
23
|
+
return isShown ? ReactDOM.createPortal(modal, stylesContainer) : null;
|
|
24
|
+
};
|
|
25
|
+
export const toggleNotificationModal = () => {
|
|
26
|
+
const [isShown, setIsShown] = React.useState(false);
|
|
27
|
+
const show = () => setIsShown(true);
|
|
28
|
+
const hide = () => setIsShown(false);
|
|
29
|
+
return {
|
|
30
|
+
isShown,
|
|
31
|
+
show,
|
|
32
|
+
hide,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.modal {
|
|
2
|
+
background: var(--denhaag-color-warmgrey-1);
|
|
3
|
+
padding-inline-start: var(--nlportal-space-inline-lg);
|
|
4
|
+
padding-inline-end: var(--nlportal-space-inline-lg);
|
|
5
|
+
padding-block-start: var(--nlportal-space-block-lg);
|
|
6
|
+
padding-block-end: var(--nlportal-space-block-lg);
|
|
7
|
+
box-shadow: var(--conduction-notification-box-shadow);
|
|
8
|
+
border-radius: var(--nlportal-document-border-radius);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.modal > *:not(:last-child) {
|
|
12
|
+
margin-block-end: var(--nlportal-space-block-md);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.buttons {
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: flex-end;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.buttons > *:not(:last-child) {
|
|
22
|
+
margin-inline-end: var(--nlportal-space-inline-md);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.cssanimation {
|
|
26
|
+
animation-duration: var(--conduction-notification-animation-duration);
|
|
27
|
+
animation-fill-mode: both;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.fadeInBottom {
|
|
31
|
+
animation-name: fadeInBottom;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@keyframes fadeInBottom {
|
|
35
|
+
from {
|
|
36
|
+
opacity: 0;
|
|
37
|
+
transform: translateY(100%);
|
|
38
|
+
}
|
|
39
|
+
to {
|
|
40
|
+
opacity: 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.fadeOutBottom {
|
|
45
|
+
animation-name: fadeOutBottom;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@keyframes fadeOutBottom {
|
|
49
|
+
from {
|
|
50
|
+
opacity: 1;
|
|
51
|
+
}
|
|
52
|
+
to {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
transform: translateY(100%);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { navigate } from "gatsby";
|
|
4
|
-
export const PrivateRoute = ({ children,
|
|
5
|
-
const [
|
|
4
|
+
export const PrivateRoute = ({ children, authenticated }) => {
|
|
5
|
+
const [_authenticated, setAuthenticated] = React.useState(false);
|
|
6
6
|
React.useEffect(() => {
|
|
7
|
-
if (!
|
|
7
|
+
if (!authenticated && window.location.pathname !== "/login") {
|
|
8
8
|
navigate("/login");
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
}, [
|
|
12
|
-
if (!
|
|
10
|
+
authenticated && setAuthenticated(true);
|
|
11
|
+
}, [authenticated]);
|
|
12
|
+
if (!_authenticated)
|
|
13
13
|
return _jsx(_Fragment, {});
|
|
14
14
|
return _jsx(_Fragment, { children: children });
|
|
15
15
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -9,4 +9,5 @@ import { MetaIcon } from "./components/metaIcon/MetaIcon";
|
|
|
9
9
|
import { PrivateRoute } from "./components/privateRoute/PrivateRoute";
|
|
10
10
|
import { StatusSteps } from "./components/statusSteps/StatusSteps";
|
|
11
11
|
import { PrimaryTopNav, SecondaryTopNav } from "./components/topNav/TopNav";
|
|
12
|
-
|
|
12
|
+
import { Tag } from "./components/tag/Tag";
|
|
13
|
+
export { DownloadCard, HorizontalImageCard, ImageAndDetailsCard, RichContentCard, DetailsCard, Container, Breadcrumbs, EditableTableRow, InputText, InputPassword, InputEmail, InputDate, InputNumber, Textarea, InputCheckbox, ImageDivider, AuthenticatedLogo, UnauthenticatedLogo, MetaIcon, PrivateRoute, StatusSteps, PrimaryTopNav, SecondaryTopNav, Tag, };
|
package/lib/index.js
CHANGED
|
@@ -9,4 +9,5 @@ import { MetaIcon } from "./components/metaIcon/MetaIcon";
|
|
|
9
9
|
import { PrivateRoute } from "./components/privateRoute/PrivateRoute";
|
|
10
10
|
import { StatusSteps } from "./components/statusSteps/StatusSteps";
|
|
11
11
|
import { PrimaryTopNav, SecondaryTopNav } from "./components/topNav/TopNav";
|
|
12
|
-
|
|
12
|
+
import { Tag } from "./components/tag/Tag";
|
|
13
|
+
export { DownloadCard, HorizontalImageCard, ImageAndDetailsCard, RichContentCard, DetailsCard, Container, Breadcrumbs, EditableTableRow, InputText, InputPassword, InputEmail, InputDate, InputNumber, Textarea, InputCheckbox, ImageDivider, AuthenticatedLogo, UnauthenticatedLogo, MetaIcon, PrivateRoute, StatusSteps, PrimaryTopNav, SecondaryTopNav, Tag, };
|
package/package.json
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as styles from "./Container.module.css";
|
|
3
|
+
import clsx from "clsx";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
interface ContainerProps {
|
|
6
|
+
layoutClassName?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Container: React.FC<ContainerProps> = ({ children, layoutClassName }) => (
|
|
10
|
+
<div className={clsx(styles.container, [layoutClassName && layoutClassName])}>{children}</div>
|
|
11
|
+
);
|
|
@@ -2,21 +2,21 @@ import React from "react";
|
|
|
2
2
|
import { navigate } from "gatsby";
|
|
3
3
|
|
|
4
4
|
interface PrivateRouteProps {
|
|
5
|
-
|
|
5
|
+
authenticated: boolean;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export const PrivateRoute: React.FC<PrivateRouteProps> = ({ children,
|
|
9
|
-
const [
|
|
8
|
+
export const PrivateRoute: React.FC<PrivateRouteProps> = ({ children, authenticated }) => {
|
|
9
|
+
const [_authenticated, setAuthenticated] = React.useState<boolean>(false);
|
|
10
10
|
|
|
11
11
|
React.useEffect(() => {
|
|
12
|
-
if (!
|
|
12
|
+
if (!authenticated && window.location.pathname !== "/login") {
|
|
13
13
|
navigate("/login");
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
}, [
|
|
16
|
+
authenticated && setAuthenticated(true);
|
|
17
|
+
}, [authenticated]);
|
|
18
18
|
|
|
19
|
-
if (!
|
|
19
|
+
if (!_authenticated) return <></>;
|
|
20
20
|
|
|
21
21
|
return <>{children}</>;
|
|
22
22
|
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export const Pagination = () => {
|
|
4
|
-
const [count, setCount] = React.useState(0);
|
|
5
|
-
return (_jsxs(_Fragment, { children: ["Pagination", _jsxs("div", { children: ["Count: ", count] }), _jsx("button", { onClick: () => setCount(count + 1), children: "click me" })] }));
|
|
6
|
-
};
|