diff --git a/README.md b/README.md index 2b6b90a..35009f7 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,20 @@ - **Version 2.2 (breaking changes from 2.1.x)** + - 2.2.40: + - Updated DownloadCard to only accept fontawesome icons. + - Removed tooltip from PrimaryTopNav component and updated dropdown. + - 2.2.39: + - Updated PrimaryTopNav component to include tooltip and better dropdown. + - Updated Logo component to have navbar option. + - 2.2.38: Updated DownloadCard to show only one icon. + - 2.2.37: Updated DownloadCard to include tooltip and Removed opacity token from Tooltip the fix bug. + - 2.2.35 & 2.2.36: + - Bugfix versions. + - 2.2.34: + - Added select options grouping logic. + - 2.2.33: + - Refactored DownloadCard. - 2.2.32: Added more tokens to DownloadCard. - 2.2.31: - Added custom content to NotificationPopUp. diff --git a/package-lock.json b/package-lock.json index 63b17f1..be0f5e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@conduction/components", - "version": "2.2.31", + "version": "2.2.37", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@conduction/components", - "version": "2.2.31", + "version": "2.2.37", "license": "ISC", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.4.2", @@ -21,7 +21,7 @@ "react-paginate": "^8.2.0", "react-select": "5.8.0", "react-tabs": "^6.0.2", - "react-tooltip": "^5.23.0" + "react-tooltip": "^5.24.0" }, "devDependencies": { "@types/node": "^20.9.3", @@ -14654,9 +14654,9 @@ } }, "node_modules/react-tooltip": { - "version": "5.23.0", - "resolved": "https://registry.npmjs.org/react-tooltip/-/react-tooltip-5.23.0.tgz", - "integrity": "sha512-MYqn6n+Af8NHHDL3zrSqzVSoK2LLqTNFp30CuuHCYlBEf+q88FWfg+8pSO+0GnDvOa5ZaryNDq9sAVQeNhnsgw==", + "version": "5.24.0", + "resolved": "https://registry.npmjs.org/react-tooltip/-/react-tooltip-5.24.0.tgz", + "integrity": "sha512-HjstgpOrUwP4eN6mHU4EThpbxVuKO5SvqumRt1aAcPq0ya+pIVVxlwltndtdIIMBJ7w3jnN05vNfcfh2sxE2mQ==", "dependencies": { "@floating-ui/dom": "^1.0.0", "classnames": "^2.3.0" @@ -28087,9 +28087,9 @@ } }, "react-tooltip": { - "version": "5.23.0", - "resolved": "https://registry.npmjs.org/react-tooltip/-/react-tooltip-5.23.0.tgz", - "integrity": "sha512-MYqn6n+Af8NHHDL3zrSqzVSoK2LLqTNFp30CuuHCYlBEf+q88FWfg+8pSO+0GnDvOa5ZaryNDq9sAVQeNhnsgw==", + "version": "5.24.0", + "resolved": "https://registry.npmjs.org/react-tooltip/-/react-tooltip-5.24.0.tgz", + "integrity": "sha512-HjstgpOrUwP4eN6mHU4EThpbxVuKO5SvqumRt1aAcPq0ya+pIVVxlwltndtdIIMBJ7w3jnN05vNfcfh2sxE2mQ==", "requires": { "@floating-ui/dom": "^1.0.0", "classnames": "^2.3.0" diff --git a/package.json b/package.json index 5eb06be..bcd7ddd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@conduction/components", - "version": "2.2.32", + "version": "2.2.40", "description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)", "main": "lib/index.js", "scripts": { @@ -14,12 +14,7 @@ "type": "git", "url": "git+https://github.com/ConductionNL/conduction-components.git" }, - "keywords": [ - "React", - "Gatsby", - "Conduction", - "Components" - ], + "keywords": ["React", "Gatsby", "Conduction", "Components"], "author": "Conduction B.V.", "license": "ISC", "bugs": { @@ -39,7 +34,7 @@ "react-paginate": "^8.2.0", "react-select": "5.8.0", "react-tabs": "^6.0.2", - "react-tooltip": "^5.23.0" + "react-tooltip": "^5.24.0" }, "devDependencies": { "@types/node": "^20.9.3", diff --git a/src/components/card/downloadCard/DownloadCard.module.css b/src/components/card/downloadCard/DownloadCard.module.css index 1e57b8e..f0c306f 100644 --- a/src/components/card/downloadCard/DownloadCard.module.css +++ b/src/components/card/downloadCard/DownloadCard.module.css @@ -1,4 +1,5 @@ :root { + /* --conduction-download-card-background-color: #ffffff; */ --conduction-download-card-title-color: #000000; --conduction-download-card-title-font-size: 20px; --conduction-download-card-title-font-weight: bold; @@ -19,13 +20,14 @@ } .container { + background-color: var(--conduction-download-card-background-color, var(--conduction-card-wrapper-background-color)); display: flex; align-items: center; justify-content: space-between; - border-width: var(--conduction-download-card-border-width); - border-style: var(--conduction-download-card-border-style); - border-color: var(--conduction-download-card-border-color); - border-radius: var(--conduction-download-card-border-radius); + border-width: var(--conduction-download-card-border-width, var(--conduction-card-wrapper-border-width)); + border-style: var(--conduction-download-card-border-style, var(--conduction-card-wrapper-border-style)); + border-color: var(--conduction-download-card-border-color, var(--conduction-card-wrapper-border-color)); + border-radius: var(--conduction-download-card-border-radius, --conduction-card-wrapper-border-radius); padding-inline-start: var(--conduction-download-card-padding-inline-start); padding-inline-end: var(--conduction-download-card-padding-inline-end); padding-block-start: var(--conduction-download-card-padding-block-start); @@ -33,22 +35,29 @@ } .title { - color: var(--conduction-download-card-title-color); - font-size: var(--conduction-download-card-title-font-size); - font-weight: var(--conduction-download-card-title-font-weight); - font-family: var(--conduction-download-card-title-font-family); - margin-inline-end: var(--conduction-download-card-title-margin-inline-end); + color: var(--conduction-download-card-title-color) !important; + font-size: var(--conduction-download-card-title-font-size) !important; + font-weight: var(--conduction-download-card-title-font-weight) !important; + font-family: var(--conduction-download-card-title-font-family) !important; + margin-inline-end: var(--conduction-download-card-title-margin-inline-end) !important; + word-break: break-word; } .content { display: flex; align-items: center; + width: 100%; + flex-wrap: wrap; } .icon { margin-inline-end: var(--conduction-download-card-icon-gap); } +.link { + display: inherit; +} + .link:hover { cursor: pointer; } diff --git a/src/components/card/downloadCard/DownloadCard.tsx b/src/components/card/downloadCard/DownloadCard.tsx index a0055c4..fa3efe7 100644 --- a/src/components/card/downloadCard/DownloadCard.tsx +++ b/src/components/card/downloadCard/DownloadCard.tsx @@ -5,6 +5,7 @@ import clsx from "clsx"; import { Heading3, Link } from "@utrecht/component-library-react/dist/css-module"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { + IconDefinition, faDatabase, faDownload, faFileAudio, @@ -20,7 +21,11 @@ interface DownloadCardProps { label: string; size: string; type: string; - icon?: JSX.Element; + labelTooltip?: { + id: string; + tooltip: string; + }; + icon?: IconDefinition; layoutClassName?: string; handleClick: () => any; } @@ -30,6 +35,7 @@ export const DownloadCard = ({ label, size, type, + labelTooltip, layoutClassName, handleClick, }: DownloadCardProps): JSX.Element => { @@ -74,18 +80,23 @@ export const DownloadCard = ({ return (
+
{}
-
{icon ?? }
- - {label} + + {label} +
({_.toUpper(type)} - {size && `, ${size} kb`}) + {size && `, ${size}kB`})
- onClick(e)}> + onClick(e)}> Download
diff --git a/src/components/formFields/checkbox/checkbox.tsx b/src/components/formFields/checkbox/Checkbox.tsx similarity index 84% rename from src/components/formFields/checkbox/checkbox.tsx rename to src/components/formFields/checkbox/Checkbox.tsx index 94db9c0..aef2081 100644 --- a/src/components/formFields/checkbox/checkbox.tsx +++ b/src/components/formFields/checkbox/Checkbox.tsx @@ -1,5 +1,5 @@ -import * as styles from "./checkbox.module.css"; -import { IReactHookFormProps } from "./../types"; +import * as styles from "./Checkbox.module.css"; +import { IReactHookFormProps } from "../types"; export interface ICheckboxProps { label: string; diff --git a/src/components/formFields/index.tsx b/src/components/formFields/index.tsx index 1399ae9..bebbc77 100644 --- a/src/components/formFields/index.tsx +++ b/src/components/formFields/index.tsx @@ -1,6 +1,6 @@ import { InputText, InputPassword, InputEmail, InputURL, InputNumber, InputFile } from "./input"; import { Textarea } from "./textarea"; -import { InputCheckbox } from "./checkbox/checkbox"; +import { InputCheckbox } from "./checkbox/Checkbox"; import { SelectSingle, SelectMultiple, SelectCreate } from "./select/select"; import { CreateKeyValue, IKeyValue } from "./createKeyValue/CreateKeyValue"; import { InputDate } from "./date/Date"; diff --git a/src/components/formFields/select/select.module.css b/src/components/formFields/select/select.module.css index f314a5e..4bf19e0 100644 --- a/src/components/formFields/select/select.module.css +++ b/src/components/formFields/select/select.module.css @@ -24,6 +24,10 @@ --conduction-input-select-placeholder-font-family: "Noto Sans", Arial, sans-serif; --conduction-input-select-placeholder-color: #757575; + + --conduction-input-select-group-font-size: 12px; + --conduction-input-select-group-text-color: grey; + --conduction-input-select-group-font-family: "Noto Sans", Arial, sans-serif; } .select > div { @@ -56,3 +60,9 @@ border: var(--conduction-input-select-border-focus); border-radius: var(--conduction-input-select-border-radius); } + +.groupLabel { + font-size: var(--conduction-input-select-group-font-size); + color: var(--conduction-input-select-group-text-color); + font-family: var(--conduction-input-select-group-font-family); +} diff --git a/src/components/formFields/select/select.tsx b/src/components/formFields/select/select.tsx index 854dfd2..8a4a1d5 100644 --- a/src/components/formFields/select/select.tsx +++ b/src/components/formFields/select/select.tsx @@ -2,14 +2,17 @@ import * as React from "react"; import * as styles from "./select.module.css"; import clsx from "clsx"; import CreatableSelect from "react-select/creatable"; -import ReactSelect, { MenuPlacement, StylesConfig } from "react-select"; +import ReactSelect, { MenuPlacement, StylesConfig, GroupBase } from "react-select"; import { Control, Controller, FieldValues } from "react-hook-form"; import { IReactHookFormProps } from "../types"; import { ErrorMessage } from "../errorMessage/ErrorMessage"; +export type TSelectOption = { label: string; value: string }; +export type TGroupedSelectOption = { label: string; options: TSelectOption[] }; + interface ISelectProps { control: Control; - options: { label: string; value: string }[]; + options: TSelectOption[] | TGroupedSelectOption[]; name: string; ariaLabel: string; id?: string; @@ -103,6 +106,7 @@ export const SelectMultiple = ({ menuPlacement={menuPlacement} styles={selectStyles} placeholder={disabled ? "Disabled..." : placeholder ?? "Select one or more options..."} + formatGroupLabel={(group) => } /> {errors[name] && !hideErrorMessage && } @@ -148,6 +152,7 @@ export const SelectCreate = ({ menuPortalTarget={document.body} menuPlacement={menuPlacement} styles={selectStyles} + formatGroupLabel={(group) => } /> {errors[name] && !hideErrorMessage && } @@ -193,6 +198,7 @@ export const SelectSingle = ({ menuPlacement={menuPlacement} styles={selectStyles} placeholder={disabled ? "Disabled..." : placeholder ?? "Select one or more options..."} + formatGroupLabel={(group) => } /> {errors[name] && !hideErrorMessage && } @@ -201,3 +207,9 @@ export const SelectSingle = ({ /> ); }; + +const GroupLabel: React.FC<{ group: GroupBase }> = ({ group }) => { + if (!group.label) return <>; + + return {group.label}; +}; diff --git a/src/components/logo/Logo.module.css b/src/components/logo/Logo.module.css index 0f87a5b..8746312 100644 --- a/src/components/logo/Logo.module.css +++ b/src/components/logo/Logo.module.css @@ -5,7 +5,11 @@ --conduction-logo-footer-inline-size: 330px; --conduction-logo-footer-block-size: 60px; - --conduction-logo-footer-background-image: url("https://conduction.nl/wp-content/uploads/2021/07/cropped-conductionlogo-1.png"); + --conduction-logo-footer-background-image: url("https://raw.githubusercontent.com/OpenCatalogi/web-app/df1e0533081d780c05b1d0b57ab327d97adcbdc6/pwa/src/assets/svgs/LogoConduction.svg"); + + --conduction-logo-navbar-inline-size: 150px; + --conduction-logo-navbar-block-size: 40px; + --conduction-logo-navbar-background-image: url("https://raw.githubusercontent.com/OpenCatalogi/web-app/df1e0533081d780c05b1d0b57ab327d97adcbdc6/pwa/src/assets/svgs/LogoConduction.svg"); } .container { @@ -26,6 +30,12 @@ background-image: var(--conduction-logo-footer-background-image); } +.container.navbar { + inline-size: var(--conduction-logo-navbar-inline-size); + block-size: var(--conduction-logo-navbar-block-size); + background-image: var(--conduction-logo-navbar-background-image); +} + .container.clickable:hover { cursor: pointer; } diff --git a/src/components/logo/Logo.tsx b/src/components/logo/Logo.tsx index 470b321..bd5a047 100644 --- a/src/components/logo/Logo.tsx +++ b/src/components/logo/Logo.tsx @@ -3,7 +3,7 @@ import * as styles from "./Logo.module.css"; import clsx from "clsx"; interface LogoProps { - variant?: "header" | "footer"; + variant?: "header" | "footer" | "navbar"; onClick?: () => any; layoutClassName?: string; } diff --git a/src/components/notificationPopUp/NotificationPopUp.tsx b/src/components/notificationPopUp/NotificationPopUp.tsx index 042b1f8..82278f9 100644 --- a/src/components/notificationPopUp/NotificationPopUp.tsx +++ b/src/components/notificationPopUp/NotificationPopUp.tsx @@ -8,7 +8,7 @@ import { faArrowRight, faClose } from "@fortawesome/free-solid-svg-icons"; export interface NotificationPopUpProps { title: string; - description?: string | JSX.Element; + description?: string; customContent?: JSX.Element; isVisible: boolean; hide: () => void; diff --git a/src/components/toolTip/ToolTip.module.css b/src/components/toolTip/ToolTip.module.css index f310e97..8953b3c 100644 --- a/src/components/toolTip/ToolTip.module.css +++ b/src/components/toolTip/ToolTip.module.css @@ -12,7 +12,6 @@ --conduction-tooltip-border-style: unset; --conduction-tooltip-border-radius: 0px; - --conduction-tooltip-opacity: 1; --conduction-tooltip-z-index: 9999; } @@ -30,6 +29,5 @@ border-style: var(--conduction-tooltip-border-style); border-radius: var(--conduction-tooltip-border-radius) !important; - opacity: var(--conduction-tooltip-opacity); z-index: var(--conduction-tooltip-z-index); } diff --git a/src/components/topNav/primaryTopNav/PrimaryTopNav.module.css b/src/components/topNav/primaryTopNav/PrimaryTopNav.module.css index ba76f22..525f07c 100644 --- a/src/components/topNav/primaryTopNav/PrimaryTopNav.module.css +++ b/src/components/topNav/primaryTopNav/PrimaryTopNav.module.css @@ -4,7 +4,7 @@ --conduction-primary-top-nav-toggle-icon-size: 24px; --conduction-primary-top-nav-mobile-logo-padding: 18px; - --conduction-primary-top-nav-item-padding: var(--skeleton-size-md); + --conduction-primary-top-nav-item-padding: 18px; --conduction-primary-top-nav-item-icon-margin: var(--skeleton-size-2x); /* --conduction-primary-top-nav-item-border-radius: var(--skeleton-size-2x); */ @@ -103,6 +103,7 @@ .current:hover { box-shadow: var(--conduction-primary-top-nav-current-box-shadow); } + .current:hover > .currentLink { color: var(--conduction-primary-top-nav-hover-color) !important; } @@ -111,8 +112,12 @@ color: var(--conduction-primary-top-nav-current-color) !important; } +.currentLink svg path { + fill: var(--conduction-primary-top-nav-current-color) !important; +} + .mobileLink { - margin-block-end: var(--skeleton-size-md); + margin-block-end: 18px; } .primary .link { text-decoration: none; @@ -128,10 +133,18 @@ color: var(--conduction-primary-top-nav-color); } +.primary .link:not(.currentLink) svg path { + fill: var(--conduction-primary-top-nav-color); +} + .primary .li:hover .link { color: var(--conduction-primary-top-nav-hover-color); } +.primary .li:hover svg path { + fill: var(--conduction-primary-top-nav-hover-color); +} + .link > * { margin-inline-end: 8px; } @@ -144,6 +157,15 @@ display: none; list-style-type: none; background-color: var(--conduction-primary-top-nav-dropdown-background-color, var(--conduction-primary-top-nav-background-color)); + width: fit-content; + max-width: 200px; +} + +.dropdownOverflow { + display: none; + max-height: 430px; + overflow-y: scroll; + border: 1px solid rgba(0, 0, 0, 0.2); } .dropdown.isOpen { @@ -168,7 +190,7 @@ } .dropdown > li { - padding-inline-start: var(--skeleton-size-md); + padding-inline-start: 18px; } .toggleIcon { diff --git a/src/components/topNav/primaryTopNav/PrimaryTopNav.tsx b/src/components/topNav/primaryTopNav/PrimaryTopNav.tsx index 02ba3b2..8076560 100644 --- a/src/components/topNav/primaryTopNav/PrimaryTopNav.tsx +++ b/src/components/topNav/primaryTopNav/PrimaryTopNav.tsx @@ -103,13 +103,13 @@ export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName }: TopNavProp current && styles.currentLink, )} > - {icon} + {icon && icon} {label}{" "} {subItems && isMobile && } {subItems && ( -
    +
      8 && styles.dropdownOverflow])}> {subItems.map(({ label, icon, current, handleClick }, idx) => (