@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.
Files changed (116) hide show
  1. package/components/accordion/accordion.d.ts +1 -0
  2. package/components/accordion/accordion.js +5 -43
  3. package/components/badge/badge.d.ts +3 -5
  4. package/components/badge/badge.js +2 -2
  5. package/components/box-link/box-link.d.ts +3 -5
  6. package/components/box-link/box-link.js +3 -4
  7. package/components/breadcrumbs/breadcrumbs.d.ts +2 -3
  8. package/components/breadcrumbs/breadcrumbs.js +2 -3
  9. package/components/button/button.d.ts +1 -2
  10. package/components/button-group/button-group.d.ts +2 -3
  11. package/components/button-group/button-group.js +2 -2
  12. package/components/card/card.d.ts +3 -4
  13. package/components/card/card.js +12 -7
  14. package/components/date-label/date-label.d.ts +2 -2
  15. package/components/date-label/date-label.js +9 -31
  16. package/components/dialog/dialog.d.ts +1 -1
  17. package/components/dialog/dialog.js +5 -6
  18. package/components/dropdown/dropdown-content-link.d.ts +1 -1
  19. package/components/dropdown/dropdown-content-link.js +2 -2
  20. package/components/dropdown/dropdown.d.ts +1 -1
  21. package/components/dropdown/dropdown.js +2 -2
  22. package/components/footer-1177/footer-1177.d.ts +3 -4
  23. package/components/footer-1177/footer-1177.js +7 -44
  24. package/components/footer-1177-admin/footer-1177-admin.d.ts +1 -1
  25. package/components/footer-1177-admin/footer-1177-admin.js +4 -41
  26. package/components/footer-1177-pro/footer-1177-pro.d.ts +1 -1
  27. package/components/footer-1177-pro/footer-1177-pro.js +4 -41
  28. package/components/footer-inera/footer-inera.d.ts +1 -1
  29. package/components/footer-inera/footer-inera.js +4 -41
  30. package/components/footer-inera-admin/footer-inera-admin.d.ts +1 -1
  31. package/components/footer-inera-admin/footer-inera-admin.js +4 -41
  32. package/components/form/checkbox/checkbox.js +1 -1
  33. package/components/global-alert/global-alert.js +2 -2
  34. package/components/grid/column.d.ts +3 -4
  35. package/components/grid/column.js +2 -3
  36. package/components/grid/container.d.ts +4 -3
  37. package/components/grid/container.js +6 -17
  38. package/components/grid/row.d.ts +4 -4
  39. package/components/grid/row.js +6 -11
  40. package/components/header-1177/header-1177-item.d.ts +2 -2
  41. package/components/header-1177/header-1177-item.js +19 -14
  42. package/components/header-1177/header-1177-nav-item-mobile.js +5 -10
  43. package/components/header-1177/header-1177-nav-item.d.ts +4 -4
  44. package/components/header-1177/header-1177-nav-item.js +23 -17
  45. package/components/header-1177/header-1177-nav.d.ts +2 -2
  46. package/components/header-1177/header-1177-nav.js +4 -5
  47. package/components/header-1177/header-1177.d.ts +1 -1
  48. package/components/header-1177/header-1177.js +3 -16
  49. package/components/header-1177-admin/header-1177-admin-item.d.ts +2 -2
  50. package/components/header-1177-admin/header-1177-admin-item.js +21 -17
  51. package/components/header-1177-admin/header-1177-admin-nav-item.d.ts +4 -4
  52. package/components/header-1177-admin/header-1177-admin-nav-item.js +20 -14
  53. package/components/header-1177-admin/header-1177-admin-nav.d.ts +2 -2
  54. package/components/header-1177-admin/header-1177-admin-nav.js +5 -6
  55. package/components/header-1177-admin/header-1177-admin.d.ts +2 -2
  56. package/components/header-1177-admin/header-1177-admin.js +3 -4
  57. package/components/header-1177-pro/header-1177-pro-item.d.ts +2 -2
  58. package/components/header-1177-pro/header-1177-pro-item.js +21 -14
  59. package/components/header-1177-pro/header-1177-pro-nav-item.d.ts +5 -5
  60. package/components/header-1177-pro/header-1177-pro-nav-item.js +15 -19
  61. package/components/header-1177-pro/header-1177-pro-nav.d.ts +2 -3
  62. package/components/header-1177-pro/header-1177-pro-nav.js +5 -7
  63. package/components/header-1177-pro/header-1177-pro.d.ts +2 -2
  64. package/components/header-1177-pro/header-1177-pro.js +4 -8
  65. package/components/header-inera/header-inera-item.d.ts +3 -4
  66. package/components/header-inera/header-inera-item.js +30 -14
  67. package/components/header-inera/header-inera-nav-item.js +7 -20
  68. package/components/header-inera/header-inera-nav.d.ts +1 -1
  69. package/components/header-inera/header-inera-nav.js +5 -6
  70. package/components/header-inera/header-inera.d.ts +2 -2
  71. package/components/header-inera/header-inera.js +4 -8
  72. package/components/header-inera-admin/header-inera-admin-item.d.ts +3 -4
  73. package/components/header-inera-admin/header-inera-admin-item.js +17 -13
  74. package/components/header-inera-admin/header-inera-admin-nav-item.d.ts +1 -3
  75. package/components/header-inera-admin/header-inera-admin-nav-item.js +14 -27
  76. package/components/header-inera-admin/header-inera-admin-nav.d.ts +2 -3
  77. package/components/header-inera-admin/header-inera-admin-nav.js +3 -4
  78. package/components/header-inera-admin/header-inera-admin.d.ts +1 -1
  79. package/components/header-inera-admin/header-inera-admin.js +3 -4
  80. package/components/link/link.d.ts +1 -1
  81. package/components/link/link.js +15 -13
  82. package/components/navigation/content/navigation-content.d.ts +2 -3
  83. package/components/navigation/content/navigation-content.js +5 -12
  84. package/components/navigation/local/navigation-local.d.ts +2 -3
  85. package/components/navigation/local/navigation-local.js +2 -2
  86. package/components/notification/badge/notification-badge.d.ts +2 -3
  87. package/components/notification/badge/notification-badge.js +2 -2
  88. package/components/pagination/data-pagination/data-pagination.d.ts +1 -2
  89. package/components/pagination/data-pagination/data-pagination.js +0 -1
  90. package/components/pagination/list-pagination/list-pagination.d.ts +1 -1
  91. package/components/pagination/list-pagination/list-pagination.js +2 -3
  92. package/components/progressbar/progressbar.d.ts +5 -3
  93. package/components/progressbar/progressbar.js +4 -4
  94. package/components/puff-list/puff-list-item/puff-list-item-date.d.ts +13 -0
  95. package/components/puff-list/puff-list-item/puff-list-item-date.js +23 -0
  96. package/components/puff-list/puff-list-item/puff-list-item-header.d.ts +10 -0
  97. package/components/puff-list/puff-list-item/puff-list-item-header.js +11 -0
  98. package/components/puff-list/puff-list-item/puff-list-item-info.d.ts +3 -5
  99. package/components/puff-list/puff-list-item/puff-list-item-info.js +4 -5
  100. package/components/puff-list/puff-list-item/puff-list-item.d.ts +9 -20
  101. package/components/puff-list/puff-list-item/puff-list-item.js +8 -78
  102. package/components/puff-list/puff-list.d.ts +1 -1
  103. package/components/puff-list/puff-list.js +4 -3
  104. package/components/region-icon/region-icon.d.ts +2 -2
  105. package/components/region-icon/region-icon.js +5 -4
  106. package/components/side-menu/side-menu.js +1 -1
  107. package/components/stepper/stepper.d.ts +1 -1
  108. package/components/stepper/stepper.js +2 -2
  109. package/components/tag/tag.d.ts +11 -4
  110. package/components/tag/tag.js +7 -7
  111. package/components/tooltip/tooltip.d.ts +1 -0
  112. package/components/tooltip/tooltip.js +8 -7
  113. package/components/utils/hooks/useFocusTrap.js +2 -1
  114. package/index.d.ts +2 -0
  115. package/index.js +2 -0
  116. package/package.json +2 -2
@@ -1,10 +1,12 @@
1
1
  import React from "react";
2
2
  import "@inera/ids-design/components/progressbar/progressbar.css";
3
- interface IDSProgressbarProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ export interface IDSProgressbarProps extends React.HTMLAttributes<HTMLDivElement> {
4
4
  label: string;
5
5
  hideLabel?: boolean;
6
6
  value?: number;
7
7
  srLabel: string;
8
8
  }
9
- export declare const IDSProgressbar: React.FC<IDSProgressbarProps>;
10
- export {};
9
+ export declare function IDSProgressbar({ label, hideLabel, value, srLabel, className, ...props }: IDSProgressbarProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare namespace IDSProgressbar {
11
+ var displayName: string;
12
+ }
@@ -1,10 +1,10 @@
1
- "use client";
2
1
  import { jsxs, jsx } from 'react/jsx-runtime';
3
2
  import '@inera/ids-design/components/progressbar/progressbar.css';
4
3
  import clsx from 'clsx';
5
4
 
6
- const IDSProgressbar = ({ label = "", hideLabel = false, value = 0, srLabel = "", className, ...props }) => {
7
- return (jsxs("div", { className: clsx("ids-progressbar", className), ...props, children: [hideLabel ? null : (jsxs("div", { className: "ids-progressbar__label", children: [label, " ", value, "%"] })), jsx("div", { className: "ids-progressbar__bar", role: "progressbar", "aria-label": srLabel, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": value, children: value > 0 ? (jsx("div", { className: "ids-progressbar__progress", style: { width: `calc(${value}% + 0.125rem)` } })) : null })] }));
8
- };
5
+ function IDSProgressbar({ label = "", hideLabel = false, value = 0, srLabel = "", className, ...props }) {
6
+ return (jsxs("div", { className: clsx("ids-progressbar", className), ...props, children: [!hideLabel && (jsxs("div", { className: "ids-progressbar__label", children: [label, " ", value, "%"] })), jsx("div", { className: "ids-progressbar__bar", role: "progressbar", "aria-label": srLabel, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": value, children: value > 0 && jsx("div", { className: "ids-progressbar__progress", style: { width: `calc(${value}% + 0.125rem)` } }) })] }));
7
+ }
8
+ IDSProgressbar.displayName = "IDSProgressbar";
9
9
 
10
10
  export { IDSProgressbar };
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import "@inera/ids-design/components/puff-list/puff-list.css";
3
+ interface IDSPuffListItemDateProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ date?: Date | null;
5
+ showTime?: boolean;
6
+ day?: number;
7
+ year?: number;
8
+ month?: number;
9
+ monthLabel?: string;
10
+ time?: string;
11
+ }
12
+ export declare function IDSPuffListItemDate({ date, showTime, day, year, month, monthLabel, time, ...props }: IDSPuffListItemDateProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,23 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import '@inera/ids-design/components/puff-list/puff-list.css';
3
+ import { getDayAsText, getMonthAsSweText } from '../../utils/utils.js';
4
+
5
+ function IDSPuffListItemDate({ date, showTime = false, day = 0, year = 0, month = 0, monthLabel = "", time = "", ...props }) {
6
+ const getDay = () => getDayAsText(date ? date.getDate() : day);
7
+ const getMonth = () => (date ? date.getMonth() + 1 : month);
8
+ const getYear = () => (date ? date.getFullYear() : year);
9
+ const getMonthText = () => monthLabel || getMonthAsSweText(getMonth() - 1, 3);
10
+ const getTime = () => {
11
+ if (time)
12
+ return time;
13
+ if (showTime && date) {
14
+ const h = date.getHours();
15
+ const m = date.getMinutes();
16
+ return `${h.toString().padStart(2, "0")}:${m.toString().padStart(2, "0")}`;
17
+ }
18
+ return "";
19
+ };
20
+ return (jsxs("span", { className: "ids-puff-list-item__date", ...props, children: [`${getDay()} ${getMonthText()} ${getYear()}`, !!getTime() && jsx("span", { className: "ids-puff-list-item__time", children: getTime() })] }));
21
+ }
22
+
23
+ export { IDSPuffListItemDate };
@@ -0,0 +1,10 @@
1
+ import React, { ReactNode } from "react";
2
+ export interface IDSPuffListItemHeaderProps extends React.HTMLAttributes<HTMLHeadingElement> {
3
+ headlineLevel?: 2 | 3 | 4 | 5;
4
+ headlineExtra?: ReactNode;
5
+ noMargin?: boolean;
6
+ }
7
+ export declare function IDSPuffListItemHeader({ headlineLevel, headlineExtra, noMargin, className, children, ...props }: IDSPuffListItemHeaderProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare namespace IDSPuffListItemHeader {
9
+ var displayName: string;
10
+ }
@@ -0,0 +1,11 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
3
+
4
+ function IDSPuffListItemHeader({ headlineLevel = 2, headlineExtra, noMargin = false, className, children, ...props }) {
5
+ const Tag = `h${headlineLevel}`;
6
+ const headerClass = clsx("ids-puff-list-item-header__headline", { "ids-puff-list-item-header__headline--no-margin": noMargin }, className);
7
+ return (jsxs(Tag, { className: headerClass, ...props, children: [children, headlineExtra && jsx("span", { className: "ids-puff-list-item-header__extra-content", children: headlineExtra })] }));
8
+ }
9
+ IDSPuffListItemHeader.displayName = "IDSPuffListItemHeader";
10
+
11
+ export { IDSPuffListItemHeader };
@@ -1,8 +1,6 @@
1
- import React, { ReactNode } from "react";
1
+ import React from "react";
2
2
  import "@inera/ids-design/components/puff-list/puff-list.css";
3
- interface IDSPuffListItemInfoProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ export interface IDSPuffListItemInfoProps extends React.HTMLAttributes<HTMLDivElement> {
4
4
  bottom?: boolean;
5
- children?: ReactNode;
6
5
  }
7
- export declare const IDSPuffListItemInfo: React.FC<IDSPuffListItemInfoProps>;
8
- export {};
6
+ export declare function IDSPuffListItemInfo({ bottom, children, className, ...props }: IDSPuffListItemInfoProps): import("react/jsx-runtime").JSX.Element;
@@ -2,10 +2,9 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import '@inera/ids-design/components/puff-list/puff-list.css';
3
3
  import clsx from 'clsx';
4
4
 
5
- const IDSPuffListItemInfo = ({ bottom, children, ...props }) => {
6
- return (jsx("div", { className: clsx("ids-puff-list-item__info", {
7
- "ids-puff-list-item__info--bottom": bottom
8
- }), ...props, children: children }));
9
- };
5
+ function IDSPuffListItemInfo({ bottom = false, children, className, ...props }) {
6
+ const classes = clsx("ids-puff-list-item__info", { "ids-puff-list-item__info--bottom": bottom }, className);
7
+ return (jsx("div", { className: classes, ...props, children: children }));
8
+ }
10
9
 
11
10
  export { IDSPuffListItemInfo };
@@ -1,28 +1,17 @@
1
1
  import React, { ReactNode } from "react";
2
2
  import "@inera/ids-design/components/puff-list/puff-list.css";
3
- interface IDSPuffListItemProps extends React.HTMLAttributes<HTMLDivElement> {
4
- headline?: ReactNode;
5
- headlineLevel?: 2 | 3 | 4 | 5;
6
- headlineLink?: React.ReactElement;
3
+ export interface IDSPuffListItemProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ header?: ReactNode;
7
5
  itemLink?: React.ReactElement;
8
- date?: Date | null;
9
- year?: string;
10
- month?: number;
11
- monthLabel?: string;
12
- day?: number;
13
- time?: string;
14
- dateTo?: Date | null;
15
- yearTo?: string;
16
- monthTo?: number;
17
- monthToLabel?: string;
18
- dayTo?: number;
19
- timeTo?: string;
6
+ date?: React.ReactElement;
7
+ dateTo?: React.ReactElement;
20
8
  noContent?: boolean;
21
9
  lean?: boolean;
22
- noMargin?: boolean;
23
- noListItem?: boolean;
24
10
  dateLabel?: ReactNode;
11
+ extra?: ReactNode;
25
12
  children?: ReactNode;
26
13
  }
27
- export declare const IDSPuffListItem: React.FC<IDSPuffListItemProps>;
28
- export {};
14
+ export declare function IDSPuffListItem({ header, itemLink, date, dateTo, noContent, lean, dateLabel, extra, className, children, ...props }: IDSPuffListItemProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare namespace IDSPuffListItem {
16
+ var displayName: string;
17
+ }
@@ -1,82 +1,11 @@
1
- "use client";
2
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
- import React, { useState, useEffect, isValidElement, cloneElement } from 'react';
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { isValidElement, cloneElement } from 'react';
4
3
  import '@inera/ids-design/components/puff-list/puff-list.css';
5
- import { getDayAsText, getMonthAsSweText } from '../../utils/utils.js';
6
4
  import clsx from 'clsx';
7
5
 
8
- const IDSPuffListItem = ({ headline = "", headlineLevel = 2, headlineLink, itemLink, date = null, year = "", month = -1, monthLabel = "", day = -1, time = "", dateTo = null, yearTo = "", monthTo = -1, monthToLabel = "", dayTo = -1, timeTo = "", noContent = false, noMargin = false, noListItem = false, lean = false, dateLabel, className, children, ...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 hasDate = () => date !== null ||
22
- (year !== "" && year !== undefined) ||
23
- (month !== null && month !== undefined && month > 0) ||
24
- (day !== null && day !== undefined && day > 0);
25
- const hasToDate = () => dateTo !== null ||
26
- (yearTo !== "" && yearTo !== undefined) ||
27
- (monthTo !== null && monthTo !== undefined && monthTo > 0) ||
28
- (dayTo !== null && dayTo !== undefined && dayTo > 0);
29
- const getYear = () => (presentedDate ? presentedDate.getFullYear() : year);
30
- const getYearTo = () => (presentedToDate ? presentedToDate.getFullYear() : yearTo);
31
- const getMonth = () => (presentedDate ? presentedDate.getMonth() + 1 : month);
32
- const getMonthTo = () => (presentedToDate ? presentedToDate.getMonth() + 1 : monthTo);
33
- const getDay = () => {
34
- const dayNumber = presentedDate ? presentedDate.getDate() : day;
35
- return getDayAsText(dayNumber);
36
- };
37
- const getDayTo = () => {
38
- const dayNumber = presentedToDate ? presentedToDate.getDate() : dayTo;
39
- return getDayAsText(dayNumber);
40
- };
41
- const getMonthText = () => (monthLabel ? monthLabel : getMonthAsSweText(getMonth() - 1, 3));
42
- const getMonthToText = () => (monthToLabel ? monthToLabel : getMonthAsSweText(getMonthTo() - 1, 3));
43
- const getTime = () => {
44
- if (time)
45
- return time;
46
- if (presentedDate) {
47
- const hour = presentedDate.getHours();
48
- const min = presentedDate.getMinutes();
49
- return `${hour.toString().padStart(2, "0")}:${min.toString().padStart(2, "0")}`;
50
- }
51
- return "";
52
- };
53
- const getTimeTo = () => {
54
- if (timeTo)
55
- return timeTo;
56
- if (presentedToDate) {
57
- const hour = presentedToDate.getHours();
58
- const min = presentedToDate.getMinutes();
59
- return `${hour.toString().padStart(2, "0")}:${min.toString().padStart(2, "0")}`;
60
- }
61
- return "";
62
- };
63
- const getHeaderClass = (noMargin) => clsx("ids-puff-list-item__header", {
64
- "ids-puff-list-item__header--no-margin": noMargin
65
- });
66
- const renderHeadline = () => {
67
- const level = [2, 3, 4, 5].includes(headlineLevel) ? headlineLevel : 2;
68
- const Tag = `h${level}`;
69
- const headlineContent = jsx(Fragment, { children: headline });
70
- if (headlineLink && isValidElement(headlineLink)) {
71
- return React.createElement(Tag, { className: getHeaderClass(noMargin) }, cloneElement(headlineLink, {
72
- ...headlineLink.props,
73
- children: headlineContent
74
- }));
75
- }
76
- return React.createElement(Tag, { className: getHeaderClass(noMargin) }, headline);
77
- };
6
+ function IDSPuffListItem({ header, itemLink, date, dateTo, noContent = false, lean = false, dateLabel, extra, className, children, ...props }) {
78
7
  const renderBody = () => {
79
- const content = (jsxs(Fragment, { children: [renderHeadline(), !noContent && jsx("div", { className: "ids-puff-list-item__body", children: children })] }));
8
+ const content = (jsxs(Fragment, { children: [jsx("div", { className: "ids-puff-list-item-header", children: header }), !noContent && jsx("div", { className: "ids-puff-list-item__body", children: children })] }));
80
9
  if (itemLink && isValidElement(itemLink)) {
81
10
  return cloneElement(itemLink, {
82
11
  ...itemLink.props,
@@ -86,10 +15,11 @@ const IDSPuffListItem = ({ headline = "", headlineLevel = 2, headlineLink, itemL
86
15
  }
87
16
  return content;
88
17
  };
89
- return (jsx("div", { className: clsx("ids-puff-list-item", {
18
+ return (jsxs("div", { className: clsx("ids-puff-list-item", {
90
19
  "ids-puff-list-item--interactive": !!itemLink,
91
20
  "ids-puff-list-item--lean": !!lean
92
- }, className), ...props, children: jsxs("div", { className: "ids-puff-list-item__inner", children: [dateLabel && jsx("div", { className: "ids-puff-list-item__date-label", children: dateLabel }), jsxs("div", { className: "ids-puff-list-item__content", children: [hasDate() && (jsxs("span", { className: "ids-puff-list-item__date", children: [`${getDay()} ${getMonthText()} ${getYear()}`, !!getTime() && jsx("span", { className: "ids-puff-list-item__time", children: getTime() })] })), hasDate() && hasToDate() && (jsxs("span", { className: "ids-puff-list-item__date", children: [jsx("span", { className: "ids-puff-list-item__date-spacer", children: "\u2015" }), `${getDayTo()} ${getMonthToText()} ${getYearTo()}`, !!getTimeTo() && jsx("span", { className: "ids-puff-list-item__time", children: getTimeTo() })] })), renderBody()] })] }) }));
93
- };
21
+ }, className), ...props, children: [jsxs("div", { className: "ids-puff-list-item__inner", children: [dateLabel && jsx("div", { className: "ids-puff-list-item__date-label", children: dateLabel }), jsxs("div", { className: "ids-puff-list-item__content", children: [!!date && date, !!date && !!dateTo && (jsxs(Fragment, { children: [jsx("span", { className: "ids-puff-list-item__date-spacer", children: "\u2015" }), dateTo] })), renderBody()] }), extra && jsx("div", { className: "ids-puff-list-item__extra-content", children: extra })] }), jsx("div", { className: "ids-puff-list-item-separator" })] }));
22
+ }
23
+ IDSPuffListItem.displayName = "IDSPuffListItem";
94
24
 
95
25
  export { IDSPuffListItem };
@@ -3,5 +3,5 @@ import "@inera/ids-design/components/puff-list/puff-list.css";
3
3
  interface IDSPuffListProps extends React.HTMLAttributes<HTMLDivElement> {
4
4
  children?: ReactNode;
5
5
  }
6
- export declare const IDSPuffList: React.FC<IDSPuffListProps>;
6
+ export declare function IDSPuffList({ children, className, ...props }: IDSPuffListProps): import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -2,8 +2,9 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import '@inera/ids-design/components/puff-list/puff-list.css';
3
3
  import clsx from 'clsx';
4
4
 
5
- const IDSPuffList = ({ children, className, ...props }) => {
6
- return (jsx("div", { className: clsx("ids-puff-list", className), ...props, children: children }));
7
- };
5
+ function IDSPuffList({ children, className, ...props }) {
6
+ const classes = clsx("ids-puff-list", className);
7
+ return (jsx("div", { className: classes, ...props, children: children }));
8
+ }
8
9
 
9
10
  export { IDSPuffList };
@@ -1,12 +1,12 @@
1
1
  import React from "react";
2
2
  import "@inera/ids-design/components/region-icon/region-icon.css";
3
3
  type Size = "xs" | "s" | "m" | "l" | "ml";
4
- interface IDSRegionIconProps extends React.HTMLAttributes<HTMLSpanElement> {
4
+ export interface IDSRegionIconProps extends React.HTMLAttributes<HTMLSpanElement> {
5
5
  name: string;
6
6
  size?: Size;
7
7
  colorPreset?: number;
8
8
  light?: boolean;
9
9
  inline?: boolean;
10
10
  }
11
- export declare const IDSRegionIcon: React.FC<IDSRegionIconProps>;
11
+ export declare function IDSRegionIcon({ name, size, colorPreset, light, inline, className, ...props }: IDSRegionIconProps): import("react/jsx-runtime").JSX.Element;
12
12
  export {};
@@ -1,17 +1,18 @@
1
- "use client";
2
1
  import { jsx } from 'react/jsx-runtime';
3
2
  import '@inera/ids-design/components/region-icon/region-icon.css';
4
3
  import clsx from 'clsx';
5
4
 
6
- const IDSRegionIcon = ({ name, size = "m", colorPreset = 1, light = false, inline = false, className, ...props }) => {
5
+ function IDSRegionIcon({ name, size = "m", colorPreset = 1, light = false, inline = false, className, ...props }) {
7
6
  const getSize = () => {
8
7
  switch (size) {
9
8
  case "l":
10
9
  return "3rem";
10
+ case "ml":
11
+ return "2.75rem";
11
12
  case "m":
12
13
  return "2.5rem";
13
14
  case "s":
14
- return "2.0rem";
15
+ return "2rem";
15
16
  case "xs":
16
17
  return "1.5rem";
17
18
  default:
@@ -19,6 +20,6 @@ const IDSRegionIcon = ({ name, size = "m", colorPreset = 1, light = false, inlin
19
20
  }
20
21
  };
21
22
  return (jsx("span", { className: clsx("ids-region-icon", `ids-region-icon--${name}`, `ids-region-icon--color-preset-${light ? 3 : colorPreset}`, { "ids-region-icon--inline": inline }, className), style: { fontSize: getSize() }, ...props }));
22
- };
23
+ }
23
24
 
24
25
  export { IDSRegionIcon };
@@ -44,7 +44,7 @@ const IDSSideMenu = ({ label = "", srToggleText = "Sektion", expanded = false, a
44
44
  if (label) {
45
45
  return renderLabel();
46
46
  }
47
- return (jsxs(Fragment, { children: [renderExpandButton(), jsx("div", { className: "ids-side-menu__link", onClick: e => e.stopPropagation(), onKeyDown: e => e.code !== "Escape" && e.stopPropagation(), children: link })] }));
47
+ return (jsxs(Fragment, { children: [renderExpandButton(), jsx("div", { className: "ids-side-menu__link", children: link })] }));
48
48
  };
49
49
  return (jsxs("div", { className: clsx("ids-side-menu", className), ...props, children: [jsx("div", { className: clsx("ids-side-menu__header", `ids-side-menu--level-${level}`, {
50
50
  "ids-side-menu--active": active,
@@ -5,5 +5,5 @@ interface IDSStepperProps extends React.HTMLAttributes<HTMLDivElement> {
5
5
  children: ReactElement<IDSStepProps>[] | ReactElement<IDSStepProps>;
6
6
  onToggleExpansion?: (step: number, expanded: boolean) => void;
7
7
  }
8
- export declare const IDSStepper: React.FC<IDSStepperProps>;
8
+ export declare function IDSStepper({ children, onToggleExpansion, className, ...props }: IDSStepperProps): import("react/jsx-runtime").JSX.Element;
9
9
  export {};
@@ -4,7 +4,7 @@ import React, { isValidElement, cloneElement } from 'react';
4
4
  import '@inera/ids-design/components/stepper/stepper.css';
5
5
  import clsx from 'clsx';
6
6
 
7
- const IDSStepper = ({ children, onToggleExpansion, className, ...props }) => {
7
+ function IDSStepper({ children, onToggleExpansion, className, ...props }) {
8
8
  const stepsArray = React.Children.toArray(children).filter(isValidElement);
9
9
  const handleExpansion = (step, expanded) => {
10
10
  onToggleExpansion?.(step, expanded);
@@ -18,6 +18,6 @@ const IDSStepper = ({ children, onToggleExpansion, className, ...props }) => {
18
18
  });
19
19
  });
20
20
  return (jsx("div", { className: clsx("ids-stepper", className), ...props, children: enhancedSteps }));
21
- };
21
+ }
22
22
 
23
23
  export { IDSStepper };
@@ -1,10 +1,17 @@
1
1
  import React, { ReactNode } from "react";
2
2
  import "@inera/ids-design/components/tag/tag.css";
3
- interface IDSTagProps extends React.HTMLAttributes<HTMLButtonElement> {
3
+ type ButtonTagProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
4
+ onClick: () => void;
5
+ onClose?: () => void;
4
6
  srCloseLabel?: string;
7
+ children?: ReactNode;
8
+ };
9
+ type SpanTagProps = React.HTMLAttributes<HTMLSpanElement> & {
10
+ onClick?: undefined;
5
11
  onClose?: () => void;
6
- onClick?: () => void;
12
+ srCloseLabel?: string;
7
13
  children?: ReactNode;
8
- }
9
- export declare const IDSTag: React.FC<IDSTagProps>;
14
+ };
15
+ type IDSTagProps = ButtonTagProps | SpanTagProps;
16
+ export declare const IDSTag: React.ForwardRefExoticComponent<IDSTagProps & React.RefAttributes<HTMLButtonElement | HTMLSpanElement>>;
10
17
  export {};
@@ -1,16 +1,16 @@
1
- "use client";
2
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { forwardRef } from 'react';
3
3
  import '@inera/ids-design/components/tag/tag.css';
4
4
  import clsx from 'clsx';
5
5
 
6
- const IDSTag = ({ srCloseLabel = "", onClose, onClick, children, className, ...props }) => {
7
- const TagWrapper = !!onClick ? "button" : "span";
8
- return (jsx(TagWrapper, { className: clsx("ids-tag", {
9
- "ids-tag--clickable": !!onClick
10
- }, className), onClick: !!onClick ? onClick : undefined, ...props, children: jsxs("div", { className: "ids-tag__content", children: [children, !onClick && !!onClose && (jsx("button", { className: "ids-tag__close-btn", "aria-label": srCloseLabel, onClick: e => {
6
+ const IDSTag = forwardRef(({ srCloseLabel = "", onClose, onClick, className, children, ...props }, ref) => {
7
+ const isClickable = !!onClick;
8
+ const TagWrapper = isClickable ? "button" : "span";
9
+ return (jsx(TagWrapper, { ref: ref, ...props, className: clsx("ids-tag", { "ids-tag--clickable": isClickable }, className), onClick: isClickable ? onClick : undefined, children: jsxs("div", { className: "ids-tag__content", children: [children, !isClickable && !!onClose && (jsx("button", { type: "button", className: "ids-tag__close-btn", "aria-label": srCloseLabel, onClick: e => {
11
10
  e.stopPropagation();
12
11
  onClose?.();
13
12
  } }))] }) }));
14
- };
13
+ });
14
+ IDSTag.displayName = "IDSTag";
15
15
 
16
16
  export { IDSTag };
@@ -3,6 +3,7 @@ import "@inera/ids-design/components/tooltip/tooltip.css";
3
3
  export type TooltipPosition = "top-left" | "top" | "top-right" | "bottom-left" | "bottom" | "bottom-right";
4
4
  interface IDSTooltipProps extends React.HTMLAttributes<HTMLDivElement> {
5
5
  position?: TooltipPosition;
6
+ maxWidth?: string;
6
7
  trigger: ReactNode;
7
8
  children?: ReactNode;
8
9
  }
@@ -5,7 +5,7 @@ import '@inera/ids-design/components/tooltip/tooltip.css';
5
5
  import { useElementId } from '../utils/hooks/useElementId.js';
6
6
  import clsx from 'clsx';
7
7
 
8
- const IDSTooltip = ({ position = "top", trigger, children, className, ...props }) => {
8
+ const IDSTooltip = ({ position = "top", maxWidth = "20rem", trigger, children, className, ...props }) => {
9
9
  const [translateX, setTranslateX] = useState(position === "top" || position === "bottom" ? "-50%" : "0");
10
10
  const [translateY, setTranslateY] = useState(position.includes("top") ? "-100%" : "100%");
11
11
  const tooltipContentRef = useRef(null);
@@ -19,9 +19,11 @@ const IDSTooltip = ({ position = "top", trigger, children, className, ...props }
19
19
  };
20
20
  const handleOverflow = () => {
21
21
  const tooltipContent = tooltipContentRef.current;
22
- if (!tooltipContent)
22
+ const trigger = triggerRef.current;
23
+ if (!tooltipContent || !trigger)
23
24
  return;
24
25
  const rect = tooltipContent.getBoundingClientRect();
26
+ const triggerHeight = trigger.getBoundingClientRect().height;
25
27
  const vw = window.innerWidth;
26
28
  const vh = window.innerHeight;
27
29
  if (rect.right > vw) {
@@ -35,10 +37,10 @@ const IDSTooltip = ({ position = "top", trigger, children, className, ...props }
35
37
  setTranslateX("0");
36
38
  }
37
39
  if (rect.bottom > vh) {
38
- setTranslateY("-100%");
40
+ setTranslateY(`-${triggerHeight + 16}px`);
39
41
  }
40
42
  if (rect.top < 0) {
41
- setTranslateY("100%");
43
+ setTranslateY(`${triggerHeight + 16}px`);
42
44
  }
43
45
  };
44
46
  const checkKey = (e) => {
@@ -53,8 +55,7 @@ const IDSTooltip = ({ position = "top", trigger, children, className, ...props }
53
55
  tooltipContent.setAttribute("role", "tooltip");
54
56
  const focusable = getFirstFocusableContent();
55
57
  if (focusable) {
56
- if (triggerRef.current?.querySelector('[class^="ids-icon-"]') ||
57
- triggerRef.current?.querySelector("ids-icon")) {
58
+ if (triggerRef.current?.querySelector('[class^="ids-icon-"]') || triggerRef.current?.querySelector("ids-icon")) {
58
59
  focusable.setAttribute("role", "img");
59
60
  focusable.setAttribute("aria-labelledby", tooltipId);
60
61
  }
@@ -76,7 +77,7 @@ const IDSTooltip = ({ position = "top", trigger, children, className, ...props }
76
77
  triggerWrapper.removeEventListener("focusin", handleOverflow);
77
78
  };
78
79
  }, [triggerRef]);
79
- return (jsxs("span", { className: clsx("ids-tooltip", className), ...props, children: [jsx("span", { className: "ids-tooltip__trigger", ref: triggerRef, children: trigger }), jsx("span", { className: clsx("ids-tooltip__content", `ids-tooltip__content--${position}`), ref: tooltipContentRef, id: tooltipId, style: { transform: `translate(${translateX}, ${translateY})` }, children: children })] }));
80
+ return (jsxs("span", { className: clsx("ids-tooltip", className), ...props, children: [jsx("span", { className: "ids-tooltip__trigger", ref: triggerRef, children: trigger }), jsx("span", { className: clsx("ids-tooltip__content", `ids-tooltip__content--${position}`), ref: tooltipContentRef, id: tooltipId, style: { transform: `translate(${translateX}, ${translateY})`, maxWidth }, children: children })] }));
80
81
  };
81
82
 
82
83
  export { IDSTooltip };
@@ -8,7 +8,8 @@ function useFocusTrap(container, active) {
8
8
  "a[href]",
9
9
  "button:not([disabled])",
10
10
  "textarea:not([disabled])",
11
- "input:not([disabled])",
11
+ "input:not([disabled]):not([type='radio'])",
12
+ ".ids-focus-anchor",
12
13
  "select:not([disabled])",
13
14
  '[tabindex]:not([tabindex="-1"])'
14
15
  ];
package/index.d.ts CHANGED
@@ -30,6 +30,8 @@ export * from "./components/tabs/tab";
30
30
  export * from "./components/tabs/tab-panel";
31
31
  export * from "./components/puff-list/puff-list";
32
32
  export * from "./components/puff-list/puff-list-item/puff-list-item";
33
+ export * from "./components/puff-list/puff-list-item/puff-list-item-date";
34
+ export * from "./components/puff-list/puff-list-item/puff-list-item-header";
33
35
  export * from "./components/puff-list/puff-list-item/puff-list-item-info";
34
36
  export * from "./components/date-label/date-label";
35
37
  export * from "./components/breadcrumbs/breadcrumbs";
package/index.js CHANGED
@@ -30,6 +30,8 @@ export { IDSTab } from './components/tabs/tab.js';
30
30
  export { IDSTabPanel } from './components/tabs/tab-panel.js';
31
31
  export { IDSPuffList } from './components/puff-list/puff-list.js';
32
32
  export { IDSPuffListItem } from './components/puff-list/puff-list-item/puff-list-item.js';
33
+ export { IDSPuffListItemDate } from './components/puff-list/puff-list-item/puff-list-item-date.js';
34
+ export { IDSPuffListItemHeader } from './components/puff-list/puff-list-item/puff-list-item-header.js';
33
35
  export { IDSPuffListItemInfo } from './components/puff-list/puff-list-item/puff-list-item-info.js';
34
36
  export { IDSDateLabel } from './components/date-label/date-label.js';
35
37
  export { IDSBreadcrumbs } from './components/breadcrumbs/breadcrumbs.js';
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@inera/ids-react",
3
- "version": "8.0.0",
3
+ "version": "8.1.0",
4
4
  "type": "module",
5
5
  "peerDependencies": {
6
6
  "react": "*"
7
7
  },
8
8
  "dependencies": {
9
- "@inera/ids-design": "8.0.x",
9
+ "@inera/ids-design": "8.1.x",
10
10
  "clsx": "*"
11
11
  },
12
12
  "types": "index.d.ts",