@inera/ids-react 8.0.0 → 8.2.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.
Files changed (125) hide show
  1. package/components/accordion/accordion.d.ts +1 -0
  2. package/components/accordion/accordion.js +5 -43
  3. package/components/action-link/action-link.d.ts +6 -0
  4. package/components/action-link/action-link.js +9 -0
  5. package/components/badge/badge.d.ts +3 -5
  6. package/components/badge/badge.js +2 -2
  7. package/components/box-link/box-link.d.ts +3 -5
  8. package/components/box-link/box-link.js +3 -4
  9. package/components/breadcrumbs/breadcrumbs.d.ts +2 -3
  10. package/components/breadcrumbs/breadcrumbs.js +2 -3
  11. package/components/button/button.d.ts +1 -2
  12. package/components/button-group/button-group.d.ts +2 -3
  13. package/components/button-group/button-group.js +2 -2
  14. package/components/card/card.d.ts +3 -4
  15. package/components/card/card.js +12 -7
  16. package/components/date-label/date-label.d.ts +2 -2
  17. package/components/date-label/date-label.js +9 -31
  18. package/components/dialog/dialog.d.ts +1 -1
  19. package/components/dialog/dialog.js +5 -6
  20. package/components/dropdown/dropdown-content-link.d.ts +1 -1
  21. package/components/dropdown/dropdown-content-link.js +2 -2
  22. package/components/dropdown/dropdown.d.ts +1 -1
  23. package/components/dropdown/dropdown.js +2 -2
  24. package/components/footer-1177/footer-1177.d.ts +3 -4
  25. package/components/footer-1177/footer-1177.js +7 -44
  26. package/components/footer-1177-admin/footer-1177-admin.d.ts +1 -1
  27. package/components/footer-1177-admin/footer-1177-admin.js +4 -41
  28. package/components/footer-1177-pro/footer-1177-pro.d.ts +1 -1
  29. package/components/footer-1177-pro/footer-1177-pro.js +4 -41
  30. package/components/footer-inera/footer-inera.d.ts +1 -1
  31. package/components/footer-inera/footer-inera.js +4 -41
  32. package/components/footer-inera-admin/footer-inera-admin.d.ts +1 -1
  33. package/components/footer-inera-admin/footer-inera-admin.js +4 -41
  34. package/components/form/checkbox/checkbox.js +3 -2
  35. package/components/form/datepicker/datepicker.d.ts +29 -0
  36. package/components/form/datepicker/datepicker.js +179 -0
  37. package/components/form/input/input.js +1 -1
  38. package/components/form/radio/radio.js +2 -1
  39. package/components/global-alert/global-alert.js +2 -2
  40. package/components/grid/column.d.ts +3 -4
  41. package/components/grid/column.js +2 -3
  42. package/components/grid/container.d.ts +5 -3
  43. package/components/grid/container.js +11 -18
  44. package/components/grid/row.d.ts +4 -4
  45. package/components/grid/row.js +6 -11
  46. package/components/header-1177/header-1177-item.d.ts +2 -2
  47. package/components/header-1177/header-1177-item.js +19 -14
  48. package/components/header-1177/header-1177-nav-item-mobile.js +5 -10
  49. package/components/header-1177/header-1177-nav-item.d.ts +4 -4
  50. package/components/header-1177/header-1177-nav-item.js +23 -17
  51. package/components/header-1177/header-1177-nav.d.ts +2 -2
  52. package/components/header-1177/header-1177-nav.js +4 -5
  53. package/components/header-1177/header-1177.d.ts +1 -1
  54. package/components/header-1177/header-1177.js +3 -16
  55. package/components/header-1177-admin/header-1177-admin-item.d.ts +2 -2
  56. package/components/header-1177-admin/header-1177-admin-item.js +21 -17
  57. package/components/header-1177-admin/header-1177-admin-nav-item.d.ts +4 -4
  58. package/components/header-1177-admin/header-1177-admin-nav-item.js +20 -14
  59. package/components/header-1177-admin/header-1177-admin-nav.d.ts +2 -2
  60. package/components/header-1177-admin/header-1177-admin-nav.js +5 -6
  61. package/components/header-1177-admin/header-1177-admin.d.ts +2 -2
  62. package/components/header-1177-admin/header-1177-admin.js +3 -4
  63. package/components/header-1177-pro/header-1177-pro-item.d.ts +2 -2
  64. package/components/header-1177-pro/header-1177-pro-item.js +21 -14
  65. package/components/header-1177-pro/header-1177-pro-nav-item.d.ts +5 -5
  66. package/components/header-1177-pro/header-1177-pro-nav-item.js +15 -19
  67. package/components/header-1177-pro/header-1177-pro-nav.d.ts +2 -3
  68. package/components/header-1177-pro/header-1177-pro-nav.js +5 -7
  69. package/components/header-1177-pro/header-1177-pro.d.ts +2 -2
  70. package/components/header-1177-pro/header-1177-pro.js +4 -8
  71. package/components/header-inera/header-inera-item.d.ts +3 -4
  72. package/components/header-inera/header-inera-item.js +30 -14
  73. package/components/header-inera/header-inera-nav-item.js +7 -20
  74. package/components/header-inera/header-inera-nav.d.ts +1 -1
  75. package/components/header-inera/header-inera-nav.js +5 -6
  76. package/components/header-inera/header-inera.d.ts +2 -2
  77. package/components/header-inera/header-inera.js +4 -8
  78. package/components/header-inera-admin/header-inera-admin-item.d.ts +3 -4
  79. package/components/header-inera-admin/header-inera-admin-item.js +17 -13
  80. package/components/header-inera-admin/header-inera-admin-nav-item.d.ts +1 -3
  81. package/components/header-inera-admin/header-inera-admin-nav-item.js +14 -27
  82. package/components/header-inera-admin/header-inera-admin-nav.d.ts +2 -3
  83. package/components/header-inera-admin/header-inera-admin-nav.js +3 -4
  84. package/components/header-inera-admin/header-inera-admin.d.ts +1 -1
  85. package/components/header-inera-admin/header-inera-admin.js +3 -4
  86. package/components/link/link.d.ts +1 -1
  87. package/components/link/link.js +15 -13
  88. package/components/navigation/content/navigation-content.d.ts +2 -3
  89. package/components/navigation/content/navigation-content.js +5 -12
  90. package/components/navigation/local/navigation-local.d.ts +2 -3
  91. package/components/navigation/local/navigation-local.js +2 -2
  92. package/components/notification/badge/notification-badge.d.ts +2 -3
  93. package/components/notification/badge/notification-badge.js +3 -3
  94. package/components/pagination/data-pagination/data-pagination.d.ts +1 -2
  95. package/components/pagination/data-pagination/data-pagination.js +0 -1
  96. package/components/pagination/list-pagination/list-pagination.d.ts +1 -1
  97. package/components/pagination/list-pagination/list-pagination.js +2 -3
  98. package/components/popover/popover.js +1 -1
  99. package/components/progressbar/progressbar.d.ts +5 -3
  100. package/components/progressbar/progressbar.js +4 -4
  101. package/components/puff-list/puff-list-item/puff-list-item-date.d.ts +13 -0
  102. package/components/puff-list/puff-list-item/puff-list-item-date.js +23 -0
  103. package/components/puff-list/puff-list-item/puff-list-item-header.d.ts +10 -0
  104. package/components/puff-list/puff-list-item/puff-list-item-header.js +11 -0
  105. package/components/puff-list/puff-list-item/puff-list-item-info.d.ts +3 -5
  106. package/components/puff-list/puff-list-item/puff-list-item-info.js +4 -5
  107. package/components/puff-list/puff-list-item/puff-list-item.d.ts +9 -20
  108. package/components/puff-list/puff-list-item/puff-list-item.js +8 -78
  109. package/components/puff-list/puff-list.d.ts +1 -1
  110. package/components/puff-list/puff-list.js +4 -3
  111. package/components/region-icon/region-icon.d.ts +2 -2
  112. package/components/region-icon/region-icon.js +5 -4
  113. package/components/side-menu/side-menu.js +1 -1
  114. package/components/stepper/step.js +1 -1
  115. package/components/stepper/stepper.d.ts +1 -1
  116. package/components/stepper/stepper.js +2 -2
  117. package/components/tabs/tab.js +1 -1
  118. package/components/tag/tag.d.ts +11 -4
  119. package/components/tag/tag.js +7 -7
  120. package/components/tooltip/tooltip.d.ts +1 -0
  121. package/components/tooltip/tooltip.js +8 -7
  122. package/components/utils/hooks/useFocusTrap.js +3 -2
  123. package/index.d.ts +4 -0
  124. package/index.js +4 -0
  125. 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 React, { useState, useRef, useEffect } from 'react';
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 || isLean,
68
- "ids-accordion--has-children": hasChildren,
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 }) }), jsx("div", { "aria-hidden": !isExpanded, id: contentId, className: "ids-accordion__content", children: React.Children.map(children, child => {
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 };
@@ -0,0 +1,6 @@
1
+ import React, { ReactNode } from "react";
2
+ import "@inera/ids-design/components/action-link/action-link.css";
3
+ export interface IDSActionLinkProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ image?: ReactNode;
5
+ }
6
+ export declare function IDSActionLink({ image, children, className, ...props }: IDSActionLinkProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import '@inera/ids-design/components/action-link/action-link.css';
3
+ import clsx from 'clsx';
4
+
5
+ function IDSActionLink({ image, children, className, ...props }) {
6
+ return (jsx("div", { className: clsx("ids-action-link", className), ...props, children: jsxs("div", { className: "ids-action-link__inner", children: [jsx("div", { className: "ids-action-link__image", children: image }), children, jsx("div", { className: "ids-action-link__icon", "aria-hidden": "true" })] }) }));
7
+ }
8
+
9
+ export { IDSActionLink };
@@ -1,9 +1,7 @@
1
- import React, { ReactNode } from "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 const IDSBadge: React.FC<IDSBadgeProps>;
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
- const IDSBadge = ({ type = "primary", icon, children, className, ...props }) => {
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, ReactNode } from "react";
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 const IDSBoxLink: React.FC<IDSBoxLinkProps>;
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
- const IDSBoxLink = ({ srButton = "", buttonIcon = "", onButtonClick, children, className, buttonProps = {}, ...props }) => {
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 }), !!onButtonClick && (jsx("div", { className: "ids-box-link__button", children: jsx("button", { className: `ids-icon-${buttonIcon}`, onClick: onButtonClick, "aria-label": srButton, ...buttonProps }) }))] }) }));
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, { ReactNode } from "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 const IDSBreadcrumbs: React.FC<IDSBreadcrumbsProps>;
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
- const IDSBreadcrumbs = ({ lead = "Du är här", mobileLink, children, className, ...props }) => {
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 { ReactNode, ButtonHTMLAttributes } from "react";
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, { ReactNode } from "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 const IDSButtonGroup: React.FC<IDSButtonGroupProps>;
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
- const IDSButtonGroup = ({ rtl = false, justify = "start", unresponsive = false, break: breakpoint = "m", children, className, ...props }) => {
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, { ReactNode } from "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 const IDSCard: React.FC<IDSCardProps>;
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 {};
@@ -1,14 +1,19 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
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
- const IDSCard = ({ focusCard = false, fill = false, borderTop = false, lean = false, hideOnM = false, hideOnS = false, cardLink, children, className, ...props }) => {
7
- const enhancedCardLink = isValidElement(cardLink)
8
- ? cloneElement(cardLink, {
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
- : cardLink;
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 React, { DetailedHTMLProps, TimeHTMLAttributes } from "react";
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 const IDSDateLabel: React.FC<IDSDateLabelProps>;
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
- const IDSDateLabel = ({ date = null, year = 0, month = 0, day = 0, monthLabel = "", dateTo = null, yearTo = 0, monthTo = 0, monthToLabel = "", srText = "", dayTo = 0, className, ...props }) => {
9
- const [presentedDate, setPresentedDate] = useState(date ? new Date(date) : null);
10
- const [presentedToDate, setPresentedToDate] = useState(dateTo ? new Date(dateTo) : null);
11
- useEffect(() => {
12
- if (date) {
13
- setPresentedDate(new Date(date));
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
- // dateTime={`${getDay()}-${getMonth().toString().padStart(2, "0")}-${getYear()}`}
36
- // dateTime={`${getDayTo()}-${getMonthTo().toString().padStart(2, "0")}-${getYearTo()}`}
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 const IDSDialog: React.FC<IDSDialogProps>;
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
- const 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 }) => {
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 || noOverlay
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 const IDSDropdownContentLink: React.FC<IDSDropdownContentLinkProps>;
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
- const IDSDropdownContentLink = ({ children, className, ...props }) => {
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 const IDSDropdown: React.FC<IDSDropdownProps>;
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
- const IDSDropdown = ({ expanded = false, persistent = false, position = "right", sBlock = false, mBlock = false, maxHeight = "", onOpened, onClosed, children, className, button, ...props }) => {
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
- interface Footer1177Props extends React.HTMLAttributes<HTMLDivElement> {
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 const IDSFooter1177: React.FC<Footer1177Props>;
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
- const IDSFooter1177 = ({ headline = "", srHeadline = "", subHeadline = "", cols = 3, col1 = [], col2 = [], col3 = [], subFooterLeft, subFooterRight, mobileMenu, mobileLinks, subFooterMobile, children, className, ...props }) => {
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: renderCol(col1) });
14
+ return jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--100"), children: col1 });
30
15
  }
31
- else if (cols === 2) {
32
- return (jsxs(Fragment, { children: [jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--50"), children: renderCol(col1) }), jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--50"), children: renderCol(col2) })] }));
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: renderCol(col1) }), jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--33"), children: renderCol(col2) }), jsx("div", { className: clsx("ids-footer-1177__link-col", "ids-footer-1177__link-col--33"), children: renderCol(col3) })] }));
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), ref: ref, ...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: renderLinks(subFooterLeft) }), jsx("div", { className: "ids-footer-1177__sub-footer-right", children: subFooterRight }), jsx("div", { className: "ids-footer-1177__mobile-links", children: renderLinks(mobileLinks) })] }) }), jsx("div", { className: "ids-footer-1177__sub-footer-mobile", children: jsx("div", { className: "ids-footer-1177__sub-footer-mobile-text", children: subFooterMobile }) })] })] }));
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;