@conduction/components 1.0.11 → 1.0.12

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.
@@ -1,2 +1,6 @@
1
1
  import * as React from "react";
2
- export declare const Container: React.FC;
2
+ interface ContainerProps {
3
+ layoutClassName?: string;
4
+ }
5
+ export declare const Container: React.FC<ContainerProps>;
6
+ export {};
@@ -1,3 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as styles from "./Container.module.css";
3
- export const Container = ({ children }) => _jsx("div", { className: styles.container, children: children });
3
+ import clsx from "clsx";
4
+ export const Container = ({ children, layoutClassName }) => (_jsx("div", { className: clsx(styles.container, [layoutClassName && layoutClassName]), children: children }));
@@ -1,5 +1,9 @@
1
+ :root{
2
+ --condution-container-max-width: 1024px;
3
+ }
4
+
1
5
  .container {
2
6
  width: 100%;
3
7
  margin-inline: auto;
4
- max-width: var(--nlportal-max-page-width);
8
+ max-width: var(--condution-container-max-width);
5
9
  }
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+ export interface NotificationPopUpProps {
3
+ title: string;
4
+ description: string | JSX.Element;
5
+ isVisible: boolean;
6
+ hide: () => void;
7
+ primaryButton: {
8
+ label: string;
9
+ handleClick: () => any;
10
+ };
11
+ secondaryButton?: {
12
+ label: string;
13
+ handleClick: () => any;
14
+ };
15
+ layoutClassName?: string;
16
+ }
17
+ export declare const NotificationPopUp: React.FC<NotificationPopUpProps>;
18
+ export declare const NotificationPopUpController: () => {
19
+ isVisible: boolean;
20
+ show: () => void;
21
+ hide: () => void;
22
+ };
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import * as styles from "./NotificationPopUp.module.css";
4
+ import ReactDOM from "react-dom";
5
+ import { Button, Heading3, Link, Paragraph, StylesProvider } from "@gemeente-denhaag/components-react";
6
+ import clsx from "clsx";
7
+ import { CloseIcon, ArrowRightIcon } from "@gemeente-denhaag/icons";
8
+ export const NotificationPopUp = ({ title, description, isVisible, hide, primaryButton, secondaryButton, layoutClassName, }) => {
9
+ const [animationVisible, setAnimationVisible] = React.useState(true);
10
+ const animationDuration = parseInt(styles.animationDuration, 10);
11
+ const handleClick = (clickFunction) => {
12
+ setAnimationVisible(!setAnimationVisible);
13
+ clickFunction && clickFunction();
14
+ setTimeout(() => {
15
+ hide();
16
+ setAnimationVisible(true);
17
+ }, animationDuration);
18
+ };
19
+ const modal = (_jsx(StylesProvider, { children: _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), children: _jsx(Link, { icon: _jsx(CloseIcon, {}), iconAlign: "start", children: secondaryButton.label }) })), _jsx(Button, { icon: _jsx(ArrowRightIcon, {}), onClick: () => handleClick(primaryButton.handleClick), children: primaryButton.label })] })] }) }));
20
+ return isVisible ? ReactDOM.createPortal(modal, document.body) : null;
21
+ };
22
+ export const NotificationPopUpController = () => {
23
+ const [isVisible, setIsVisible] = React.useState(false);
24
+ const show = () => setIsVisible(true);
25
+ const hide = () => setIsVisible(false);
26
+ return {
27
+ isVisible,
28
+ show,
29
+ hide,
30
+ };
31
+ };
@@ -0,0 +1,56 @@
1
+ :export {
2
+ animationDuration: 200ms;
3
+ }
4
+
5
+ .modal {
6
+ animation-fill-mode: both;
7
+ background: var(--denhaag-color-warmgrey-1);
8
+ padding-inline-start: var(--nlportal-space-inline-lg);
9
+ padding-inline-end: var(--nlportal-space-inline-lg);
10
+ padding-block-start: var(--nlportal-space-block-lg);
11
+ padding-block-end: var(--nlportal-space-block-lg);
12
+ box-shadow: var(--conduction-notification-box-shadow);
13
+ border-radius: var(--nlportal-document-border-radius);
14
+ }
15
+
16
+ .modal > *:not(:last-child) {
17
+ margin-block-end: var(--nlportal-space-block-md);
18
+ }
19
+
20
+ .buttons {
21
+ display: flex;
22
+ justify-content: flex-end;
23
+ align-items: center;
24
+ }
25
+
26
+ .buttons > *:not(:last-child) {
27
+ margin-inline-end: var(--nlportal-space-inline-md);
28
+ }
29
+
30
+ .visible {
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
+ .modal:not(.visible) {
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
+ }
@@ -2,18 +2,13 @@
2
2
  --conduction-top-nav-space-inline-lg: 1.25rem;
3
3
 
4
4
  --conduction-top-nav-color-primary: #ffffff;
5
- --conduction-top-nav-background-color-primary: #084f70;
6
- --conduction-top-nav-background-color-primary-hover: rgba(0, 0, 0, 0.2);
5
+ --conduction-top-nav-background-color-primary: #0b71a1;
6
+ --conduction-top-nav-background-color-primary-hover: rgba(255, 255, 255, 0.2);
7
7
 
8
8
  --conduction-top-nav-font-size-secondary: 16px;
9
9
  --conduction-top-nav-color-secondary: #ffffff;
10
- --conduction-top-nav-background-color-secondary: #0b71a1;
11
- --conduction-top-nav-background-color-secondary-hover: rgba(
12
- 255,
13
- 255,
14
- 255,
15
- 0.2
16
- );
10
+ --conduction-top-nav-background-color-secondary: #084f70;
11
+ --conduction-top-nav-background-color-secondary-hover: rgba(0, 0, 0, 0.2);
17
12
  }
18
13
 
19
14
  /*
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DownloadCard, HorizontalImageCard, ImageAndDetailsCard, RichContentCard, DetailsCard } from "./components/card";
2
3
  import { Container } from "./components/container/Container";
3
4
  import { Breadcrumbs } from "./components/denhaag-wrappers/breadcrumbs/Breadcrumbs";
@@ -10,4 +11,12 @@ import { PrivateRoute } from "./components/privateRoute/PrivateRoute";
10
11
  import { StatusSteps } from "./components/statusSteps/StatusSteps";
11
12
  import { PrimaryTopNav, SecondaryTopNav } from "./components/topNav/TopNav";
12
13
  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, };
14
+ declare const NotificationPopUp: {
15
+ controller: () => {
16
+ isVisible: boolean;
17
+ show: () => void;
18
+ hide: () => void;
19
+ };
20
+ NotificationPopUp: import("react").FC<import("./components/notificationPopUp/NotificationPopUp").NotificationPopUpProps>;
21
+ };
22
+ 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, NotificationPopUp, };
package/lib/index.js CHANGED
@@ -10,4 +10,6 @@ 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, };
13
+ import { NotificationPopUpController, NotificationPopUp as _NotificationPopUp, } from "./components/notificationPopUp/NotificationPopUp";
14
+ const NotificationPopUp = { controller: NotificationPopUpController, NotificationPopUp: _NotificationPopUp };
15
+ 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, NotificationPopUp, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/components",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -0,0 +1,56 @@
1
+ :export {
2
+ animationDuration: 200ms;
3
+ }
4
+
5
+ .modal {
6
+ animation-fill-mode: both;
7
+ background: var(--denhaag-color-warmgrey-1);
8
+ padding-inline-start: var(--nlportal-space-inline-lg);
9
+ padding-inline-end: var(--nlportal-space-inline-lg);
10
+ padding-block-start: var(--nlportal-space-block-lg);
11
+ padding-block-end: var(--nlportal-space-block-lg);
12
+ box-shadow: var(--conduction-notification-box-shadow);
13
+ border-radius: var(--nlportal-document-border-radius);
14
+ }
15
+
16
+ .modal > *:not(:last-child) {
17
+ margin-block-end: var(--nlportal-space-block-md);
18
+ }
19
+
20
+ .buttons {
21
+ display: flex;
22
+ justify-content: flex-end;
23
+ align-items: center;
24
+ }
25
+
26
+ .buttons > *:not(:last-child) {
27
+ margin-inline-end: var(--nlportal-space-inline-md);
28
+ }
29
+
30
+ .visible {
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
+ .modal:not(.visible) {
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
+ }
@@ -0,0 +1,82 @@
1
+ import * as React from "react";
2
+ import * as styles from "./NotificationPopUp.module.css";
3
+ import ReactDOM from "react-dom";
4
+ import { Button, Heading3, Link, Paragraph, StylesProvider } from "@gemeente-denhaag/components-react";
5
+ import clsx from "clsx";
6
+ import { CloseIcon, ArrowRightIcon } from "@gemeente-denhaag/icons";
7
+
8
+ export interface NotificationPopUpProps {
9
+ title: string;
10
+ description: string | JSX.Element;
11
+ isVisible: boolean;
12
+ hide: () => void;
13
+ primaryButton: {
14
+ label: string;
15
+ handleClick: () => any;
16
+ };
17
+ secondaryButton?: {
18
+ label: string;
19
+ handleClick: () => any;
20
+ };
21
+ layoutClassName?: string;
22
+ }
23
+
24
+ export const NotificationPopUp: React.FC<NotificationPopUpProps> = ({
25
+ title,
26
+ description,
27
+ isVisible,
28
+ hide,
29
+ primaryButton,
30
+ secondaryButton,
31
+ layoutClassName,
32
+ }) => {
33
+ const [animationVisible, setAnimationVisible] = React.useState<boolean>(true);
34
+
35
+ const animationDuration = parseInt(styles.animationDuration, 10);
36
+
37
+ const handleClick = (clickFunction?: () => any) => {
38
+ setAnimationVisible(!setAnimationVisible);
39
+ clickFunction && clickFunction();
40
+ setTimeout(() => {
41
+ hide();
42
+ setAnimationVisible(true);
43
+ }, animationDuration);
44
+ };
45
+
46
+ const modal = (
47
+ <StylesProvider>
48
+ <div
49
+ style={{ animationDuration: `${animationDuration}ms` }}
50
+ className={clsx(styles.modal, animationVisible && styles.visible, layoutClassName)}
51
+ >
52
+ <Heading3>{title}</Heading3>
53
+ <Paragraph>{description}</Paragraph>
54
+ <div className={styles.buttons}>
55
+ {secondaryButton && (
56
+ <div onClick={() => handleClick(secondaryButton.handleClick)}>
57
+ <Link icon={<CloseIcon />} iconAlign="start">
58
+ {secondaryButton.label}
59
+ </Link>
60
+ </div>
61
+ )}
62
+ <Button icon={<ArrowRightIcon />} onClick={() => handleClick(primaryButton.handleClick)}>
63
+ {primaryButton.label}
64
+ </Button>
65
+ </div>
66
+ </div>
67
+ </StylesProvider>
68
+ );
69
+
70
+ return isVisible ? ReactDOM.createPortal(modal, document.body) : null;
71
+ };
72
+
73
+ export const NotificationPopUpController = () => {
74
+ const [isVisible, setIsVisible] = React.useState<boolean>(false);
75
+ const show = () => setIsVisible(true);
76
+ const hide = () => setIsVisible(false);
77
+ return {
78
+ isVisible,
79
+ show,
80
+ hide,
81
+ };
82
+ };
package/src/index.ts CHANGED
@@ -25,6 +25,13 @@ import { StatusSteps } from "./components/statusSteps/StatusSteps";
25
25
  import { PrimaryTopNav, SecondaryTopNav } from "./components/topNav/TopNav";
26
26
  import { Tag } from "./components/tag/Tag";
27
27
 
28
+ import {
29
+ NotificationPopUpController,
30
+ NotificationPopUp as _NotificationPopUp,
31
+ } from "./components/notificationPopUp/NotificationPopUp";
32
+
33
+ const NotificationPopUp = { controller: NotificationPopUpController, NotificationPopUp: _NotificationPopUp };
34
+
28
35
  export {
29
36
  DownloadCard,
30
37
  HorizontalImageCard,
@@ -50,4 +57,5 @@ export {
50
57
  PrimaryTopNav,
51
58
  SecondaryTopNav,
52
59
  Tag,
60
+ NotificationPopUp,
53
61
  };