@conduction/components 1.0.8 → 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.
@@ -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
  }
@@ -1,17 +1,16 @@
1
1
  import * as React from "react";
2
- import { Control, FieldValues } from "react-hook-form";
3
- import { IReactHookFormProps } from "./../types";
2
+ import { IReactHookFormProps } from "../types";
4
3
  export interface ISelectValue {
5
4
  label: string;
6
5
  value: string;
7
6
  }
8
7
  interface ISelectProps {
9
- control: Control<FieldValues, any>;
8
+ control: any;
10
9
  options: ISelectValue[];
11
10
  name: string;
12
11
  defaultValue?: any;
13
12
  disabled?: boolean;
14
13
  }
15
- export declare const SelectMultiple: React.FC<ISelectProps & ISelectProps & IReactHookFormProps>;
16
- export declare const SelectSingle: React.FC<ISelectProps & ISelectProps & IReactHookFormProps>;
14
+ export declare const SelectMultiple: React.FC<ISelectProps & IReactHookFormProps>;
15
+ export declare const SelectSingle: React.FC<ISelectProps & IReactHookFormProps>;
17
16
  export {};
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/components",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -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
  }
@@ -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
- export const Container: React.FC = ({ children }) => <div className={styles.container}>{children}</div>;
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
+ );