@conduction/components 2.2.29 → 2.2.31

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 CHANGED
@@ -4,7 +4,11 @@
4
4
 
5
5
  - **Version 2.2 (breaking changes from 2.1.x)**
6
6
 
7
- - 2.2.29: updated build script to reslove css errors.
7
+ - 2.2.31:
8
+ - Added custom content to NotificationPopUp.
9
+ - Refactored DownloadCard to NLDS.
10
+ - 2.2.30: Renamed checkbox.module.css.
11
+ - 2.2.29: Updated build script to reslove css errors.
8
12
  - 2.2.27/2.2.28:
9
13
  - Updated dependencies to latest versions.
10
14
  - Updated Checkbox component to NLDS.
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  interface DownloadCardProps {
3
- icon: JSX.Element;
4
3
  label: string;
5
- sizeKb: string;
6
- downloadLabel: string;
4
+ size: string;
5
+ type: string;
6
+ icon?: JSX.Element;
7
7
  layoutClassName?: string;
8
8
  handleClick: () => any;
9
9
  }
10
- export declare const DownloadCard: ({ icon, label, sizeKb, layoutClassName, downloadLabel, handleClick, }: DownloadCardProps) => JSX.Element;
10
+ export declare const DownloadCard: ({ icon, label, size, type, layoutClassName, handleClick, }: DownloadCardProps) => JSX.Element;
11
11
  export {};
@@ -1,9 +1,47 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as styles from "./DownloadCard.module.css";
3
- import { Link } from "@utrecht/component-library-react/dist/css-module";
3
+ import { Heading3, Link } from "@utrecht/component-library-react/dist/css-module";
4
4
  import clsx from "clsx";
5
5
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
6
- import { faDownload } from "@fortawesome/free-solid-svg-icons";
7
- export const DownloadCard = ({ icon, label, sizeKb, layoutClassName, downloadLabel, handleClick, }) => {
8
- return (_jsxs("div", { className: clsx(styles.container, [layoutClassName && layoutClassName]), children: [_jsxs("div", { className: styles.content, children: [_jsx("div", { className: styles.icon, children: icon }), _jsxs("div", { children: [label, " (", sizeKb, "kb)"] })] }), _jsxs(Link, { onClick: handleClick, children: [_jsx(FontAwesomeIcon, { className: styles.icon, icon: faDownload }), " ", downloadLabel] })] }));
6
+ import { faDatabase, faDownload, faFileAudio, faFileCsv, faFileImage, faFilePdf, faFileVideo, faFileWord, faFileZipper, } from "@fortawesome/free-solid-svg-icons";
7
+ import _ from "lodash";
8
+ export const DownloadCard = ({ icon, label, size, type, layoutClassName, handleClick, }) => {
9
+ const onClick = (e) => {
10
+ e.preventDefault();
11
+ handleClick();
12
+ };
13
+ const getIconFromType = (type) => {
14
+ switch (_.toUpper(type)) {
15
+ case "PDF":
16
+ return faFilePdf;
17
+ case "DOC":
18
+ case "DOCX":
19
+ case "RTF":
20
+ case "TXT":
21
+ return faFileWord;
22
+ case "CSV":
23
+ return faFileCsv;
24
+ case "JPG":
25
+ case "PNG":
26
+ case "SVG":
27
+ case "GIF":
28
+ return faFileImage;
29
+ case "MP3":
30
+ case "WAV":
31
+ return faFileAudio;
32
+ case "MP4":
33
+ case "AVI":
34
+ case "MPG":
35
+ case "MPEG":
36
+ case "MOV":
37
+ return faFileVideo;
38
+ case "7Z":
39
+ case "ZIP":
40
+ case "RAR":
41
+ return faFileZipper;
42
+ default:
43
+ return faDatabase;
44
+ }
45
+ };
46
+ return (_jsxs("div", { className: clsx(styles.container, [layoutClassName && layoutClassName]), children: [_jsxs("div", { className: styles.content, children: [_jsx("div", { className: styles.icon, children: icon ?? _jsx(FontAwesomeIcon, { icon: getIconFromType(type) }) }), _jsx(Heading3, { className: styles.title, children: label }), _jsxs("div", { children: ["(", _.toUpper(type), size && `, ${size} kb`, ")"] })] }), _jsxs(Link, { className: styles.link, href: "", onClick: (e) => onClick(e), children: [_jsx(FontAwesomeIcon, { className: styles.icon, icon: faDownload }), " Download"] })] }));
9
47
  };
@@ -1,4 +1,10 @@
1
1
  :root {
2
+ --conduction-download-card-title-color: #000000;
3
+ --conduction-download-card-title-font-size: 20px;
4
+ --conduction-download-card-title-font-weight: bold;
5
+ /* --conduction-download-card-title-font-family: ; */
6
+ --conduction-download-card-title-margin-inline-end: var(--skeleton-size-sm);
7
+
2
8
  --conduction-download-card-border: 1px solid var(--skeleton-color-grey-2);
3
9
  --conduction-download-card-icon-gap: 8px;
4
10
  --conduction-download-card-padding: 14px;
@@ -13,15 +19,23 @@
13
19
  padding: var(--conduction-download-card-padding);
14
20
  }
15
21
 
22
+ .title {
23
+ color: var(--conduction-download-card-title-color);
24
+ font-size: var(--conduction-download-card-title-font-size);
25
+ font-weight: var(--conduction-download-card-title-font-weight);
26
+ font-family: var(--conduction-download-card-title-font-family);
27
+ margin-inline-end: var(--conduction-download-card-title-margin-inline-end);
28
+ }
29
+
16
30
  .content {
17
31
  display: flex;
18
32
  align-items: center;
19
33
  }
20
34
 
21
- .content > *:not(:last-child) {
22
- margin-inline-end: var(--skeleton-size-sm);
23
- }
24
-
25
35
  .icon {
26
36
  margin-inline-end: var(--conduction-download-card-icon-gap);
27
37
  }
38
+
39
+ .link:hover {
40
+ cursor: pointer;
41
+ }
@@ -1,6 +1,5 @@
1
1
  :root {
2
2
  --conduciton-input-checkbox-checkmark-url: url("data:image/svg+xml,%3Csvg id='eXTGSQIndRe1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 13 13' shape-rendering='geometricPrecision' text-rendering='geometricPrecision'%3E%3Cg transform='translate(-85.642166-156.631362)'%3E%3Cpath d='M86.73927,163.90021l1.92835-2.05763l4.165103,4.176559c-.692268.524-1.562158,1.361078-1.562158,2.198156L86.73927,163.90021Z' fill='%23fff' stroke-width='0'/%3E%3Cpath d='M95.2777,158.04542l2.26736,1.67416-6.27449,8.49772-1.917847-1.798161L95.2777,158.04542Z' fill='%23fff' stroke-width='0'/%3E%3C/g%3E%3C/svg%3E%0A");
3
-
4
3
  --conduction-input-checkbox-color: #ffffff;
5
4
  --conduction-input-checkbox-border-width: 1px;
6
5
  --conduction-input-checkbox-border-style: solid;
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  export interface NotificationPopUpProps {
3
3
  title: string;
4
- description: string | JSX.Element;
4
+ description?: string | JSX.Element;
5
+ customContent?: JSX.Element;
5
6
  isVisible: boolean;
6
7
  hide: () => void;
7
8
  primaryButton: {
@@ -19,7 +20,7 @@ export interface NotificationPopUpProps {
19
20
  };
20
21
  layoutClassName?: string;
21
22
  }
22
- export declare const NotificationPopUp: ({ title, description, isVisible, hide, primaryButton, secondaryButton, layoutClassName, }: NotificationPopUpProps) => JSX.Element | null;
23
+ export declare const NotificationPopUp: ({ title, description, isVisible, hide, primaryButton, secondaryButton, layoutClassName, customContent, }: NotificationPopUpProps) => JSX.Element | null;
23
24
  export declare const NotificationPopUpController: () => {
24
25
  isVisible: boolean;
25
26
  show: () => void;
@@ -6,7 +6,7 @@ import clsx from "clsx";
6
6
  import { Heading3, Link, Paragraph, Button } from "@utrecht/component-library-react";
7
7
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
8
8
  import { faArrowRight, faClose } from "@fortawesome/free-solid-svg-icons";
9
- export const NotificationPopUp = ({ title, description, isVisible, hide, primaryButton, secondaryButton, layoutClassName, }) => {
9
+ export const NotificationPopUp = ({ title, description, isVisible, hide, primaryButton, secondaryButton, layoutClassName, customContent, }) => {
10
10
  const [animationVisible, setAnimationVisible] = React.useState(true);
11
11
  const animationDuration = parseInt(styles.animationDuration, 10);
12
12
  const handleClick = (clickFunction) => {
@@ -17,7 +17,7 @@ export const NotificationPopUp = ({ title, description, isVisible, hide, primary
17
17
  setAnimationVisible(true);
18
18
  }, animationDuration);
19
19
  };
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", { className: secondaryButton.layoutClassName, children: _jsxs(Link, { onClick: (e) => {
20
+ const modal = (_jsxs("div", { style: { animationDuration: `${animationDuration}ms` }, className: clsx(styles.modal, animationVisible && styles.visible, layoutClassName), children: [_jsx(Heading3, { children: title }), description && _jsx(Paragraph, { children: description }), customContent && customContent, _jsxs("div", { className: styles.buttons, children: [secondaryButton && (_jsx("div", { className: secondaryButton.layoutClassName, children: _jsxs(Link, { onClick: (e) => {
21
21
  e.preventDefault(), handleClick(secondaryButton.handleClick);
22
22
  }, className: styles.link, href: secondaryButton.href, children: [secondaryButton.icon ?? _jsx(FontAwesomeIcon, { icon: faClose }), secondaryButton.label] }) })), _jsxs(Button, { onClick: () => handleClick(primaryButton.handleClick), className: clsx(styles.button, primaryButton.layoutClassName), children: [primaryButton.icon ?? _jsx(FontAwesomeIcon, { icon: faArrowRight }), primaryButton.label] })] })] }));
23
23
  return isVisible ? ReactDOM.createPortal(modal, document.body) : null;
package/lib/index.d.ts CHANGED
@@ -15,7 +15,7 @@ declare const NotificationPopUp: {
15
15
  show: () => void;
16
16
  hide: () => void;
17
17
  };
18
- NotificationPopUp: ({ title, description, isVisible, hide, primaryButton, secondaryButton, layoutClassName, }: import("./components/notificationPopUp/NotificationPopUp").NotificationPopUpProps) => JSX.Element | null;
18
+ NotificationPopUp: ({ title, description, isVisible, hide, primaryButton, secondaryButton, layoutClassName, customContent, }: import("./components/notificationPopUp/NotificationPopUp").NotificationPopUpProps) => JSX.Element | null;
19
19
  };
20
20
  import { QuoteWrapper } from "./components/quoteWrapper/QuoteWrapper";
21
21
  import { BadgeCounter } from "./components/badgeCounter/BadgeCounter";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/components",
3
- "version": "2.2.29",
3
+ "version": "2.2.31",
4
4
  "description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -14,7 +14,12 @@
14
14
  "type": "git",
15
15
  "url": "git+https://github.com/ConductionNL/conduction-components.git"
16
16
  },
17
- "keywords": ["React", "Gatsby", "Conduction", "Components"],
17
+ "keywords": [
18
+ "React",
19
+ "Gatsby",
20
+ "Conduction",
21
+ "Components"
22
+ ],
18
23
  "author": "Conduction B.V.",
19
24
  "license": "ISC",
20
25
  "bugs": {
@@ -42,6 +47,7 @@
42
47
  "@types/react-datepicker": "^4.19.3",
43
48
  "@types/react-dom": "^18.2.16",
44
49
  "copyfiles": "^2.4.1",
50
+ "npm-run-all": "^4.1.5",
45
51
  "rimraf": "^5.0.5",
46
52
  "tsc-hooks": "^1.1.2",
47
53
  "typescript": "^5.3.2"
@@ -1,4 +1,10 @@
1
1
  :root {
2
+ --conduction-download-card-title-color: #000000;
3
+ --conduction-download-card-title-font-size: 20px;
4
+ --conduction-download-card-title-font-weight: bold;
5
+ /* --conduction-download-card-title-font-family: ; */
6
+ --conduction-download-card-title-margin-inline-end: var(--skeleton-size-sm);
7
+
2
8
  --conduction-download-card-border: 1px solid var(--skeleton-color-grey-2);
3
9
  --conduction-download-card-icon-gap: 8px;
4
10
  --conduction-download-card-padding: 14px;
@@ -13,15 +19,23 @@
13
19
  padding: var(--conduction-download-card-padding);
14
20
  }
15
21
 
22
+ .title {
23
+ color: var(--conduction-download-card-title-color);
24
+ font-size: var(--conduction-download-card-title-font-size);
25
+ font-weight: var(--conduction-download-card-title-font-weight);
26
+ font-family: var(--conduction-download-card-title-font-family);
27
+ margin-inline-end: var(--conduction-download-card-title-margin-inline-end);
28
+ }
29
+
16
30
  .content {
17
31
  display: flex;
18
32
  align-items: center;
19
33
  }
20
34
 
21
- .content > *:not(:last-child) {
22
- margin-inline-end: var(--skeleton-size-sm);
23
- }
24
-
25
35
  .icon {
26
36
  margin-inline-end: var(--conduction-download-card-icon-gap);
27
37
  }
38
+
39
+ .link:hover {
40
+ cursor: pointer;
41
+ }
@@ -1,15 +1,26 @@
1
1
  import * as React from "react";
2
2
  import * as styles from "./DownloadCard.module.css";
3
- import { Link } from "@utrecht/component-library-react/dist/css-module";
3
+ import { Heading3, Link } from "@utrecht/component-library-react/dist/css-module";
4
4
  import clsx from "clsx";
5
5
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
6
- import { faDownload } from "@fortawesome/free-solid-svg-icons";
6
+ import {
7
+ faDatabase,
8
+ faDownload,
9
+ faFileAudio,
10
+ faFileCsv,
11
+ faFileImage,
12
+ faFilePdf,
13
+ faFileVideo,
14
+ faFileWord,
15
+ faFileZipper,
16
+ } from "@fortawesome/free-solid-svg-icons";
17
+ import _ from "lodash";
7
18
 
8
19
  interface DownloadCardProps {
9
- icon: JSX.Element;
10
20
  label: string;
11
- sizeKb: string;
12
- downloadLabel: string;
21
+ size: string;
22
+ type: string;
23
+ icon?: JSX.Element;
13
24
  layoutClassName?: string;
14
25
  handleClick: () => any;
15
26
  }
@@ -17,23 +28,65 @@ interface DownloadCardProps {
17
28
  export const DownloadCard = ({
18
29
  icon,
19
30
  label,
20
- sizeKb,
31
+ size,
32
+ type,
21
33
  layoutClassName,
22
- downloadLabel,
23
34
  handleClick,
24
35
  }: DownloadCardProps): JSX.Element => {
36
+ const onClick = (e: any) => {
37
+ e.preventDefault();
38
+ handleClick();
39
+ };
40
+
41
+ const getIconFromType = (type: any) => {
42
+ switch (_.toUpper(type)) {
43
+ case "PDF":
44
+ return faFilePdf;
45
+ case "DOC":
46
+ case "DOCX":
47
+ case "RTF":
48
+ case "TXT":
49
+ return faFileWord;
50
+ case "CSV":
51
+ return faFileCsv;
52
+ case "JPG":
53
+ case "PNG":
54
+ case "SVG":
55
+ case "GIF":
56
+ return faFileImage;
57
+ case "MP3":
58
+ case "WAV":
59
+ return faFileAudio;
60
+ case "MP4":
61
+ case "AVI":
62
+ case "MPG":
63
+ case "MPEG":
64
+ case "MOV":
65
+ return faFileVideo;
66
+ case "7Z":
67
+ case "ZIP":
68
+ case "RAR":
69
+ return faFileZipper;
70
+ default:
71
+ return faDatabase;
72
+ }
73
+ };
74
+
25
75
  return (
26
76
  <div className={clsx(styles.container, [layoutClassName && layoutClassName])}>
27
77
  <div className={styles.content}>
28
- <div className={styles.icon}>{icon}</div>
78
+ <div className={styles.icon}>{icon ?? <FontAwesomeIcon icon={getIconFromType(type)} />}</div>
79
+
80
+ <Heading3 className={styles.title}>{label}</Heading3>
29
81
 
30
82
  <div>
31
- {label} ({sizeKb}kb)
83
+ ({_.toUpper(type)}
84
+ {size && `, ${size} kb`})
32
85
  </div>
33
86
  </div>
34
87
 
35
- <Link onClick={handleClick}>
36
- <FontAwesomeIcon className={styles.icon} icon={faDownload} /> {downloadLabel}
88
+ <Link className={styles.link} href="" onClick={(e) => onClick(e)}>
89
+ <FontAwesomeIcon className={styles.icon} icon={faDownload} /> Download
37
90
  </Link>
38
91
  </div>
39
92
  );
@@ -1,6 +1,5 @@
1
1
  :root {
2
2
  --conduciton-input-checkbox-checkmark-url: url("data:image/svg+xml,%3Csvg id='eXTGSQIndRe1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 13 13' shape-rendering='geometricPrecision' text-rendering='geometricPrecision'%3E%3Cg transform='translate(-85.642166-156.631362)'%3E%3Cpath d='M86.73927,163.90021l1.92835-2.05763l4.165103,4.176559c-.692268.524-1.562158,1.361078-1.562158,2.198156L86.73927,163.90021Z' fill='%23fff' stroke-width='0'/%3E%3Cpath d='M95.2777,158.04542l2.26736,1.67416-6.27449,8.49772-1.917847-1.798161L95.2777,158.04542Z' fill='%23fff' stroke-width='0'/%3E%3C/g%3E%3C/svg%3E%0A");
3
-
4
3
  --conduction-input-checkbox-color: #ffffff;
5
4
  --conduction-input-checkbox-border-width: 1px;
6
5
  --conduction-input-checkbox-border-style: solid;
@@ -8,7 +8,8 @@ import { faArrowRight, faClose } from "@fortawesome/free-solid-svg-icons";
8
8
 
9
9
  export interface NotificationPopUpProps {
10
10
  title: string;
11
- description: string | JSX.Element;
11
+ description?: string | JSX.Element;
12
+ customContent?: JSX.Element;
12
13
  isVisible: boolean;
13
14
  hide: () => void;
14
15
  primaryButton: {
@@ -35,6 +36,7 @@ export const NotificationPopUp = ({
35
36
  primaryButton,
36
37
  secondaryButton,
37
38
  layoutClassName,
39
+ customContent,
38
40
  }: NotificationPopUpProps): JSX.Element | null => {
39
41
  const [animationVisible, setAnimationVisible] = React.useState<boolean>(true);
40
42
 
@@ -56,7 +58,8 @@ export const NotificationPopUp = ({
56
58
  >
57
59
  <Heading3>{title}</Heading3>
58
60
 
59
- <Paragraph>{description}</Paragraph>
61
+ {description && <Paragraph>{description}</Paragraph>}
62
+ {customContent && customContent}
60
63
 
61
64
  <div className={styles.buttons}>
62
65
  {secondaryButton && (