@inera/ids-react 8.0.0 → 8.1.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 -0
- package/components/accordion/accordion.js +5 -43
- package/components/badge/badge.d.ts +3 -5
- package/components/badge/badge.js +2 -2
- package/components/box-link/box-link.d.ts +3 -5
- package/components/box-link/box-link.js +3 -4
- package/components/breadcrumbs/breadcrumbs.d.ts +2 -3
- package/components/breadcrumbs/breadcrumbs.js +2 -3
- package/components/button/button.d.ts +1 -2
- package/components/button-group/button-group.d.ts +2 -3
- package/components/button-group/button-group.js +2 -2
- package/components/card/card.d.ts +3 -4
- package/components/card/card.js +12 -7
- package/components/date-label/date-label.d.ts +2 -2
- package/components/date-label/date-label.js +9 -31
- package/components/dialog/dialog.d.ts +1 -1
- package/components/dialog/dialog.js +5 -6
- package/components/dropdown/dropdown-content-link.d.ts +1 -1
- package/components/dropdown/dropdown-content-link.js +2 -2
- package/components/dropdown/dropdown.d.ts +1 -1
- package/components/dropdown/dropdown.js +2 -2
- package/components/footer-1177/footer-1177.d.ts +3 -4
- package/components/footer-1177/footer-1177.js +7 -44
- package/components/footer-1177-admin/footer-1177-admin.d.ts +1 -1
- package/components/footer-1177-admin/footer-1177-admin.js +4 -41
- package/components/footer-1177-pro/footer-1177-pro.d.ts +1 -1
- package/components/footer-1177-pro/footer-1177-pro.js +4 -41
- package/components/footer-inera/footer-inera.d.ts +1 -1
- package/components/footer-inera/footer-inera.js +4 -41
- package/components/footer-inera-admin/footer-inera-admin.d.ts +1 -1
- package/components/footer-inera-admin/footer-inera-admin.js +4 -41
- package/components/form/checkbox/checkbox.js +1 -1
- package/components/global-alert/global-alert.js +2 -2
- package/components/grid/column.d.ts +3 -4
- package/components/grid/column.js +2 -3
- package/components/grid/container.d.ts +4 -3
- package/components/grid/container.js +6 -17
- package/components/grid/row.d.ts +4 -4
- package/components/grid/row.js +6 -11
- package/components/header-1177/header-1177-item.d.ts +2 -2
- package/components/header-1177/header-1177-item.js +19 -14
- package/components/header-1177/header-1177-nav-item-mobile.js +5 -10
- package/components/header-1177/header-1177-nav-item.d.ts +4 -4
- package/components/header-1177/header-1177-nav-item.js +23 -17
- package/components/header-1177/header-1177-nav.d.ts +2 -2
- package/components/header-1177/header-1177-nav.js +4 -5
- package/components/header-1177/header-1177.d.ts +1 -1
- package/components/header-1177/header-1177.js +3 -16
- package/components/header-1177-admin/header-1177-admin-item.d.ts +2 -2
- package/components/header-1177-admin/header-1177-admin-item.js +21 -17
- package/components/header-1177-admin/header-1177-admin-nav-item.d.ts +4 -4
- package/components/header-1177-admin/header-1177-admin-nav-item.js +20 -14
- package/components/header-1177-admin/header-1177-admin-nav.d.ts +2 -2
- package/components/header-1177-admin/header-1177-admin-nav.js +5 -6
- package/components/header-1177-admin/header-1177-admin.d.ts +2 -2
- package/components/header-1177-admin/header-1177-admin.js +3 -4
- package/components/header-1177-pro/header-1177-pro-item.d.ts +2 -2
- package/components/header-1177-pro/header-1177-pro-item.js +21 -14
- package/components/header-1177-pro/header-1177-pro-nav-item.d.ts +5 -5
- package/components/header-1177-pro/header-1177-pro-nav-item.js +15 -19
- package/components/header-1177-pro/header-1177-pro-nav.d.ts +2 -3
- package/components/header-1177-pro/header-1177-pro-nav.js +5 -7
- package/components/header-1177-pro/header-1177-pro.d.ts +2 -2
- package/components/header-1177-pro/header-1177-pro.js +4 -8
- package/components/header-inera/header-inera-item.d.ts +3 -4
- package/components/header-inera/header-inera-item.js +30 -14
- package/components/header-inera/header-inera-nav-item.js +7 -20
- package/components/header-inera/header-inera-nav.d.ts +1 -1
- package/components/header-inera/header-inera-nav.js +5 -6
- package/components/header-inera/header-inera.d.ts +2 -2
- package/components/header-inera/header-inera.js +4 -8
- package/components/header-inera-admin/header-inera-admin-item.d.ts +3 -4
- package/components/header-inera-admin/header-inera-admin-item.js +17 -13
- package/components/header-inera-admin/header-inera-admin-nav-item.d.ts +1 -3
- package/components/header-inera-admin/header-inera-admin-nav-item.js +14 -27
- package/components/header-inera-admin/header-inera-admin-nav.d.ts +2 -3
- package/components/header-inera-admin/header-inera-admin-nav.js +3 -4
- package/components/header-inera-admin/header-inera-admin.d.ts +1 -1
- package/components/header-inera-admin/header-inera-admin.js +3 -4
- package/components/link/link.d.ts +1 -1
- package/components/link/link.js +15 -13
- package/components/navigation/content/navigation-content.d.ts +2 -3
- package/components/navigation/content/navigation-content.js +5 -12
- package/components/navigation/local/navigation-local.d.ts +2 -3
- package/components/navigation/local/navigation-local.js +2 -2
- package/components/notification/badge/notification-badge.d.ts +2 -3
- package/components/notification/badge/notification-badge.js +2 -2
- package/components/pagination/data-pagination/data-pagination.d.ts +1 -2
- package/components/pagination/data-pagination/data-pagination.js +0 -1
- package/components/pagination/list-pagination/list-pagination.d.ts +1 -1
- package/components/pagination/list-pagination/list-pagination.js +2 -3
- package/components/progressbar/progressbar.d.ts +5 -3
- package/components/progressbar/progressbar.js +4 -4
- package/components/puff-list/puff-list-item/puff-list-item-date.d.ts +13 -0
- package/components/puff-list/puff-list-item/puff-list-item-date.js +23 -0
- package/components/puff-list/puff-list-item/puff-list-item-header.d.ts +10 -0
- package/components/puff-list/puff-list-item/puff-list-item-header.js +11 -0
- package/components/puff-list/puff-list-item/puff-list-item-info.d.ts +3 -5
- package/components/puff-list/puff-list-item/puff-list-item-info.js +4 -5
- package/components/puff-list/puff-list-item/puff-list-item.d.ts +9 -20
- package/components/puff-list/puff-list-item/puff-list-item.js +8 -78
- package/components/puff-list/puff-list.d.ts +1 -1
- package/components/puff-list/puff-list.js +4 -3
- package/components/region-icon/region-icon.d.ts +2 -2
- package/components/region-icon/region-icon.js +5 -4
- package/components/side-menu/side-menu.js +1 -1
- package/components/stepper/stepper.d.ts +1 -1
- package/components/stepper/stepper.js +2 -2
- package/components/tag/tag.d.ts +11 -4
- package/components/tag/tag.js +7 -7
- package/components/tooltip/tooltip.d.ts +1 -0
- package/components/tooltip/tooltip.js +8 -7
- package/components/utils/hooks/useFocusTrap.js +2 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +2 -2
|
@@ -9,6 +9,7 @@ interface IDSAccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
9
9
|
noBorder?: boolean;
|
|
10
10
|
onCollapsed?: () => void;
|
|
11
11
|
onExpanded?: () => void;
|
|
12
|
+
accordions?: ReactNode;
|
|
12
13
|
children?: ReactNode;
|
|
13
14
|
}
|
|
14
15
|
export declare const IDSAccordion: React.FC<IDSAccordionProps>;
|
|
@@ -1,47 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import '@inera/ids-design/components/accordion/accordion.css';
|
|
6
6
|
import { useElementId } from '../utils/hooks/useElementId.js';
|
|
7
7
|
|
|
8
|
-
const IDSAccordion = ({ headline = "", level = 1, headlineSize = level === 2 ? "s" : "m", expanded = false, lean = false, noBorder = false, onCollapsed, onExpanded, children, className, ...props }) => {
|
|
8
|
+
const IDSAccordion = ({ headline = "", level = 1, headlineSize = level === 2 ? "s" : "m", expanded = false, lean = false, noBorder = false, onCollapsed, onExpanded, accordions, children, className, ...props }) => {
|
|
9
9
|
const [isExpanded, setIsExpanded] = useState(expanded);
|
|
10
|
-
const [isLean, setIsLean] = useState(lean);
|
|
11
|
-
const [insideIDSCard, setInsideIDSCard] = useState(false);
|
|
12
|
-
const [hasChildren, setHasChildren] = useState(false);
|
|
13
10
|
const contentId = useElementId();
|
|
14
11
|
const accordionRef = useRef(null);
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
handleChildren();
|
|
17
|
-
checkIfInsideIDSCard();
|
|
18
|
-
}, []);
|
|
19
12
|
useEffect(() => {
|
|
20
13
|
setIsExpanded(expanded);
|
|
21
14
|
}, [expanded]);
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
setIsLean(insideIDSCard);
|
|
24
|
-
}, [insideIDSCard]);
|
|
25
|
-
const checkIfInsideIDSCard = () => {
|
|
26
|
-
if (accordionRef.current?.closest(".ids-card")) {
|
|
27
|
-
setInsideIDSCard(true);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const handleChildren = () => {
|
|
31
|
-
const nestedAccordions = accordionRef.current?.querySelectorAll(".ids-accordion");
|
|
32
|
-
if (nestedAccordions && nestedAccordions.length > 0) {
|
|
33
|
-
setHasChildren(true);
|
|
34
|
-
nestedAccordions.forEach(acc => {
|
|
35
|
-
acc.setAttribute("level", "2");
|
|
36
|
-
if (headlineSize === "m") {
|
|
37
|
-
acc.setAttribute("headlineSize", "s");
|
|
38
|
-
}
|
|
39
|
-
else if (headlineSize === "s") {
|
|
40
|
-
acc.setAttribute("headlineSize", "xs");
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
15
|
const toggleExpansion = () => {
|
|
46
16
|
setIsExpanded(prev => !prev);
|
|
47
17
|
if (isExpanded) {
|
|
@@ -64,20 +34,12 @@ const IDSAccordion = ({ headline = "", level = 1, headlineSize = level === 2 ? "
|
|
|
64
34
|
return (jsxs("div", { ref: accordionRef, className: clsx("ids-accordion", {
|
|
65
35
|
"ids-accordion--expanded": isExpanded,
|
|
66
36
|
"ids-accordion--no-border": noBorder,
|
|
67
|
-
"ids-accordion--lean": lean
|
|
68
|
-
"ids-accordion--has-children":
|
|
37
|
+
"ids-accordion--lean": lean,
|
|
38
|
+
"ids-accordion--has-children": !!accordions,
|
|
69
39
|
"ids-accordion--is-child": level === 2
|
|
70
40
|
}, className), ...props, children: [jsx("div", { className: `ids-accordion__button ids-accordion__button--${headlineSize}`, role: "button", tabIndex: 0, onClick: toggleExpansion, onKeyDown: onKeyPress, "aria-expanded": isExpanded, "aria-controls": contentId, children: jsx("div", { className: clsx("ids-accordion__headline", `ids-accordion__headline-${level}`, `ids-accordion__headline--${headlineSize}`, {
|
|
71
41
|
"ids-accordion__headline--expanded": isExpanded
|
|
72
|
-
}), children: headline }) }),
|
|
73
|
-
if (React.isValidElement(child)) {
|
|
74
|
-
return React.cloneElement(child, {
|
|
75
|
-
level: 2,
|
|
76
|
-
headlineSize: headlineSize === "m" ? "s" : headlineSize === "s" ? "xs" : "xs"
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return child;
|
|
80
|
-
}) })] }));
|
|
42
|
+
}), children: headline }) }), jsxs("div", { "aria-hidden": !isExpanded, id: contentId, className: "ids-accordion__content", children: [children, accordions && accordions] })] }));
|
|
81
43
|
};
|
|
82
44
|
|
|
83
45
|
export { IDSAccordion };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import "@inera/ids-design/components/badge/badge.css";
|
|
3
|
-
interface IDSBadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
export interface IDSBadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
type?: "primary" | "secondary" | "neutral" | "info" | "attention" | "success" | "error";
|
|
5
5
|
icon?: string;
|
|
6
|
-
children?: ReactNode;
|
|
7
6
|
}
|
|
8
|
-
export declare
|
|
9
|
-
export {};
|
|
7
|
+
export declare function IDSBadge({ type, icon, children, className, ...props }: IDSBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,8 +2,8 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import '@inera/ids-design/components/badge/badge.css';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function IDSBadge({ type = "primary", icon, children, className, ...props }) {
|
|
6
6
|
return (jsx("div", { className: clsx(`ids-badge ids-badge--${type}`, className), ...props, children: jsxs("div", { className: "ids-badge__inner", children: [icon && jsx("span", { className: `ids-icon-${icon}`, "aria-hidden": "true" }), icon && children && jsx("span", { className: "ids-badge__icon" }), children] }) }));
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
|
|
9
9
|
export { IDSBadge };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import React, { ButtonHTMLAttributes
|
|
1
|
+
import React, { ButtonHTMLAttributes } from "react";
|
|
2
2
|
import "@inera/ids-design/components/box-link/box-link.css";
|
|
3
|
-
interface IDSBoxLinkProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
export interface IDSBoxLinkProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
srButton?: string;
|
|
5
5
|
buttonIcon?: string;
|
|
6
6
|
onButtonClick?: () => void;
|
|
7
7
|
buttonProps?: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
8
|
-
children: ReactNode;
|
|
9
8
|
}
|
|
10
|
-
export declare
|
|
11
|
-
export {};
|
|
9
|
+
export declare function IDSBoxLink({ srButton, buttonIcon, onButtonClick, buttonProps, children, className, ...props }: IDSBoxLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
2
|
import { useRef } from 'react';
|
|
4
3
|
import '@inera/ids-design/components/box-link/box-link.css';
|
|
5
4
|
import clsx from 'clsx';
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
function IDSBoxLink({ srButton = "", buttonIcon = "", onButtonClick, buttonProps = {}, children, className, ...props }) {
|
|
8
7
|
const boxLinkRef = useRef(null);
|
|
9
|
-
return (jsx("div", { className: clsx("ids-box-link", className), ref: boxLinkRef, ...props, children: jsxs("div", { className: "ids-box-link__inner", children: [jsx("span", { className: "ids-box-link__link", children: children }),
|
|
10
|
-
}
|
|
8
|
+
return (jsx("div", { className: clsx("ids-box-link", { "ids-box-link--has-button": !!onButtonClick }, className), ref: boxLinkRef, ...props, children: jsxs("div", { className: "ids-box-link__inner", children: [jsx("span", { className: "ids-box-link__link", children: children }), onButtonClick && (jsx("div", { className: "ids-box-link__button", children: jsx("button", { className: buttonIcon ? `ids-icon-${buttonIcon}` : undefined, onClick: onButtonClick, "aria-label": srButton, ...buttonProps }) }))] }) }));
|
|
9
|
+
}
|
|
11
10
|
|
|
12
11
|
export { IDSBoxLink };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import "@inera/ids-design/components/breadcrumbs/breadcrumbs.css";
|
|
3
3
|
interface IDSBreadcrumbsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
lead?: string;
|
|
5
|
-
children?: ReactNode;
|
|
6
5
|
mobileLink?: React.ReactElement<React.AnchorHTMLAttributes<HTMLAnchorElement> | React.LinkHTMLAttributes<HTMLLinkElement>>;
|
|
7
6
|
}
|
|
8
|
-
export declare
|
|
7
|
+
export declare function IDSBreadcrumbs({ lead, mobileLink, children, className, ...props }: IDSBreadcrumbsProps): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export {};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import '@inera/ids-design/components/breadcrumbs/breadcrumbs.css';
|
|
5
4
|
import clsx from 'clsx';
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
function IDSBreadcrumbs({ lead = "Du är här", mobileLink, children, className, ...props }) {
|
|
8
7
|
const getMobileLink = () => {
|
|
9
8
|
if (mobileLink) {
|
|
10
9
|
return React.cloneElement(mobileLink, { className: "ids-breadcrumbs__mobile-link" });
|
|
@@ -26,6 +25,6 @@ const IDSBreadcrumbs = ({ lead = "Du är här", mobileLink, children, className,
|
|
|
26
25
|
});
|
|
27
26
|
};
|
|
28
27
|
return (jsxs("nav", { className: clsx("ids-breadcrumbs", className), "aria-label": lead, ...props, children: [jsxs("ol", { className: "ids-breadcrumbs__desktop", children: [jsx("li", { className: "ids-breadcrumbs__lead", children: lead }), getLinks()] }), jsx("ol", { className: "ids-breadcrumbs__mobile", children: jsxs("li", { className: "ids-breadcrumbs__mobile-links", children: [jsx("span", { className: "ids-breadcrumbs__icon" }), getMobileLink()] }) })] }));
|
|
29
|
-
}
|
|
28
|
+
}
|
|
30
29
|
|
|
31
30
|
export { IDSBreadcrumbs };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ButtonHTMLAttributes } from "react";
|
|
2
2
|
type ButtonSize = "s" | "m" | "l";
|
|
3
3
|
export interface IDSButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
4
|
active?: boolean;
|
|
@@ -16,7 +16,6 @@ export interface IDSButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
16
16
|
submit?: boolean;
|
|
17
17
|
tertiary?: boolean;
|
|
18
18
|
toggle?: boolean;
|
|
19
|
-
children?: ReactNode;
|
|
20
19
|
}
|
|
21
20
|
export declare const IDSButton: import("react").ForwardRefExoticComponent<IDSButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
22
21
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import "@inera/ids-design/components/button-group/button-group.css";
|
|
3
3
|
type Justify = "start" | "center" | "end";
|
|
4
4
|
type Break = "s" | "m";
|
|
@@ -7,7 +7,6 @@ interface IDSButtonGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
justify?: Justify;
|
|
8
8
|
unresponsive?: boolean;
|
|
9
9
|
break?: Break;
|
|
10
|
-
children?: ReactNode;
|
|
11
10
|
}
|
|
12
|
-
export declare
|
|
11
|
+
export declare function IDSButtonGroup({ rtl, justify, unresponsive, break: breakpoint, children, className, ...props }: IDSButtonGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
export {};
|
|
@@ -2,12 +2,12 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import '@inera/ids-design/components/button-group/button-group.css';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function IDSButtonGroup({ rtl = false, justify = "start", unresponsive = false, break: breakpoint = "m", children, className, ...props }) {
|
|
6
6
|
const classNames = clsx("ids-button-group", `ids-button-group--break-${breakpoint}`, `ids-button-group--${justify}`, {
|
|
7
7
|
"ids-button-group--rtl": rtl,
|
|
8
8
|
"ids-button-group--unresponsive": unresponsive
|
|
9
9
|
}, className);
|
|
10
10
|
return (jsx("div", { className: classNames, ...props, children: children }));
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
12
|
|
|
13
13
|
export { IDSButtonGroup };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import "@inera/ids-design/components/card/card.css";
|
|
3
3
|
interface IDSCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
borderTop?: boolean;
|
|
5
|
-
cardLink?: ReactNode;
|
|
5
|
+
cardLink?: React.ReactElement | React.AnchorHTMLAttributes<HTMLAnchorElement> | React.ReactNode;
|
|
6
6
|
fill?: boolean;
|
|
7
7
|
focusCard?: boolean;
|
|
8
8
|
hideOnM?: boolean;
|
|
9
9
|
hideOnS?: boolean;
|
|
10
10
|
lean?: boolean;
|
|
11
|
-
children?: ReactNode;
|
|
12
11
|
}
|
|
13
|
-
export declare
|
|
12
|
+
export declare function IDSCard({ focusCard, fill, borderTop, lean, hideOnM, hideOnS, cardLink, children, className, ...props }: IDSCardProps): import("react/jsx-runtime").JSX.Element;
|
|
14
13
|
export {};
|
package/components/card/card.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { isValidElement, cloneElement } from 'react';
|
|
3
3
|
import '@inera/ids-design/components/card/card.css';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function IDSCard({ focusCard = false, fill = false, borderTop = false, lean = false, hideOnM = false, hideOnS = false, cardLink, children, className, ...props }) {
|
|
7
|
+
let enhancedCardLink = null;
|
|
8
|
+
if (isValidElement(cardLink)) {
|
|
9
|
+
enhancedCardLink = cloneElement(cardLink, {
|
|
9
10
|
className: clsx(cardLink.props.className, "ids-card--interactive-link")
|
|
10
|
-
})
|
|
11
|
-
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
else if (cardLink) {
|
|
14
|
+
const anchorProps = cardLink;
|
|
15
|
+
enhancedCardLink = jsx("a", { ...anchorProps, className: clsx(anchorProps.className, "ids-card--interactive-link") });
|
|
16
|
+
}
|
|
12
17
|
return (jsxs("div", { className: clsx("ids-card", {
|
|
13
18
|
"ids-card--fill": fill,
|
|
14
19
|
"ids-card--border-top": !!borderTop && !focusCard,
|
|
@@ -18,6 +23,6 @@ const IDSCard = ({ focusCard = false, fill = false, borderTop = false, lean = fa
|
|
|
18
23
|
"ids-card--lean": lean,
|
|
19
24
|
"ids-card--interactive": !!cardLink
|
|
20
25
|
}, className), ...props, children: [!!borderTop && !focusCard && jsx("div", { className: "ids-card__border-top" }), jsx("div", { className: "ids-card__content", children: children }), enhancedCardLink] }));
|
|
21
|
-
}
|
|
26
|
+
}
|
|
22
27
|
|
|
23
28
|
export { IDSCard };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DetailedHTMLProps, TimeHTMLAttributes } from "react";
|
|
2
2
|
import "@inera/ids-design/components/date-label/date-label.css";
|
|
3
3
|
interface IDSDateLabelProps extends DetailedHTMLProps<TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement> {
|
|
4
4
|
date?: Date | null;
|
|
@@ -13,5 +13,5 @@ interface IDSDateLabelProps extends DetailedHTMLProps<TimeHTMLAttributes<HTMLTim
|
|
|
13
13
|
dayTo?: number;
|
|
14
14
|
srText?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare
|
|
16
|
+
export declare function IDSDateLabel({ date, year, month, day, monthLabel, dateTo, yearTo, monthTo, monthToLabel, srText, dayTo, children, className, ...props }: IDSDateLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -1,40 +1,18 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useState, useEffect } from 'react';
|
|
4
2
|
import '@inera/ids-design/components/date-label/date-label.css';
|
|
5
3
|
import { getDayAsText, getMonthAsSweText } from '../utils/utils.js';
|
|
6
4
|
import clsx from 'clsx';
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, [date]);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (dateTo) {
|
|
18
|
-
setPresentedToDate(new Date(dateTo));
|
|
19
|
-
}
|
|
20
|
-
}, [dateTo]);
|
|
21
|
-
const getYear = () => (presentedDate ? presentedDate.getFullYear() : year);
|
|
22
|
-
const getYearTo = () => (presentedToDate ? presentedToDate.getFullYear() : yearTo);
|
|
23
|
-
const getMonth = () => (presentedDate ? presentedDate.getMonth() + 1 : month);
|
|
24
|
-
const getMonthTo = () => (presentedToDate ? presentedToDate.getMonth() + 1 : monthTo);
|
|
25
|
-
const getDay = () => {
|
|
26
|
-
const dayNumber = presentedDate ? presentedDate.getDate() : day;
|
|
27
|
-
return getDayAsText(dayNumber);
|
|
28
|
-
};
|
|
29
|
-
const getDayTo = () => {
|
|
30
|
-
const dayNumber = presentedToDate ? presentedToDate.getDate() : dayTo;
|
|
31
|
-
return getDayAsText(dayNumber);
|
|
32
|
-
};
|
|
6
|
+
function IDSDateLabel({ date = null, year = 0, month = 0, day = 0, monthLabel = "", dateTo = null, yearTo = 0, monthTo = 0, monthToLabel = "", srText = "", dayTo = 0, children, className, ...props }) {
|
|
7
|
+
const getYear = () => (date ? date.getFullYear() : year);
|
|
8
|
+
const getYearTo = () => (dateTo ? dateTo.getFullYear() : yearTo);
|
|
9
|
+
const getMonth = () => (date ? date.getMonth() + 1 : month);
|
|
10
|
+
const getMonthTo = () => (dateTo ? dateTo.getMonth() + 1 : monthTo);
|
|
11
|
+
const getDay = () => (date ? getDayAsText(date.getDate()) : getDayAsText(day));
|
|
12
|
+
const getDayTo = () => (dateTo ? getDayAsText(dateTo.getDate()) : getDayAsText(dayTo));
|
|
33
13
|
const getMonthText = () => (monthLabel ? monthLabel : getMonthAsSweText(getMonth() - 1, 3));
|
|
34
14
|
const getMonthToText = () => (monthToLabel ? monthToLabel : getMonthAsSweText(getMonthTo() - 1, 3));
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return (jsxs("span", { className: "ids-date-label", "aria-label": srText, ...props, role: "text", children: [jsxs("time", { className: clsx("ids-date-label__time", className), "aria-hidden": "true", children: [jsx("span", { className: "ids-date-label__day", children: getDay() }), jsx("span", { className: "ids-date-label__month", children: getMonthText() }), jsx("span", { className: "ids-date-label__year", children: getYear() })] }), !!(!!dateTo || (dayTo && monthTo && yearTo)) && (jsxs("time", { className: clsx("ids-date-label__time ids-date-label__time--separator", className), "aria-hidden": "true", children: [jsx("span", { className: "ids-date-label__day", children: getDayTo() }), jsx("span", { className: "ids-date-label__month", children: getMonthToText() }), jsx("span", { className: "ids-date-label__year", children: getYearTo() })] }))] }));
|
|
38
|
-
};
|
|
15
|
+
return (jsxs("span", { className: clsx("ids-date-label", className), "aria-label": srText, ...props, role: "text", children: [jsxs("time", { className: "ids-date-label__time", "aria-hidden": "true", children: [jsx("span", { className: "ids-date-label__day", children: getDay() }), jsx("span", { className: "ids-date-label__month", children: getMonthText() }), jsx("span", { className: "ids-date-label__year", children: getYear() })] }), !!(dateTo || (dayTo && monthTo && yearTo)) && (jsxs("time", { className: "ids-date-label__time ids-date-label__time--separator", "aria-hidden": "true", children: [jsx("span", { className: "ids-date-label__day", children: getDayTo() }), jsx("span", { className: "ids-date-label__month", children: getMonthToText() }), jsx("span", { className: "ids-date-label__year", children: getYearTo() })] }))] }));
|
|
16
|
+
}
|
|
39
17
|
|
|
40
18
|
export { IDSDateLabel };
|
|
@@ -19,5 +19,5 @@ interface IDSDialogProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
19
19
|
children?: ReactNode;
|
|
20
20
|
onVisibilityChange?: (isVisible: boolean) => void;
|
|
21
21
|
}
|
|
22
|
-
export declare
|
|
22
|
+
export declare function IDSDialog({ show, srClose, dismissible, autoFocus, noOverlay, noFocusTrap, keepScrollbar, persistent, noScrollAreaFocus, width, maxWidth, height, trigger, headline, actions, children, className, onVisibilityChange, ...props }: IDSDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
export {};
|
|
@@ -5,7 +5,7 @@ import '@inera/ids-design/components/dialog/dialog.css';
|
|
|
5
5
|
import { useFocusTrap } from '../utils/hooks/useFocusTrap.js';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
function IDSDialog({ show = false, srClose = "Stäng", dismissible = false, autoFocus = true, noOverlay = false, noFocusTrap = false, keepScrollbar = false, persistent = false, noScrollAreaFocus = false, width = "", maxWidth = "", height = "", trigger, headline, actions, children, className, onVisibilityChange, ...props }) {
|
|
9
9
|
const [isVisible, setIsVisible] = useState(show);
|
|
10
10
|
const dialogRef = useRef(null);
|
|
11
11
|
const bodyRef = useRef(null);
|
|
@@ -49,7 +49,6 @@ const IDSDialog = ({ show = false, srClose = "Stäng", dismissible = false, auto
|
|
|
49
49
|
const focusable = bodyRef.current?.querySelector(".ids-focus-anchor") ||
|
|
50
50
|
bodyRef.current?.querySelector("h1, h2, h3, [tabindex]:not([tabindex='-1']), button:not([disabled]), a, input:not([disabled]), textarea:not([disabled])") ||
|
|
51
51
|
dialogRef.current?.querySelector("button.ids-dialog__close-button");
|
|
52
|
-
console.log("focusable", focusable);
|
|
53
52
|
focusable?.focus();
|
|
54
53
|
});
|
|
55
54
|
}
|
|
@@ -59,9 +58,9 @@ const IDSDialog = ({ show = false, srClose = "Stäng", dismissible = false, auto
|
|
|
59
58
|
setIsVisible(false);
|
|
60
59
|
}
|
|
61
60
|
};
|
|
62
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: "ids-dialog__trigger", children: trigger }), jsx("div", { className: clsx("ids-dialog-overlay", {
|
|
63
|
-
"ids-dialog-overlay--hidden": !isVisible
|
|
64
|
-
}), onClick: overlayClick }), jsxs("div", { ref: dialogRef, className: clsx("ids-dialog", {
|
|
61
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: "ids-dialog__trigger", children: trigger }), !noOverlay && (jsx("div", { className: clsx("ids-dialog-overlay", {
|
|
62
|
+
"ids-dialog-overlay--hidden": !isVisible
|
|
63
|
+
}), onClick: overlayClick })), jsxs("div", { ref: dialogRef, className: clsx("ids-dialog", {
|
|
65
64
|
"ids-dialog--hidden": !isVisible
|
|
66
65
|
}, className), role: "dialog", "aria-modal": "true", style: {
|
|
67
66
|
width,
|
|
@@ -72,6 +71,6 @@ const IDSDialog = ({ show = false, srClose = "Stäng", dismissible = false, auto
|
|
|
72
71
|
"ids-dialog__body--has-scrollbar": hasScrollbar,
|
|
73
72
|
"ids-dialog__body--scroll-area-focus": !noScrollAreaFocus
|
|
74
73
|
}), tabIndex: noScrollAreaFocus ? -1 : 0, children: [jsx("div", { className: "ids-dialog__body-headline", children: headline }), jsx("div", { className: "ids-dialog__body-content", children: children }), actions && jsx("div", { className: "ids-dialog__footer", children: actions })] })] })] }));
|
|
75
|
-
}
|
|
74
|
+
}
|
|
76
75
|
|
|
77
76
|
export { IDSDialog };
|
|
@@ -3,4 +3,4 @@ import "@inera/ids-design/components/dropdown/dropdown.css";
|
|
|
3
3
|
export interface IDSDropdownContentLinkProps extends Omit<HTMLAttributes<HTMLAnchorElement>, "children"> {
|
|
4
4
|
children: ReactElement;
|
|
5
5
|
}
|
|
6
|
-
export declare
|
|
6
|
+
export declare function IDSDropdownContentLink({ children, className, ...props }: IDSDropdownContentLinkProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
@@ -3,7 +3,7 @@ import { isValidElement, cloneElement } from 'react';
|
|
|
3
3
|
import '@inera/ids-design/components/dropdown/dropdown.css';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function IDSDropdownContentLink({ children, className, ...props }) {
|
|
7
7
|
if (!isValidElement(children) || children.type !== "a") {
|
|
8
8
|
console.error("IDSDropdownContentLink expects a single <a> element as its child.");
|
|
9
9
|
return null;
|
|
@@ -16,6 +16,6 @@ const IDSDropdownContentLink = ({ children, className, ...props }) => {
|
|
|
16
16
|
role: "menuitem",
|
|
17
17
|
children: content
|
|
18
18
|
});
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
20
|
|
|
21
21
|
export { IDSDropdownContentLink };
|
|
@@ -13,5 +13,5 @@ interface IDSDropdownProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
13
13
|
maxHeight?: string;
|
|
14
14
|
children: ReactNode;
|
|
15
15
|
}
|
|
16
|
-
export declare
|
|
16
|
+
export declare function IDSDropdown({ expanded, persistent, position, sBlock, mBlock, maxHeight, onOpened, onClosed, children, className, button, ...props }: IDSDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -5,7 +5,7 @@ import '@inera/ids-design/components/dropdown/dropdown.css';
|
|
|
5
5
|
import { useElementId } from '../utils/hooks/useElementId.js';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
function IDSDropdown({ expanded = false, persistent = false, position = "right", sBlock = false, mBlock = false, maxHeight = "", onOpened, onClosed, children, className, button, ...props }) {
|
|
9
9
|
const [isExpanded, setIsExpanded] = useState(expanded);
|
|
10
10
|
const triggerRef = useRef(null);
|
|
11
11
|
const contentRef = useRef(null);
|
|
@@ -70,6 +70,6 @@ const IDSDropdown = ({ expanded = false, persistent = false, position = "right",
|
|
|
70
70
|
"ids-dropdown--mblock": mBlock,
|
|
71
71
|
"ids-dropdown--sblock": sBlock
|
|
72
72
|
}), children: [renderTrigger(), isExpanded && renderDropdownContent()] }));
|
|
73
|
-
}
|
|
73
|
+
}
|
|
74
74
|
|
|
75
75
|
export { IDSDropdown };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from "react";
|
|
2
|
-
import "@inera/ids-design/components/footer-1177/footer-1177.css";
|
|
3
2
|
import { IDSLinkProps } from "../link/link";
|
|
4
|
-
|
|
3
|
+
import "@inera/ids-design/components/footer-1177/footer-1177.css";
|
|
4
|
+
export interface Footer1177Props extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
headline?: string;
|
|
6
6
|
srHeadline?: string;
|
|
7
7
|
subHeadline?: string;
|
|
@@ -16,5 +16,4 @@ interface Footer1177Props extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
16
16
|
subFooterMobile?: ReactNode;
|
|
17
17
|
children?: ReactNode;
|
|
18
18
|
}
|
|
19
|
-
export declare
|
|
20
|
-
export {};
|
|
19
|
+
export declare function IDSFooter1177({ headline, srHeadline, subHeadline, cols, col1, col2, col3, subFooterLeft, subFooterRight, mobileMenu, mobileLinks, subFooterMobile, children, className, ...props }: Footer1177Props): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,61 +1,24 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import React, { useRef } from 'react';
|
|
4
2
|
import clsx from 'clsx';
|
|
5
3
|
import '@inera/ids-design/components/footer-1177/footer-1177.css';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
const ref = useRef(null);
|
|
5
|
+
function IDSFooter1177({ headline = "", srHeadline = "", subHeadline = "", cols = 3, col1 = [], col2 = [], col3 = [], subFooterLeft, subFooterRight, mobileMenu, mobileLinks, subFooterMobile, children, className, ...props }) {
|
|
9
6
|
const renderHeadline = () => {
|
|
10
7
|
if (srHeadline) {
|
|
11
8
|
return (jsxs(Fragment, { children: [jsxs("h2", { className: "ids-footer-1177__headline--sr", children: [srHeadline, jsx("span", { className: "ids-footer-1177__headline--sub", children: subHeadline })] }), jsxs("h2", { "aria-hidden": "true", className: "ids-footer-1177__headline", children: [headline, jsx("span", { className: "ids-footer-1177__headline--sub", children: subHeadline })] })] }));
|
|
12
9
|
}
|
|
13
10
|
return (jsxs("h2", { className: "ids-footer-1177__headline", children: [headline, jsx("span", { className: "ids-footer-1177__headline--sub", children: subHeadline })] }));
|
|
14
11
|
};
|
|
15
|
-
const renderCol = (column) => {
|
|
16
|
-
return column?.map((link, idx) => {
|
|
17
|
-
if (React.isValidElement(link)) {
|
|
18
|
-
return React.cloneElement(link, {
|
|
19
|
-
key: `footer-link-${idx}`,
|
|
20
|
-
footer: true,
|
|
21
|
-
block: true
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return link;
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
12
|
const renderCols = () => {
|
|
28
13
|
if (cols === 1) {
|
|
29
|
-
return jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--100"), children:
|
|
14
|
+
return jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--100"), children: col1 });
|
|
30
15
|
}
|
|
31
|
-
|
|
32
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--50"), children:
|
|
16
|
+
if (cols === 2) {
|
|
17
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--50"), children: col1 }), jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--50"), children: col2 })] }));
|
|
33
18
|
}
|
|
34
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--33"), children:
|
|
35
|
-
};
|
|
36
|
-
const renderLinks = (content) => {
|
|
37
|
-
const applyProps = (node, keyPrefix = "") => {
|
|
38
|
-
if (!node)
|
|
39
|
-
return null;
|
|
40
|
-
if (Array.isArray(node)) {
|
|
41
|
-
return node.map((child, idx) => applyProps(child, `${keyPrefix}-${idx}`));
|
|
42
|
-
}
|
|
43
|
-
if (React.isValidElement(node)) {
|
|
44
|
-
if (node.type === React.Fragment) {
|
|
45
|
-
return (jsx(React.Fragment, { children: applyProps(node.props.children, keyPrefix) }, keyPrefix));
|
|
46
|
-
}
|
|
47
|
-
return React.cloneElement(node, {
|
|
48
|
-
key: `footer-sub-footer-right-link-${keyPrefix}`,
|
|
49
|
-
colorPreset: 3,
|
|
50
|
-
small: true,
|
|
51
|
-
...node.props
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
return node;
|
|
55
|
-
};
|
|
56
|
-
return applyProps(content, "root");
|
|
19
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--33"), children: col1 }), jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--33"), children: col2 }), jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--33"), children: col3 })] }));
|
|
57
20
|
};
|
|
58
|
-
return (jsxs("footer", { className: clsx("ids-footer-1177", className),
|
|
59
|
-
}
|
|
21
|
+
return (jsxs("footer", { className: clsx("ids-footer-1177", className), ...props, children: [jsx("div", { className: "ids-footer-1177__inner-wrapper", children: jsxs("div", { className: "ids-footer-1177__inner", children: [jsx("div", { className: "ids-footer-1177__headline-wrapper", children: renderHeadline() }), jsxs("div", { className: "ids-footer-1177__content", children: [jsx("div", { className: "ids-footer-1177__text", children: children }), jsx("div", { className: "ids-footer-1177__cols", children: renderCols() })] })] }) }), jsx("div", { className: "ids-footer-1177__mobile-menu", children: mobileMenu }), jsxs("div", { className: "ids-footer-1177__sub-footer", children: [jsx("div", { className: "ids-footer-1177__sub-footer-container", children: jsxs("div", { className: "ids-footer-1177__sub-footer-inner", children: [jsx("div", { className: "ids-footer-1177__sub-footer-left", children: subFooterLeft }), jsx("div", { className: "ids-footer-1177__sub-footer-right", children: subFooterRight }), jsx("div", { className: "ids-footer-1177__mobile-links", children: mobileLinks })] }) }), jsx("div", { className: "ids-footer-1177__sub-footer-mobile", children: jsx("div", { className: "ids-footer-1177__sub-footer-mobile-text", children: subFooterMobile }) })] })] }));
|
|
22
|
+
}
|
|
60
23
|
|
|
61
24
|
export { IDSFooter1177 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from "react";
|
|
2
|
-
import "@inera/ids-design/components/footer-1177-admin/footer-1177-admin.css";
|
|
3
2
|
import { IDSLinkProps } from "../link/link";
|
|
3
|
+
import "@inera/ids-design/components/footer-1177-admin/footer-1177-admin.css";
|
|
4
4
|
interface Footer1177AdminProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
headline?: string;
|
|
6
6
|
srHeadline?: string;
|