@inera/ids-react 6.1.0 → 7.0.0
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/components/accordion/accordion.d.ts +1 -1
- package/components/accordion/accordion.js +6 -7
- package/components/agent/agent.d.ts +1 -1
- package/components/agent/agent.js +2 -2
- package/components/alert/alert.d.ts +1 -1
- package/components/alert/alert.js +9 -2
- package/components/alert-global/alert-global.d.ts +2 -2
- package/components/alert-global/alert-global.js +6 -7
- package/components/badge/badge.d.ts +4 -3
- package/components/badge/badge.js +4 -3
- package/components/box-link/box-link.d.ts +11 -3
- package/components/box-link/box-link.js +9 -9
- package/components/breadcrumbs/breadcrumbs.d.ts +1 -1
- package/components/breadcrumbs/breadcrumbs.js +4 -2
- package/components/button/button.d.ts +23 -5
- package/components/button/button.js +94 -11
- package/components/button-group/button-group.d.ts +13 -3
- package/components/button-group/button-group.js +10 -9
- package/components/card/card.d.ts +4 -3
- package/components/card/card.js +16 -8
- package/components/carousel/carousel-item.d.ts +10 -0
- package/components/carousel/carousel-item.js +24 -0
- package/components/carousel/carousel.d.ts +11 -5
- package/components/carousel/carousel.js +167 -16
- package/components/date-label/date-label.d.ts +2 -2
- package/components/date-label/date-label.js +4 -40
- package/components/dialog/dialog.d.ts +23 -6
- package/components/dialog/dialog.js +75 -13
- package/components/dropdown/dropdown-content-link.d.ts +6 -0
- package/components/dropdown/dropdown-content-link.js +20 -0
- package/components/dropdown/dropdown.d.ts +16 -8
- package/components/dropdown/dropdown.js +72 -20
- package/components/footer-1177/footer-1177.d.ts +23 -3
- package/components/footer-1177/footer-1177.js +64 -9
- package/components/footer-1177-admin/footer-1177-admin.d.ts +21 -3
- package/components/footer-1177-admin/footer-1177-admin.js +63 -9
- package/components/footer-1177-pro/footer-1177-pro.d.ts +17 -3
- package/components/footer-1177-pro/footer-1177-pro.js +39 -9
- package/components/footer-inera/footer-inera.d.ts +23 -3
- package/components/footer-inera/footer-inera.js +64 -9
- package/components/footer-inera-admin/footer-inera-admin.d.ts +23 -3
- package/components/footer-inera-admin/footer-inera-admin.js +61 -9
- package/components/form/check-button/check-button.d.ts +7 -3
- package/components/form/check-button/check-button.js +8 -5
- package/components/form/checkbox/checkbox-group.d.ts +13 -3
- package/components/form/checkbox/checkbox-group.js +51 -9
- package/components/form/checkbox/checkbox.d.ts +17 -3
- package/components/form/checkbox/checkbox.js +50 -5
- package/components/form/error-message/error-message.d.ts +10 -0
- package/components/form/error-message/error-message.js +12 -0
- package/components/form/form-hooks/useAriaDescribedBy.d.ts +1 -0
- package/components/form/form-hooks/useAriaDescribedBy.js +26 -0
- package/components/form/form-hooks/useGroupValidity.d.ts +1 -0
- package/components/form/form-hooks/useGroupValidity.js +60 -0
- package/components/form/form-hooks/useInputValidity.d.ts +1 -0
- package/components/form/form-hooks/useInputValidity.js +27 -0
- package/components/form/input/input.d.ts +22 -3
- package/components/form/input/input.js +51 -9
- package/components/form/radio/radio-group.d.ts +13 -3
- package/components/form/radio/radio-group.js +28 -5
- package/components/form/radio/radio.d.ts +17 -3
- package/components/form/radio/radio.js +23 -9
- package/components/form/radio-button/radio-button-group.d.ts +9 -0
- package/components/form/radio-button/radio-button-group.js +22 -0
- package/components/form/radio-button/radio-button.d.ts +9 -0
- package/components/form/radio-button/radio-button.js +13 -0
- package/components/form/range/range.d.ts +16 -3
- package/components/form/range/range.js +29 -9
- package/components/form/select/select.d.ts +15 -3
- package/components/form/select/select.js +19 -9
- package/components/form/select-multiple/select-multiple.d.ts +18 -3
- package/components/form/select-multiple/select-multiple.js +60 -9
- package/components/form/spinner/spinner.d.ts +9 -3
- package/components/form/spinner/spinner.js +9 -9
- package/components/form/textarea/textarea.d.ts +18 -3
- package/components/form/textarea/textarea.js +26 -9
- package/components/form/time/time.d.ts +13 -3
- package/components/form/time/time.js +21 -9
- package/components/form/toggle/toggle.d.ts +8 -3
- package/components/form/toggle/toggle.js +10 -9
- package/components/grid/column.d.ts +16 -0
- package/components/grid/column.js +13 -0
- package/components/grid/container.d.ts +9 -0
- package/components/grid/container.js +24 -0
- package/components/grid/row.d.ts +9 -0
- package/components/grid/row.js +18 -0
- package/components/header-1177/header-1177-avatar.d.ts +10 -2
- package/components/header-1177/header-1177-avatar.js +30 -8
- package/components/header-1177/header-1177-item.d.ts +12 -2
- package/components/header-1177/header-1177-item.js +25 -8
- package/components/header-1177/header-1177-menu-mobile.d.ts +11 -0
- package/components/header-1177/header-1177-menu-mobile.js +42 -0
- package/components/header-1177/header-1177-nav-item-mobile.d.ts +11 -2
- package/components/header-1177/header-1177-nav-item-mobile.js +24 -8
- package/components/header-1177/header-1177-nav-item.d.ts +15 -2
- package/components/header-1177/header-1177-nav-item.js +22 -8
- package/components/header-1177/header-1177-nav.d.ts +8 -2
- package/components/header-1177/header-1177-nav.js +14 -8
- package/components/header-1177/header-1177.d.ts +22 -5
- package/components/header-1177/header-1177.js +41 -12
- package/components/header-1177-admin/header-1177-admin-avatar-mobile.d.ts +9 -2
- package/components/header-1177-admin/header-1177-admin-avatar-mobile.js +6 -8
- package/components/header-1177-admin/header-1177-admin-avatar.d.ts +10 -2
- package/components/header-1177-admin/header-1177-admin-avatar.js +31 -8
- package/components/header-1177-admin/header-1177-admin-item.d.ts +12 -2
- package/components/header-1177-admin/header-1177-admin-item.js +26 -8
- package/components/header-1177-admin/header-1177-admin-nav-item.d.ts +15 -2
- package/components/header-1177-admin/header-1177-admin-nav-item.js +24 -8
- package/components/header-1177-admin/header-1177-admin-nav.d.ts +7 -2
- package/components/header-1177-admin/header-1177-admin-nav.js +12 -8
- package/components/header-1177-admin/header-1177-admin.d.ts +22 -3
- package/components/header-1177-admin/header-1177-admin.js +26 -9
- package/components/header-1177-pro/header-1177-pro-avatar-mobile.d.ts +9 -2
- package/components/header-1177-pro/header-1177-pro-avatar-mobile.js +6 -8
- package/components/header-1177-pro/header-1177-pro-avatar.d.ts +10 -2
- package/components/header-1177-pro/header-1177-pro-avatar.js +31 -8
- package/components/header-1177-pro/header-1177-pro-item.d.ts +12 -2
- package/components/header-1177-pro/header-1177-pro-item.js +23 -8
- package/components/header-1177-pro/header-1177-pro-nav-item.d.ts +15 -2
- package/components/header-1177-pro/header-1177-pro-nav-item.js +33 -8
- package/components/header-1177-pro/header-1177-pro-nav-menu-mobile.d.ts +11 -5
- package/components/header-1177-pro/header-1177-pro-nav-menu-mobile.js +32 -12
- package/components/header-1177-pro/header-1177-pro-nav.d.ts +10 -2
- package/components/header-1177-pro/header-1177-pro-nav.js +27 -8
- package/components/header-1177-pro/header-1177-pro.d.ts +23 -5
- package/components/header-1177-pro/header-1177-pro.js +37 -12
- package/components/header-inera/header-inera-item.d.ts +13 -2
- package/components/header-inera/header-inera-item.js +24 -8
- package/components/header-inera/header-inera-nav-item.d.ts +15 -2
- package/components/header-inera/header-inera-nav-item.js +54 -8
- package/components/header-inera/header-inera-nav-mobile.d.ts +11 -5
- package/components/header-inera/header-inera-nav-mobile.js +44 -12
- package/components/header-inera/header-inera-nav.d.ts +7 -2
- package/components/header-inera/header-inera-nav.js +13 -8
- package/components/header-inera/header-inera.d.ts +16 -3
- package/components/header-inera/header-inera.js +16 -9
- package/components/header-inera-admin/header-inera-admin-avatar-mobile.d.ts +9 -2
- package/components/header-inera-admin/header-inera-admin-avatar-mobile.js +11 -8
- package/components/header-inera-admin/header-inera-admin-avatar.d.ts +12 -2
- package/components/header-inera-admin/header-inera-admin-avatar.js +32 -8
- package/components/header-inera-admin/header-inera-admin-item.d.ts +13 -2
- package/components/header-inera-admin/header-inera-admin-item.js +24 -8
- package/components/header-inera-admin/header-inera-admin-nav-item.d.ts +16 -2
- package/components/header-inera-admin/header-inera-admin-nav-item.js +54 -8
- package/components/header-inera-admin/header-inera-admin-nav-mobile.d.ts +12 -5
- package/components/header-inera-admin/header-inera-admin-nav-mobile.js +32 -12
- package/components/header-inera-admin/header-inera-admin-nav.d.ts +8 -2
- package/components/header-inera-admin/header-inera-admin-nav.js +13 -8
- package/components/header-inera-admin/header-inera-admin.d.ts +15 -3
- package/components/header-inera-admin/header-inera-admin.js +24 -9
- package/components/header-patient/header-patient.d.ts +13 -0
- package/components/header-patient/header-patient.js +21 -0
- package/components/link/link.d.ts +17 -3
- package/components/link/link.js +42 -9
- package/components/mobile/menu/item/mobile-item.d.ts +15 -4
- package/components/mobile/menu/item/mobile-item.js +58 -11
- package/components/mobile/menu/mobile-menu.d.ts +7 -3
- package/components/mobile/menu/mobile-menu.js +9 -9
- package/components/navigation/content/navigation-content.d.ts +7 -3
- package/components/navigation/content/navigation-content.js +18 -9
- package/components/navigation/local/navigation-local.d.ts +7 -3
- package/components/navigation/local/navigation-local.js +6 -9
- package/components/notification/badge/notification-badge.d.ts +4 -2
- package/components/notification/badge/notification-badge.js +4 -3
- package/components/pagination/data-pagination/data-pagination.d.ts +24 -3
- package/components/pagination/data-pagination/data-pagination.js +14 -9
- package/components/pagination/list-pagination/list-pagination.d.ts +19 -7
- package/components/pagination/list-pagination/list-pagination.js +51 -14
- package/components/popover/popover.d.ts +20 -5
- package/components/popover/popover.js +192 -16
- package/components/progressbar/progressbar.d.ts +2 -1
- package/components/progressbar/progressbar.js +4 -2
- package/components/puff-list/puff-list-item/puff-list-item-info.d.ts +7 -0
- package/components/puff-list/puff-list-item/puff-list-item-info.js +8 -0
- package/components/puff-list/puff-list-item/puff-list-item.d.ts +18 -3
- package/components/puff-list/puff-list-item/puff-list-item.js +58 -9
- package/components/puff-list/puff-list.d.ts +7 -3
- package/components/puff-list/puff-list.js +6 -9
- package/components/region-icon/region-icon.d.ts +12 -0
- package/components/region-icon/region-icon.js +25 -0
- package/components/side-menu/side-menu.d.ts +16 -6
- package/components/side-menu/side-menu.js +52 -13
- package/components/side-panel/side-panel.d.ts +21 -6
- package/components/side-panel/side-panel.js +74 -13
- package/components/stepper/step.d.ts +18 -0
- package/components/stepper/step.js +41 -0
- package/components/stepper/stepper.d.ts +9 -7
- package/components/stepper/stepper.js +21 -19
- package/components/tabs/tab-panel.d.ts +11 -0
- package/components/tabs/tab-panel.js +20 -0
- package/components/tabs/tab.d.ts +15 -0
- package/components/tabs/tab.js +19 -0
- package/components/tabs/tabs.d.ts +14 -9
- package/components/tabs/tabs.js +79 -25
- package/components/tag/tag.d.ts +5 -6
- package/components/tag/tag.js +9 -9
- package/components/tooltip/tooltip.d.ts +10 -3
- package/components/tooltip/tooltip.js +79 -9
- package/components/utils/contexts/HeaderContext.d.ts +9 -0
- package/components/utils/contexts/HeaderContext.js +7 -0
- package/components/utils/hooks/useElementId.d.ts +5 -0
- package/components/utils/hooks/useElementId.js +12 -0
- package/components/utils/hooks/useFocusTrap.d.ts +1 -0
- package/components/utils/hooks/useFocusTrap.js +44 -0
- package/components/utils/utils.d.ts +6 -0
- package/components/utils/utils.js +44 -0
- package/index.d.ts +15 -5
- package/index.js +20 -10
- package/license.md +6 -6
- package/package.json +2 -2
- package/components/form/errormessage/error-message.d.ts +0 -3
- package/components/form/errormessage/error-message.js +0 -12
- package/components/grid/grid.d.ts +0 -9
- package/components/grid/grid.js +0 -26
- package/components/header-1177/header-1177-nav-menu-mobile.d.ts +0 -5
- package/components/header-1177/header-1177-nav-menu-mobile.js +0 -15
- package/components/icon-region/icon-region.d.ts +0 -3
- package/components/icon-region/icon-region.js +0 -12
- package/components/puff-list/puff-list-item/puff-list-info/puff-list-item-info.d.ts +0 -3
- package/components/puff-list/puff-list-item/puff-list-info/puff-list-item-info.js +0 -12
|
@@ -1,15 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import '@inera/ids-design/components/header-1177/header-1177.css';
|
|
6
|
+
import { HeaderProvider } from '../utils/contexts/HeaderContext.js';
|
|
5
7
|
|
|
6
|
-
const IDSHeader1177 =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const IDSHeader1177 = ({ regionPickerText = "Välj region", srLogoLabel = "Logotyp", hideRegionPicker: initialRegionPicker = false, regionPickerExpanded: initialExpanded = false, fluid = false, unresponsive = false, logoHref = "", logoProps = {}, logo, regionIcon, skipToContentLink, onToggleRegion, items, avatar, mobileMenu, className, children }) => {
|
|
9
|
+
const [regionPickerExpanded, setRegionPickerExpanded] = useState(initialExpanded);
|
|
10
|
+
const [hideRegionPicker, setHideRegionPicker] = useState(initialRegionPicker);
|
|
11
|
+
const regionIconRef = useRef(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (avatar) {
|
|
14
|
+
// No region picker when avatar
|
|
15
|
+
setRegionPickerExpanded(false);
|
|
16
|
+
setHideRegionPicker(true);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
setHideRegionPicker(initialRegionPicker);
|
|
20
|
+
}
|
|
21
|
+
}, [avatar]);
|
|
22
|
+
const toggleRegion = () => {
|
|
23
|
+
setRegionPickerExpanded(prev => !prev);
|
|
24
|
+
onToggleRegion?.(!regionPickerExpanded);
|
|
25
|
+
};
|
|
26
|
+
const renderRegion = () => {
|
|
27
|
+
if (hideRegionPicker)
|
|
28
|
+
return null;
|
|
29
|
+
return (jsxs("div", { className: clsx("ids-header-1177__region", {
|
|
30
|
+
"ids-header-1177__region--selected": !!regionIcon
|
|
31
|
+
}), children: [jsx("span", { className: "ids-header-1177__region-icon", ref: regionIconRef, children: regionIcon }), jsx("span", { className: "ids-header-1177__region-picker", children: jsx("button", { onClick: toggleRegion, className: clsx("ids-header-1177__region-picker__button", {
|
|
32
|
+
"ids-header-1177__region-picker__button--expanded": regionPickerExpanded
|
|
33
|
+
}), "aria-label": regionPickerText, children: jsx("span", { className: "ids-header-1177__region-picker__text", children: regionPickerText }) }) })] }));
|
|
34
|
+
};
|
|
35
|
+
const renderLogo = () => {
|
|
36
|
+
return (jsx("div", { className: "ids-header-1177__logo-wrapper", children: jsx("div", { className: "ids-header-1177__logo", children: logo ? (jsx("span", { className: "ids-header-1177__link", children: logo })) : (jsx("a", { className: "ids-header-1177__logo-link", href: logoHref, "aria-label": srLogoLabel, ...logoProps })) }) }));
|
|
37
|
+
};
|
|
38
|
+
return (jsx(HeaderProvider, { value: { unresponsive, fluid }, children: jsxs("header", { className: clsx("ids-header-1177", {
|
|
39
|
+
"ids-header-1177--unresponsive": unresponsive,
|
|
40
|
+
"ids-header-1177--fluid": fluid
|
|
41
|
+
}, className), children: [skipToContentLink && (jsx("div", { className: "ids-header-1177__skip-to-content", children: skipToContentLink })), jsx("div", { className: "ids-header-1177__container", children: jsxs("div", { className: "ids-header-1177__inner", children: [jsxs("div", { className: "ids-header-1177__inner-left", children: [renderLogo(), renderRegion()] }), jsx("div", { className: "ids-header-1177__inner-right", children: jsxs("div", { className: "ids-header-1177__items", children: [items, " ", avatar, mobileMenu && jsx("div", { className: "ids-header-1177__mobile-menu", children: mobileMenu })] }) })] }) }), children] }) }));
|
|
42
|
+
};
|
|
14
43
|
|
|
15
44
|
export { IDSHeader1177 };
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/header-1177-admin/header-1177-admin-avatar-mobile.css";
|
|
3
|
+
interface IDSHeader1177AdminAvatarMobileProps {
|
|
4
|
+
username?: string;
|
|
5
|
+
unit?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const IDSHeader1177AdminAvatarMobile: React.FC<IDSHeader1177AdminAvatarMobileProps>;
|
|
9
|
+
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import '@inera/ids-design/components/header-1177-admin/header-1177-admin-avatar-mobile.css';
|
|
4
4
|
|
|
5
|
-
const IDSHeader1177AdminAvatarMobile =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
react: React
|
|
9
|
-
});
|
|
5
|
+
const IDSHeader1177AdminAvatarMobile = ({ username = "", unit = "", children }) => {
|
|
6
|
+
return (jsx("div", { className: "ids-header-1177-admin__avatar-mobile", children: username || unit ? (jsxs(Fragment, { children: [jsxs("div", { className: "ids-header-1177-admin__avatar-mobile__logged-in", children: [jsx("div", { className: "ids-header-1177-admin__avatar-mobile__username", children: username }), jsx("div", { className: "ids-header-1177-admin__avatar-mobile__unit", children: unit })] }), children] })) : (jsx(Fragment, { children: children })) }));
|
|
7
|
+
};
|
|
10
8
|
|
|
11
9
|
export { IDSHeader1177AdminAvatarMobile };
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/header-1177-admin/header-1177-admin-avatar.css";
|
|
3
|
+
interface IDSHeader1177AdminAvatarProps {
|
|
4
|
+
username?: string;
|
|
5
|
+
unit?: string;
|
|
6
|
+
persistent?: boolean;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const IDSHeader1177AdminAvatar: React.FC<IDSHeader1177AdminAvatarProps>;
|
|
10
|
+
export {};
|
|
@@ -1,11 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import '@inera/ids-design/components/header-1177-admin/header-1177-admin-avatar.css';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { useHeaderContext } from '../utils/contexts/HeaderContext.js';
|
|
4
7
|
|
|
5
|
-
const IDSHeader1177AdminAvatar =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const IDSHeader1177AdminAvatar = ({ username = "", unit = "", persistent = false, children }) => {
|
|
9
|
+
const headerContext = useHeaderContext();
|
|
10
|
+
const [expanded, setExpanded] = useState(false);
|
|
11
|
+
const avatarRef = useRef(null);
|
|
12
|
+
const toggleExpanded = () => {
|
|
13
|
+
setExpanded(prev => !prev);
|
|
14
|
+
};
|
|
15
|
+
const handleClickOutside = (event) => {
|
|
16
|
+
if (!persistent && avatarRef.current && !avatarRef.current.contains(event.target)) {
|
|
17
|
+
setExpanded(false);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
document.addEventListener("click", handleClickOutside);
|
|
22
|
+
return () => {
|
|
23
|
+
document.removeEventListener("click", handleClickOutside);
|
|
24
|
+
};
|
|
25
|
+
}, [persistent]);
|
|
26
|
+
return (jsxs("div", { ref: avatarRef, className: clsx("ids-header-1177-admin__avatar", {
|
|
27
|
+
"ids-header-1177-admin__avatar--unresponsive": headerContext?.unresponsive,
|
|
28
|
+
"ids-header-1177-admin__avatar--expanded": expanded
|
|
29
|
+
}), children: [jsxs("button", { onClick: toggleExpanded, "aria-expanded": expanded, className: "ids-header-1177-admin__avatar-box", children: [jsx("div", { className: "ids-header-1177-admin__avatar-icon" }), jsxs("div", { className: "ids-header-1177-admin__avatar-content", children: [jsx("div", { className: "ids-header-1177-admin__avatar-content__name", title: username, children: username }), unit && (jsx("div", { className: "ids-header-1177-admin__avatar-content__unit", title: unit, children: unit }))] }), jsx("div", { className: clsx("ids-header-1177-admin__avatar-chevron", {
|
|
30
|
+
"ids-header-1177-admin__avatar-chevron--expanded": expanded
|
|
31
|
+
}) })] }), jsx("div", { className: "ids-header-1177-admin__avatar-dropdown", children: children })] }));
|
|
32
|
+
};
|
|
10
33
|
|
|
11
34
|
export { IDSHeader1177AdminAvatar };
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/header-1177-admin/header-1177-admin-item.css";
|
|
3
|
+
interface IDSHeader1177AdminItemProps {
|
|
4
|
+
mobile?: boolean;
|
|
5
|
+
icon?: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
link?: ReactNode;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const IDSHeader1177AdminItem: React.FC<IDSHeader1177AdminItemProps>;
|
|
12
|
+
export {};
|
|
@@ -1,11 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { isValidElement, cloneElement } from 'react';
|
|
4
|
+
import '@inera/ids-design/components/header-1177-admin/header-1177-admin-item.css';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { useHeaderContext } from '../utils/contexts/HeaderContext.js';
|
|
4
7
|
|
|
5
|
-
const IDSHeader1177AdminItem =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const IDSHeader1177AdminItem = ({ mobile = false, href = "", text = "", icon, link, onClick, ...props }) => {
|
|
9
|
+
const headerContext = useHeaderContext();
|
|
10
|
+
const classNames = clsx("ids-header-1177-admin__items__item", {
|
|
11
|
+
"ids-header-1177-admin__items__item--unresponsive": headerContext?.unresponsive,
|
|
12
|
+
"ids-header-1177-admin__items__item--mobile": mobile
|
|
13
|
+
});
|
|
14
|
+
const renderContent = () => {
|
|
15
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: "ids-header-1177-admin__items__item-icon", "aria-label": text, children: jsx("span", { className: `ids-icon-${icon}` }) }), jsx("div", { className: "ids-header-1177-admin__items__item-text", children: text })] }));
|
|
16
|
+
};
|
|
17
|
+
if (link && isValidElement(link)) {
|
|
18
|
+
return cloneElement(link, {
|
|
19
|
+
...props,
|
|
20
|
+
className: clsx(link.props.className, classNames),
|
|
21
|
+
children: renderContent()
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return onClick ? (jsx("button", { className: classNames, onClick: onClick, style: {
|
|
25
|
+
cursor: "pointer"
|
|
26
|
+
}, ...props, children: renderContent() })) : (jsx("a", { className: classNames, href: href, ...props, children: renderContent() }));
|
|
27
|
+
};
|
|
10
28
|
|
|
11
29
|
export { IDSHeader1177AdminItem };
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode, ReactElement } from "react";
|
|
2
|
+
import "@inera/ids-design/components/header-1177-admin/header-1177-admin-nav-item.css";
|
|
3
|
+
import { IDSLinkProps } from "../link/link";
|
|
4
|
+
interface IDSHeader1177AdminNavItemProps {
|
|
5
|
+
active?: boolean;
|
|
6
|
+
expanded?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
col1?: ReactElement<IDSLinkProps>[];
|
|
9
|
+
col2?: ReactElement<IDSLinkProps>[];
|
|
10
|
+
col3?: ReactElement<IDSLinkProps>[];
|
|
11
|
+
col4?: ReactElement<IDSLinkProps>[];
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const IDSHeader1177AdminNavItem: React.FC<IDSHeader1177AdminNavItemProps>;
|
|
15
|
+
export {};
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React__default, { useState } from 'react';
|
|
4
|
+
import '@inera/ids-design/components/header-1177-admin/header-1177-admin-nav-item.css';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { useHeaderContext } from '../utils/contexts/HeaderContext.js';
|
|
4
7
|
|
|
5
|
-
const IDSHeader1177AdminNavItem =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const IDSHeader1177AdminNavItem = ({ active = false, expanded = false, label = "", col1, col2, col3, col4, children }) => {
|
|
9
|
+
const headerContext = useHeaderContext();
|
|
10
|
+
const [isExpanded, setIsExpanded] = useState(expanded);
|
|
11
|
+
const toggleExpanded = () => {
|
|
12
|
+
setIsExpanded(prev => !prev);
|
|
13
|
+
};
|
|
14
|
+
const renderLink = (link) => {
|
|
15
|
+
return React__default.isValidElement(link)
|
|
16
|
+
? React__default.cloneElement(link, { activeIcon: true, block: true, colorPreset: 1 })
|
|
17
|
+
: link;
|
|
18
|
+
};
|
|
19
|
+
const renderDropdown = () => isExpanded && (jsx("div", { style: { marginTop: "0.125rem" }, id: "ids-header-1177-admin-nav-dropdown", className: "ids-header-1177-admin__items__item-dropdown", children: jsxs("div", { className: "ids-header-1177-admin__items__item-dropdown__content", children: [jsx("div", { className: "ids-header-1177-admin__items__item-dropdown__content-col-1", children: col1?.map((link, idx) => (jsx("div", { className: "ids-header-1177-admin__items-wrapper", children: renderLink(link) }, idx))) }), jsx("div", { className: "ids-header-1177-admin__items__item-dropdown__content-col-2", children: col2?.map((link, idx) => (jsx("div", { className: "ids-header-1177-admin__items-wrapper", children: renderLink(link) }, idx))) }), jsx("div", { className: "ids-header-1177-admin__items__item-dropdown__content-col-3", children: col3?.map((link, idx) => (jsx("div", { className: "ids-header-1177-admin__items-wrapper", children: renderLink(link) }, idx))) }), jsx("div", { className: "ids-header-1177-admin__items__item-dropdown__content-col-4", children: col4?.map((link, idx) => (jsx("div", { className: "ids-header-1177-admin__items-wrapper", children: renderLink(link) }, idx))) })] }) }));
|
|
20
|
+
return (jsxs("div", { className: clsx("ids-header-1177-admin__nav-item", {
|
|
21
|
+
"ids-header-1177-admin__nav-item--fluid": headerContext?.fluid,
|
|
22
|
+
"ids-header-1177-admin__nav-item--unresponsive": headerContext?.unresponsive,
|
|
23
|
+
"ids-header-1177-admin__nav-item--active": active || isExpanded
|
|
24
|
+
}), children: [label ? (jsx("button", { onClick: toggleExpanded, "aria-expanded": isExpanded, "aria-controls": "ids-header-1177-admin-nav-dropdown", children: label })) : (children), renderDropdown()] }));
|
|
25
|
+
};
|
|
10
26
|
|
|
11
27
|
export { IDSHeader1177AdminNavItem };
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/header-1177-admin/header-1177-admin-nav.css";
|
|
3
|
+
interface IDSHeader1177AdminNavProps {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const IDSHeader1177AdminNav: React.FC<IDSHeader1177AdminNavProps>;
|
|
7
|
+
export {};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import '@inera/ids-design/components/header-1177-admin/header-1177-admin-nav.css';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { useHeaderContext } from '../utils/contexts/HeaderContext.js';
|
|
4
6
|
|
|
5
|
-
const IDSHeader1177AdminNav =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const IDSHeader1177AdminNav = ({ children }) => {
|
|
8
|
+
const headerContext = useHeaderContext();
|
|
9
|
+
return (jsx("nav", { className: clsx("ids-header-1177-admin__nav", {
|
|
10
|
+
"ids-header-1177-admin__nav--fluid": headerContext?.fluid,
|
|
11
|
+
"ids-header-1177-admin__nav--unresponsive": headerContext?.unresponsive
|
|
12
|
+
}), children: jsx("div", { className: "ids-header-1177-admin__nav-inner", children: children }) }));
|
|
13
|
+
};
|
|
10
14
|
|
|
11
15
|
export { IDSHeader1177AdminNav };
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import React, { AnchorHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/header-1177-admin/header-1177-admin.css";
|
|
3
|
+
interface IDSHeader1177AdminProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
fluid?: boolean;
|
|
5
|
+
unresponsive?: boolean;
|
|
6
|
+
srLogoLabel?: string;
|
|
7
|
+
brandTextTop?: string;
|
|
8
|
+
brandText?: string;
|
|
9
|
+
brandTextBottom?: string;
|
|
10
|
+
logoHref?: string;
|
|
11
|
+
logoProps?: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
12
|
+
srMobileMenuLabel?: string;
|
|
13
|
+
mobileMenuExpanded?: boolean;
|
|
14
|
+
logo?: ReactNode;
|
|
15
|
+
avatar?: ReactNode;
|
|
16
|
+
mobileMenu?: ReactNode;
|
|
17
|
+
items?: ReactNode;
|
|
18
|
+
skipToContentLink?: ReactNode;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export declare const IDSHeader1177Admin: React.FC<IDSHeader1177AdminProps>;
|
|
22
|
+
export {};
|
|
@@ -1,12 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import '@inera/ids-design/components/header-1177-admin/header-1177-admin.css';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { HeaderProvider } from '../utils/contexts/HeaderContext.js';
|
|
5
7
|
|
|
6
|
-
const IDSHeader1177Admin =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
8
|
+
const IDSHeader1177Admin = ({ fluid = false, unresponsive = false, srLogoLabel = "Logotyp", brandTextTop = "", brandText = "", brandTextBottom = "", logoHref = "", logoProps = {}, srMobileMenuLabel = "Meny", mobileMenuExpanded: initialExpanded = false, logo, avatar, mobileMenu, items, skipToContentLink, className, children }) => {
|
|
9
|
+
const [mobileExpanded, setMobileExpanded] = useState(initialExpanded);
|
|
10
|
+
const renderLogo = () => {
|
|
11
|
+
return logo ? (logo) : (jsx("a", { className: "ids-header-1177-admin__logo-link", href: logoHref, "aria-label": srLogoLabel, ...logoProps }));
|
|
12
|
+
};
|
|
13
|
+
const renderHamburgerButton = () => {
|
|
14
|
+
if (!mobileMenu)
|
|
15
|
+
return null;
|
|
16
|
+
return (jsx("div", { className: "ids-header-1177-admin__mobile-menu", children: jsx("button", { onClick: () => setMobileExpanded(prev => !prev), "aria-label": srMobileMenuLabel, "aria-expanded": mobileExpanded, className: "ids-header-1177-admin__mobile-menu__btn", children: jsx("div", { className: "ids-hamburger", children: jsx("div", { className: "ids-hamburger__lines" }) }) }) }));
|
|
17
|
+
};
|
|
18
|
+
const renderMobileMenuItems = () => {
|
|
19
|
+
if (!mobileExpanded || !mobileMenu)
|
|
20
|
+
return null;
|
|
21
|
+
return jsx("div", { className: "ids-header-1177-admin__nav-mobile__menu-items", children: mobileMenu });
|
|
22
|
+
};
|
|
23
|
+
return (jsx(HeaderProvider, { value: { unresponsive, fluid }, children: jsxs("header", { className: clsx("ids-header-1177-admin", {
|
|
24
|
+
"ids-header-1177-admin--unresponsive": unresponsive,
|
|
25
|
+
"ids-header-1177-admin--fluid": fluid
|
|
26
|
+
}, className), style: { position: "relative", zIndex: 3 }, children: [jsxs("div", { className: "ids-header-1177-admin__container", children: [skipToContentLink && (jsx("div", { className: "ids-header-1177-admin__skip-to-content", children: skipToContentLink })), jsxs("div", { className: "ids-header-1177-admin__inner", children: [jsxs("div", { className: "ids-header-1177-admin__logo-col", children: [jsx("div", { className: "ids-header-1177-admin__logo", children: renderLogo() }), jsxs("div", { className: "ids-header-1177-admin__brand", children: [brandTextTop && (jsx("div", { className: "ids-header-1177-admin__brand-text---supplement", children: brandTextTop })), brandText && jsx("div", { className: "ids-header-1177-admin__brand-text", children: brandText }), brandTextBottom && (jsx("div", { className: "ids-header-1177-admin__brand-text---supplement", children: brandTextBottom }))] })] }), jsx("div", { className: "ids-header-1177-admin__items", children: jsxs("div", { className: "ids-header-1177-admin__items-inner", children: [avatar, items, renderHamburgerButton()] }) })] })] }), renderMobileMenuItems(), children] }) }));
|
|
27
|
+
};
|
|
11
28
|
|
|
12
29
|
export { IDSHeader1177Admin };
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/header-1177-pro/header-1177-pro-avatar-mobile.css";
|
|
3
|
+
interface IDSHeader1177ProAvatarMobileProps {
|
|
4
|
+
username?: string;
|
|
5
|
+
unit?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const IDSHeader1177ProAvatarMobile: React.FC<IDSHeader1177ProAvatarMobileProps>;
|
|
9
|
+
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import '@inera/ids-design/components/header-1177-pro/header-1177-pro-avatar-mobile.css';
|
|
4
4
|
|
|
5
|
-
const IDSHeader1177ProAvatarMobile =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
react: React
|
|
9
|
-
});
|
|
5
|
+
const IDSHeader1177ProAvatarMobile = ({ username = "", unit = "", children }) => {
|
|
6
|
+
return (jsx("li", { className: "ids-header-1177-pro__avatar-mobile", children: username || unit ? (jsxs(Fragment, { children: [jsxs("div", { className: "ids-header-1177-pro__avatar-mobile__user-logged-in", children: [jsx("div", { className: "ids-header-1177-pro__avatar-mobile__username", children: username }), unit && jsx("div", { className: "ids-header-1177-pro__avatar-mobile__unit", children: unit })] }), children] })) : (jsx(Fragment, { children: children })) }));
|
|
7
|
+
};
|
|
10
8
|
|
|
11
9
|
export { IDSHeader1177ProAvatarMobile };
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/header-1177-pro/header-1177-pro-avatar.css";
|
|
3
|
+
interface IDSHeader1177ProAvatarProps {
|
|
4
|
+
username?: string;
|
|
5
|
+
unit?: string;
|
|
6
|
+
persistent?: boolean;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const IDSHeader1177ProAvatar: React.FC<IDSHeader1177ProAvatarProps>;
|
|
10
|
+
export {};
|
|
@@ -1,11 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import '@inera/ids-design/components/header-1177-pro/header-1177-pro-avatar.css';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { useHeaderContext } from '../utils/contexts/HeaderContext.js';
|
|
4
7
|
|
|
5
|
-
const IDSHeader1177ProAvatar =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const IDSHeader1177ProAvatar = ({ username = "", unit = "", persistent = false, children }) => {
|
|
9
|
+
const headerContext = useHeaderContext();
|
|
10
|
+
const [expanded, setExpanded] = useState(false);
|
|
11
|
+
const avatarRef = useRef(null);
|
|
12
|
+
const toggleExpanded = () => {
|
|
13
|
+
setExpanded(prev => !prev);
|
|
14
|
+
};
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const handleClickOutside = (event) => {
|
|
17
|
+
if (avatarRef.current && !avatarRef.current.contains(event.target) && !persistent) {
|
|
18
|
+
setExpanded(false);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
22
|
+
return () => {
|
|
23
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
24
|
+
};
|
|
25
|
+
}, [persistent]);
|
|
26
|
+
return (jsxs("div", { ref: avatarRef, className: clsx("ids-header-1177-pro__avatar", {
|
|
27
|
+
"ids-header-1177-pro__avatar--unresponsive": headerContext?.unresponsive,
|
|
28
|
+
"ids-header-1177-pro__avatar--expanded": expanded
|
|
29
|
+
}), children: [jsxs("button", { onClick: toggleExpanded, "aria-controls": "ids-header-1177-pro__dropdown", "aria-expanded": expanded, className: "ids-header-1177-pro__avatar-box", children: [jsx("div", { className: "ids-header-1177-pro__avatar-icon" }), jsxs("div", { className: "ids-header-1177-pro__avatar-content", children: [jsx("div", { className: "ids-header-1177-pro__avatar-content__name", title: username, children: username }), jsx("div", { className: "ids-header-1177-pro__avatar-content__unit", title: unit, children: unit })] }), jsx("div", { className: clsx("ids-header-1177-pro__avatar-chevron", {
|
|
30
|
+
"ids-header-1177-pro__avatar-chevron--expanded": expanded
|
|
31
|
+
}) })] }), jsx("div", { id: "ids-header-1177-pro__dropdown", className: "ids-header-1177-pro__avatar-dropdown", children: children })] }));
|
|
32
|
+
};
|
|
10
33
|
|
|
11
34
|
export { IDSHeader1177ProAvatar };
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/header-1177-pro/header-1177-pro-item.css";
|
|
3
|
+
interface IDSHeader1177ProItemProps {
|
|
4
|
+
mobile?: boolean;
|
|
5
|
+
icon?: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
link?: ReactNode;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const IDSHeader1177ProItem: React.FC<IDSHeader1177ProItemProps>;
|
|
12
|
+
export {};
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { isValidElement, cloneElement } from 'react';
|
|
4
|
+
import '@inera/ids-design/components/header-1177-pro/header-1177-pro-item.css';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { useHeaderContext } from '../utils/contexts/HeaderContext.js';
|
|
4
7
|
|
|
5
|
-
const IDSHeader1177ProItem =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const IDSHeader1177ProItem = ({ mobile = false, icon = "", text = "", href = "", link, onClick, ...props }) => {
|
|
9
|
+
const headerContext = useHeaderContext();
|
|
10
|
+
const classNames = clsx("ids-header-1177-pro__items__item", {
|
|
11
|
+
"ids-header-1177-pro__items__item--unresponsive": headerContext?.unresponsive,
|
|
12
|
+
"ids-header-1177-pro__items__item--mobile": mobile
|
|
13
|
+
});
|
|
14
|
+
const renderContent = () => (jsxs(Fragment, { children: [jsx("div", { className: "ids-header-1177-pro__items__item-icon", "aria-label": text, children: icon && jsx("span", { className: `ids-icon-${icon}` }) }), jsx("div", { className: "ids-header-1177-pro__items__item-text", children: text })] }));
|
|
15
|
+
if (link && isValidElement(link)) {
|
|
16
|
+
return cloneElement(link, {
|
|
17
|
+
...props,
|
|
18
|
+
style: { position: "relative", textDecoration: "none" },
|
|
19
|
+
className: clsx(link.props.className, classNames),
|
|
20
|
+
children: renderContent()
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return onClick ? (jsx("button", { className: classNames, onClick: onClick, style: { cursor: "pointer", padding: 0, margin: 0 }, ...props, children: renderContent() })) : (jsx("a", { className: classNames, href: href, style: { position: "relative", textDecoration: "none" }, ...props, children: renderContent() }));
|
|
24
|
+
};
|
|
10
25
|
|
|
11
26
|
export { IDSHeader1177ProItem };
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import React, { ReactElement, ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/header-1177-pro/header-1177-pro-nav-item.css";
|
|
3
|
+
import { IDSLinkProps } from "../link/link";
|
|
4
|
+
interface IDSHeader1177ProNavItemProps {
|
|
5
|
+
active?: boolean;
|
|
6
|
+
expanded?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
col1?: ReactElement<IDSLinkProps>[];
|
|
9
|
+
col2?: ReactElement<IDSLinkProps>[];
|
|
10
|
+
col3?: ReactElement<IDSLinkProps>[];
|
|
11
|
+
col4?: ReactElement<IDSLinkProps>[];
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const IDSHeader1177ProNavItem: React.FC<IDSHeader1177ProNavItemProps>;
|
|
15
|
+
export {};
|
|
@@ -1,11 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React__default, { useState } from 'react';
|
|
4
|
+
import '@inera/ids-design/components/header-1177-pro/header-1177-pro-nav-item.css';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { useHeaderContext } from '../utils/contexts/HeaderContext.js';
|
|
4
7
|
|
|
5
|
-
const IDSHeader1177ProNavItem =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const IDSHeader1177ProNavItem = ({ active = false, expanded = false, label = "", col1, col2, col3, col4, children }) => {
|
|
9
|
+
const headerContext = useHeaderContext();
|
|
10
|
+
const [isExpanded, setIsExpanded] = useState(expanded);
|
|
11
|
+
const toggleExpanded = () => {
|
|
12
|
+
setIsExpanded(prev => !prev);
|
|
13
|
+
};
|
|
14
|
+
const renderItem = () => {
|
|
15
|
+
if (label) {
|
|
16
|
+
return (jsx("button", { onClick: toggleExpanded, "aria-expanded": isExpanded, "aria-controls": "ids-dropdown", children: label }));
|
|
17
|
+
}
|
|
18
|
+
return children;
|
|
19
|
+
};
|
|
20
|
+
const renderLink = (link) => {
|
|
21
|
+
return React__default.isValidElement(link)
|
|
22
|
+
? React__default.cloneElement(link, { activeIcon: true, block: true, colorPreset: 1 })
|
|
23
|
+
: link;
|
|
24
|
+
};
|
|
25
|
+
const renderDropdown = () => {
|
|
26
|
+
if (!isExpanded)
|
|
27
|
+
return null;
|
|
28
|
+
return (jsx("div", { id: "ids-dropdown", className: "ids-header-1177-pro__items__item-dropdown", children: jsxs("div", { className: "ids-header-1177-pro__items__item-dropdown__content", children: [jsx("div", { className: "ids-header-1177-pro__items__item-dropdown__content-col-1", children: col1?.map((link, idx) => (jsx("div", { className: "ids-header-1177-pro__item-wrapper", children: renderLink(link) }, idx))) }), jsx("div", { className: "ids-header-1177-pro__items__item-dropdown__content-col-2", children: col2?.map((link, idx) => (jsx("div", { className: "ids-header-1177-pro__item-wrapper", children: renderLink(link) }, idx))) }), jsx("div", { className: "ids-header-1177-pro__items__item-dropdown__content-col-3", children: col3?.map((link, idx) => (jsx("div", { className: "ids-header-1177-pro__item-wrapper", children: renderLink(link) }, idx))) }), jsx("div", { className: "ids-header-1177-pro__items__item-dropdown__content-col-4", children: col4?.map((link, idx) => (jsx("div", { className: "ids-header-1177-pro__item-wrapper", children: renderLink(link) }, idx))) })] }) }));
|
|
29
|
+
};
|
|
30
|
+
return (jsxs("div", { className: clsx("ids-header-1177-pro__nav-item", {
|
|
31
|
+
"ids-header-1177-pro__nav-item--unresponsive": headerContext?.unresponsive,
|
|
32
|
+
"ids-header-1177-pro__nav-item--active": active || isExpanded
|
|
33
|
+
}), children: [renderItem(), renderDropdown()] }));
|
|
34
|
+
};
|
|
10
35
|
|
|
11
36
|
export { IDSHeader1177ProNavItem };
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/header-1177-pro/header-1177-pro-nav-menu-mobile.css";
|
|
3
|
+
interface IDSHeader1177ProNavMenuMobileProps {
|
|
4
|
+
label?: string;
|
|
5
|
+
persistent?: boolean;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
onExpanded?: () => void;
|
|
8
|
+
onClosed?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const IDSHeader1177ProNavMenuMobile: React.FC<IDSHeader1177ProNavMenuMobileProps>;
|
|
11
|
+
export {};
|