@inera/ids-react 6.2.0 → 7.0.1

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 (219) hide show
  1. package/components/accordion/accordion.d.ts +1 -1
  2. package/components/accordion/accordion.js +6 -7
  3. package/components/agent/agent.d.ts +1 -1
  4. package/components/agent/agent.js +2 -2
  5. package/components/alert/alert.d.ts +1 -1
  6. package/components/alert/alert.js +9 -2
  7. package/components/alert-global/alert-global.d.ts +2 -2
  8. package/components/alert-global/alert-global.js +6 -7
  9. package/components/badge/badge.d.ts +4 -3
  10. package/components/badge/badge.js +4 -3
  11. package/components/box-link/box-link.d.ts +11 -3
  12. package/components/box-link/box-link.js +9 -9
  13. package/components/breadcrumbs/breadcrumbs.d.ts +1 -1
  14. package/components/breadcrumbs/breadcrumbs.js +4 -2
  15. package/components/button/button.d.ts +23 -5
  16. package/components/button/button.js +95 -11
  17. package/components/button-group/button-group.d.ts +13 -3
  18. package/components/button-group/button-group.js +10 -9
  19. package/components/card/card.d.ts +4 -3
  20. package/components/card/card.js +16 -8
  21. package/components/carousel/carousel-item.d.ts +10 -0
  22. package/components/carousel/carousel-item.js +24 -0
  23. package/components/carousel/carousel.d.ts +11 -5
  24. package/components/carousel/carousel.js +167 -16
  25. package/components/date-label/date-label.d.ts +2 -2
  26. package/components/date-label/date-label.js +4 -40
  27. package/components/dialog/dialog.d.ts +23 -6
  28. package/components/dialog/dialog.js +75 -13
  29. package/components/dropdown/dropdown-content-link.d.ts +6 -0
  30. package/components/dropdown/dropdown-content-link.js +20 -0
  31. package/components/dropdown/dropdown.d.ts +16 -8
  32. package/components/dropdown/dropdown.js +72 -20
  33. package/components/footer-1177/footer-1177.d.ts +23 -3
  34. package/components/footer-1177/footer-1177.js +64 -9
  35. package/components/footer-1177-admin/footer-1177-admin.d.ts +21 -3
  36. package/components/footer-1177-admin/footer-1177-admin.js +63 -9
  37. package/components/footer-1177-pro/footer-1177-pro.d.ts +17 -3
  38. package/components/footer-1177-pro/footer-1177-pro.js +39 -9
  39. package/components/footer-inera/footer-inera.d.ts +23 -3
  40. package/components/footer-inera/footer-inera.js +64 -9
  41. package/components/footer-inera-admin/footer-inera-admin.d.ts +23 -3
  42. package/components/footer-inera-admin/footer-inera-admin.js +61 -9
  43. package/components/form/check-button/check-button.d.ts +7 -3
  44. package/components/form/check-button/check-button.js +12 -5
  45. package/components/form/checkbox/checkbox-group.d.ts +13 -3
  46. package/components/form/checkbox/checkbox-group.js +51 -9
  47. package/components/form/checkbox/checkbox.d.ts +17 -3
  48. package/components/form/checkbox/checkbox.js +52 -5
  49. package/components/form/error-message/error-message.d.ts +10 -0
  50. package/components/form/error-message/error-message.js +12 -0
  51. package/components/form/form-hooks/useAriaDescribedBy.d.ts +1 -0
  52. package/components/form/form-hooks/useAriaDescribedBy.js +26 -0
  53. package/components/form/form-hooks/useGroupValidity.d.ts +1 -0
  54. package/components/form/form-hooks/useGroupValidity.js +60 -0
  55. package/components/form/form-hooks/useInputValidity.d.ts +1 -0
  56. package/components/form/form-hooks/useInputValidity.js +27 -0
  57. package/components/form/input/input.d.ts +22 -3
  58. package/components/form/input/input.js +58 -8
  59. package/components/form/radio/radio-group.d.ts +13 -3
  60. package/components/form/radio/radio-group.js +28 -5
  61. package/components/form/radio/radio.d.ts +17 -3
  62. package/components/form/radio/radio.js +24 -8
  63. package/components/form/radio-button/radio-button-group.d.ts +9 -0
  64. package/components/form/radio-button/radio-button-group.js +22 -0
  65. package/components/form/radio-button/radio-button.d.ts +9 -0
  66. package/components/form/radio-button/radio-button.js +15 -0
  67. package/components/form/range/range.d.ts +16 -3
  68. package/components/form/range/range.js +30 -8
  69. package/components/form/select/select.d.ts +15 -3
  70. package/components/form/select/select.js +20 -8
  71. package/components/form/select-multiple/select-multiple.d.ts +18 -3
  72. package/components/form/select-multiple/select-multiple.js +60 -9
  73. package/components/form/spinner/spinner.d.ts +9 -3
  74. package/components/form/spinner/spinner.js +9 -9
  75. package/components/form/textarea/textarea.d.ts +18 -3
  76. package/components/form/textarea/textarea.js +27 -8
  77. package/components/form/time/time.d.ts +13 -3
  78. package/components/form/time/time.js +22 -8
  79. package/components/form/toggle/toggle.d.ts +8 -3
  80. package/components/form/toggle/toggle.js +11 -8
  81. package/components/grid/column.d.ts +16 -0
  82. package/components/grid/column.js +13 -0
  83. package/components/grid/container.d.ts +9 -0
  84. package/components/grid/container.js +24 -0
  85. package/components/grid/row.d.ts +9 -0
  86. package/components/grid/row.js +18 -0
  87. package/components/header-1177/header-1177-avatar.d.ts +10 -2
  88. package/components/header-1177/header-1177-avatar.js +30 -8
  89. package/components/header-1177/header-1177-item.d.ts +12 -2
  90. package/components/header-1177/header-1177-item.js +25 -8
  91. package/components/header-1177/header-1177-menu-mobile.d.ts +11 -0
  92. package/components/header-1177/header-1177-menu-mobile.js +42 -0
  93. package/components/header-1177/header-1177-nav-item-mobile.d.ts +11 -2
  94. package/components/header-1177/header-1177-nav-item-mobile.js +24 -8
  95. package/components/header-1177/header-1177-nav-item.d.ts +15 -2
  96. package/components/header-1177/header-1177-nav-item.js +22 -8
  97. package/components/header-1177/header-1177-nav.d.ts +8 -2
  98. package/components/header-1177/header-1177-nav.js +14 -8
  99. package/components/header-1177/header-1177.d.ts +22 -5
  100. package/components/header-1177/header-1177.js +41 -12
  101. package/components/header-1177-admin/header-1177-admin-avatar-mobile.d.ts +9 -2
  102. package/components/header-1177-admin/header-1177-admin-avatar-mobile.js +6 -8
  103. package/components/header-1177-admin/header-1177-admin-avatar.d.ts +10 -2
  104. package/components/header-1177-admin/header-1177-admin-avatar.js +31 -8
  105. package/components/header-1177-admin/header-1177-admin-item.d.ts +12 -2
  106. package/components/header-1177-admin/header-1177-admin-item.js +26 -8
  107. package/components/header-1177-admin/header-1177-admin-nav-item.d.ts +15 -2
  108. package/components/header-1177-admin/header-1177-admin-nav-item.js +24 -8
  109. package/components/header-1177-admin/header-1177-admin-nav.d.ts +7 -2
  110. package/components/header-1177-admin/header-1177-admin-nav.js +12 -8
  111. package/components/header-1177-admin/header-1177-admin.d.ts +22 -3
  112. package/components/header-1177-admin/header-1177-admin.js +26 -9
  113. package/components/header-1177-pro/header-1177-pro-avatar-mobile.d.ts +9 -2
  114. package/components/header-1177-pro/header-1177-pro-avatar-mobile.js +6 -8
  115. package/components/header-1177-pro/header-1177-pro-avatar.d.ts +10 -2
  116. package/components/header-1177-pro/header-1177-pro-avatar.js +31 -8
  117. package/components/header-1177-pro/header-1177-pro-item.d.ts +12 -2
  118. package/components/header-1177-pro/header-1177-pro-item.js +23 -8
  119. package/components/header-1177-pro/header-1177-pro-nav-item.d.ts +15 -2
  120. package/components/header-1177-pro/header-1177-pro-nav-item.js +33 -8
  121. package/components/header-1177-pro/header-1177-pro-nav-menu-mobile.d.ts +11 -5
  122. package/components/header-1177-pro/header-1177-pro-nav-menu-mobile.js +32 -12
  123. package/components/header-1177-pro/header-1177-pro-nav.d.ts +10 -2
  124. package/components/header-1177-pro/header-1177-pro-nav.js +27 -8
  125. package/components/header-1177-pro/header-1177-pro.d.ts +23 -5
  126. package/components/header-1177-pro/header-1177-pro.js +37 -12
  127. package/components/header-inera/header-inera-item.d.ts +13 -2
  128. package/components/header-inera/header-inera-item.js +24 -8
  129. package/components/header-inera/header-inera-nav-item.d.ts +15 -2
  130. package/components/header-inera/header-inera-nav-item.js +54 -8
  131. package/components/header-inera/header-inera-nav-mobile.d.ts +11 -5
  132. package/components/header-inera/header-inera-nav-mobile.js +44 -12
  133. package/components/header-inera/header-inera-nav.d.ts +7 -2
  134. package/components/header-inera/header-inera-nav.js +13 -8
  135. package/components/header-inera/header-inera.d.ts +16 -3
  136. package/components/header-inera/header-inera.js +16 -9
  137. package/components/header-inera-admin/header-inera-admin-avatar-mobile.d.ts +9 -2
  138. package/components/header-inera-admin/header-inera-admin-avatar-mobile.js +11 -8
  139. package/components/header-inera-admin/header-inera-admin-avatar.d.ts +12 -2
  140. package/components/header-inera-admin/header-inera-admin-avatar.js +32 -8
  141. package/components/header-inera-admin/header-inera-admin-item.d.ts +13 -2
  142. package/components/header-inera-admin/header-inera-admin-item.js +24 -8
  143. package/components/header-inera-admin/header-inera-admin-nav-item.d.ts +16 -2
  144. package/components/header-inera-admin/header-inera-admin-nav-item.js +54 -8
  145. package/components/header-inera-admin/header-inera-admin-nav-mobile.d.ts +12 -5
  146. package/components/header-inera-admin/header-inera-admin-nav-mobile.js +32 -12
  147. package/components/header-inera-admin/header-inera-admin-nav.d.ts +8 -2
  148. package/components/header-inera-admin/header-inera-admin-nav.js +13 -8
  149. package/components/header-inera-admin/header-inera-admin.d.ts +15 -3
  150. package/components/header-inera-admin/header-inera-admin.js +24 -9
  151. package/components/header-patient/header-patient.d.ts +13 -0
  152. package/components/header-patient/header-patient.js +21 -0
  153. package/components/link/link.d.ts +17 -3
  154. package/components/link/link.js +42 -9
  155. package/components/mobile/menu/item/mobile-item.d.ts +15 -4
  156. package/components/mobile/menu/item/mobile-item.js +58 -11
  157. package/components/mobile/menu/mobile-menu.d.ts +7 -3
  158. package/components/mobile/menu/mobile-menu.js +9 -9
  159. package/components/navigation/content/navigation-content.d.ts +7 -3
  160. package/components/navigation/content/navigation-content.js +18 -9
  161. package/components/navigation/local/navigation-local.d.ts +7 -3
  162. package/components/navigation/local/navigation-local.js +6 -9
  163. package/components/notification/badge/notification-badge.d.ts +4 -2
  164. package/components/notification/badge/notification-badge.js +4 -3
  165. package/components/pagination/data-pagination/data-pagination.d.ts +24 -3
  166. package/components/pagination/data-pagination/data-pagination.js +14 -9
  167. package/components/pagination/list-pagination/list-pagination.d.ts +19 -7
  168. package/components/pagination/list-pagination/list-pagination.js +51 -14
  169. package/components/popover/popover.d.ts +20 -5
  170. package/components/popover/popover.js +192 -16
  171. package/components/progressbar/progressbar.d.ts +1 -1
  172. package/components/progressbar/progressbar.js +4 -2
  173. package/components/puff-list/puff-list-item/puff-list-item-info.d.ts +7 -0
  174. package/components/puff-list/puff-list-item/puff-list-item-info.js +8 -0
  175. package/components/puff-list/puff-list-item/puff-list-item.d.ts +19 -3
  176. package/components/puff-list/puff-list-item/puff-list-item.js +56 -9
  177. package/components/puff-list/puff-list.d.ts +7 -3
  178. package/components/puff-list/puff-list.js +6 -9
  179. package/components/region-icon/region-icon.d.ts +12 -0
  180. package/components/region-icon/region-icon.js +25 -0
  181. package/components/side-menu/side-menu.d.ts +16 -6
  182. package/components/side-menu/side-menu.js +52 -13
  183. package/components/side-panel/side-panel.d.ts +21 -6
  184. package/components/side-panel/side-panel.js +74 -13
  185. package/components/stepper/step.d.ts +18 -0
  186. package/components/stepper/step.js +41 -0
  187. package/components/stepper/stepper.d.ts +9 -7
  188. package/components/stepper/stepper.js +21 -19
  189. package/components/tabs/tab-panel.d.ts +11 -0
  190. package/components/tabs/tab-panel.js +20 -0
  191. package/components/tabs/tab.d.ts +15 -0
  192. package/components/tabs/tab.js +19 -0
  193. package/components/tabs/tabs.d.ts +14 -9
  194. package/components/tabs/tabs.js +79 -25
  195. package/components/tag/tag.d.ts +5 -6
  196. package/components/tag/tag.js +9 -9
  197. package/components/tooltip/tooltip.d.ts +10 -3
  198. package/components/tooltip/tooltip.js +79 -9
  199. package/components/utils/contexts/HeaderContext.d.ts +9 -0
  200. package/components/utils/contexts/HeaderContext.js +7 -0
  201. package/components/utils/hooks/useElementId.d.ts +5 -0
  202. package/components/utils/hooks/useElementId.js +12 -0
  203. package/components/utils/hooks/useFocusTrap.d.ts +1 -0
  204. package/components/utils/hooks/useFocusTrap.js +44 -0
  205. package/components/utils/utils.d.ts +6 -0
  206. package/components/utils/utils.js +44 -0
  207. package/index.d.ts +15 -5
  208. package/index.js +20 -10
  209. package/package.json +2 -2
  210. package/components/form/errormessage/error-message.d.ts +0 -3
  211. package/components/form/errormessage/error-message.js +0 -12
  212. package/components/grid/grid.d.ts +0 -9
  213. package/components/grid/grid.js +0 -26
  214. package/components/header-1177/header-1177-nav-menu-mobile.d.ts +0 -5
  215. package/components/header-1177/header-1177-nav-menu-mobile.js +0 -15
  216. package/components/icon-region/icon-region.d.ts +0 -3
  217. package/components/icon-region/icon-region.js +0 -12
  218. package/components/puff-list/puff-list-item/puff-list-info/puff-list-item-info.d.ts +0 -3
  219. package/components/puff-list/puff-list-item/puff-list-info/puff-list-item-info.js +0 -12
@@ -1,8 +1,9 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import '@inera/ids-design/components/notification-badge/notification-badge.css';
3
+ import clsx from 'clsx';
3
4
 
4
- const IDSNotificationBadge = ({ outlined = false, children }) => {
5
- return (jsx("div", { className: "ids-notification-badge" + (outlined ? " ids-notification-badge--outlined" : ""), children: children }));
5
+ const IDSNotificationBadge = ({ type = "primary", icon = "", onClick, children, className, ...props }) => {
6
+ return (jsxs("div", { className: clsx("ids-notification-badge", `ids-notification-badge--${type}`, className), onClick: onClick, ...props, children: [icon && jsx("span", { className: `ids-icon-${icon}` }), children] }));
6
7
  };
7
8
 
8
9
  export { IDSNotificationBadge };
@@ -1,3 +1,24 @@
1
- import "@inera/ids-core/components/pagination/data-pagination/register.js";
2
- import { IDSDataPagination as DataPagination } from "@inera/ids-core/components/pagination/data-pagination/data-pagination-element.js";
3
- export declare const IDSDataPagination: import("@lit-labs/react").ReactWebComponent<DataPagination, {}>;
1
+ import React, { ReactNode } from "react";
2
+ import "@inera/ids-design/components/pagination/data-pagination/data-pagination.css";
3
+ export interface IDSDataPaginationProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ label?: string;
5
+ from: number;
6
+ to: number;
7
+ of?: string;
8
+ total: number;
9
+ defaultValue?: string;
10
+ selectId?: string;
11
+ prevId?: string;
12
+ nextId?: string;
13
+ light?: boolean;
14
+ noSelect?: boolean;
15
+ prevDisabled?: boolean;
16
+ nextDisabled?: boolean;
17
+ srPrevious?: string;
18
+ srNext?: string;
19
+ onNext?: (event: React.MouseEvent<HTMLButtonElement>) => void;
20
+ onPrevious?: (event: React.MouseEvent<HTMLButtonElement>) => void;
21
+ onSelectChange?: (event: React.ChangeEvent<HTMLSelectElement>) => void;
22
+ children?: ReactNode;
23
+ }
24
+ export declare const IDSDataPagination: React.FC<IDSDataPaginationProps>;
@@ -1,12 +1,17 @@
1
- import * as React from 'react';
2
- import '@inera/ids-core/components/pagination/data-pagination/register.js';
3
- import { IDSDataPagination as IDSDataPagination$1 } from '@inera/ids-core/components/pagination/data-pagination/data-pagination-element.js';
4
- import { createComponent } from '@lit-labs/react';
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useRef } from 'react';
4
+ import '@inera/ids-design/components/pagination/data-pagination/data-pagination.css';
5
+ import clsx from 'clsx';
6
+ import { useElementId } from '../../utils/hooks/useElementId.js';
5
7
 
6
- const IDSDataPagination = createComponent({
7
- tagName: "ids-data-pagination",
8
- elementClass: IDSDataPagination$1,
9
- react: React,
10
- });
8
+ const IDSDataPagination = ({ label = "Rader per sida", from, to, of = "av", total, defaultValue = "", selectId = "", prevId = "", nextId = "", light = false, noSelect = false, prevDisabled = false, nextDisabled = false, srPrevious = "Föregående sida", srNext = "Nästa sida", onNext, onPrevious, onSelectChange, className, children }) => {
9
+ const summaryText = `${from} - ${to} ${of} ${total}`;
10
+ const selectElementId = useElementId(selectId);
11
+ const prevRef = useRef(null);
12
+ const nextRef = useRef(null);
13
+ const selectRef = useRef(null);
14
+ return (jsxs("div", { className: clsx("ids-data-pagination", { "ids-data-pagination--light": light }, className), children: [!noSelect && (jsxs("div", { className: "ids-data-pagination__select", children: [jsx("label", { slot: "pagination-select", htmlFor: selectElementId, children: label }), jsx("select", { id: selectElementId, ref: selectRef, name: "data-pagination-select-options", defaultValue: defaultValue, onChange: onSelectChange, children: children })] })), jsx("div", { className: "ids-data-pagination__summary", children: summaryText }), jsxs("div", { className: "ids-data-pagination__buttons", children: [jsx("div", { className: "ids-data-pagination__prev-button", children: jsx("button", { ref: prevRef, "aria-label": srPrevious, disabled: prevDisabled, id: prevId, onClick: onPrevious }) }), jsx("div", { className: "ids-data-pagination__next-button", children: jsx("button", { ref: nextRef, "aria-label": srNext, disabled: nextDisabled, id: nextId, onClick: onNext }) })] })] }));
15
+ };
11
16
 
12
17
  export { IDSDataPagination };
@@ -1,7 +1,19 @@
1
- import "@inera/ids-core/components/pagination/list-pagination/register.js";
2
- import { IDSListPagination as ListPagination } from "@inera/ids-core/components/pagination/list-pagination/list-pagination-element.js";
3
- export declare const IDSListPagination: import("@lit-labs/react").ReactWebComponent<ListPagination, {
4
- onChangePage: string;
5
- onPrevPage: string;
6
- onNextPage: string;
7
- }>;
1
+ import React from "react";
2
+ import "@inera/ids-design/components/pagination/list-pagination/list-pagination.css";
3
+ export interface IDSListPaginationProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ showing?: string;
5
+ from?: number;
6
+ to?: number;
7
+ of?: string;
8
+ total?: number;
9
+ current?: number;
10
+ pages?: number;
11
+ srCurrentPage?: string;
12
+ srGoToPage?: string;
13
+ srPrevious?: string;
14
+ srNext?: string;
15
+ onChangePage?: (page: number) => void;
16
+ onPrevPage?: (page: number) => void;
17
+ onNextPage?: (page: number) => void;
18
+ }
19
+ export declare const IDSListPagination: React.FC<IDSListPaginationProps>;
@@ -1,17 +1,54 @@
1
- import * as React from 'react';
2
- import '@inera/ids-core/components/pagination/list-pagination/register.js';
3
- import { IDSListPagination as IDSListPagination$1 } from '@inera/ids-core/components/pagination/list-pagination/list-pagination-element.js';
4
- import { createComponent } from '@lit-labs/react';
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import '@inera/ids-design/components/pagination/list-pagination/list-pagination.css';
4
+ import clsx from 'clsx';
5
5
 
6
- const IDSListPagination = createComponent({
7
- tagName: "ids-list-pagination",
8
- elementClass: IDSListPagination$1,
9
- react: React,
10
- events: {
11
- onChangePage: 'changepage',
12
- onPrevPage: 'prevpage',
13
- onNextPage: 'nextpage'
14
- }
15
- });
6
+ const IDSListPagination = ({ showing = "Visar", from = 0, to = 0, of = "av", total = 0, current = 1, pages = 1, srCurrentPage = "Aktuell sida", srGoToPage = "Gå till sida", srPrevious = "Föregående sida", srNext = "Nästa sida", className, onChangePage, onPrevPage, onNextPage }) => {
7
+ const renderSummary = () => {
8
+ if (from && to && total) {
9
+ return (jsx("div", { className: "ids-list-pagination__summary", children: `${showing} ${from} - ${to} ${of} ${total}` }));
10
+ }
11
+ return null;
12
+ };
13
+ const renderPrevButton = () => {
14
+ if (current > 1) {
15
+ return (jsx("button", { "aria-label": srPrevious, onClick: () => onPrevPage?.(current - 1), id: "prev-button" }));
16
+ }
17
+ return null;
18
+ };
19
+ const renderNextButton = () => {
20
+ if (current < pages) {
21
+ return (jsx("button", { "aria-label": srNext, onClick: () => onNextPage?.(current + 1), id: "next-button" }));
22
+ }
23
+ return null;
24
+ };
25
+ const renderButtons = () => {
26
+ const buttonArray = [];
27
+ for (let i = 1; i <= pages; i++) {
28
+ const isCurrent = i === current;
29
+ buttonArray.push(jsx("li", { className: clsx("ids-list-pagination__list-item", {
30
+ "ids-list-pagination__list-item--current": isCurrent
31
+ }), hidden: pages > 7 &&
32
+ ![
33
+ 1,
34
+ pages,
35
+ current - 1,
36
+ current,
37
+ current + 1,
38
+ ...(current < 4 ? [2, 3, 4] : []),
39
+ ...(current > pages - 3 ? [pages - 1, pages - 2, pages - 3] : [])
40
+ ].includes(i), "data-hidden-before": pages > 7 &&
41
+ i > 1 &&
42
+ buttonArray[i - 2]?.props.hidden &&
43
+ !buttonArray[i - 1]?.props.hidden
44
+ ? true
45
+ : undefined, children: jsx("button", { className: clsx("ids-list-pagination__button", {
46
+ "ids-list-pagination__button--current": isCurrent
47
+ }), "aria-label": isCurrent ? srCurrentPage : `${srGoToPage} ${i}`, onClick: () => !isCurrent && onChangePage?.(i), disabled: isCurrent, children: i }) }, i));
48
+ }
49
+ return (jsx("nav", { children: jsx("ul", { className: "ids-list-pagination__list", children: buttonArray }) }));
50
+ };
51
+ return (jsxs("div", { className: clsx("ids-list-pagination", className), children: [renderSummary(), jsxs("div", { className: "ids-list-pagination__content", children: [jsx("div", { className: "ids-list-pagination__prev-button", children: renderPrevButton() }), jsx("div", { className: "ids-list-pagination__nav-buttons", children: renderButtons() }), jsx("div", { className: "ids-list-pagination__next-button", children: renderNextButton() })] })] }));
52
+ };
16
53
 
17
54
  export { IDSListPagination };
@@ -1,5 +1,20 @@
1
- import '@inera/ids-core/components/popover/register.js';
2
- import { IDSPopover as Popover } from '@inera/ids-core/components/popover/popover-element.js';
3
- import { IDSPopoverContent as PopoverContent } from '@inera/ids-core/components/popover/content/popover-content-element.js';
4
- export declare const IDSPopover: import("@lit-labs/react").ReactWebComponent<Popover, {}>;
5
- export declare const IDSPopoverContent: import("@lit-labs/react").ReactWebComponent<PopoverContent, {}>;
1
+ import React, { ReactNode } from "react";
2
+ import "@inera/ids-design/components/popover/popover.css";
3
+ import "@inera/ids-design/components/popover/popover-content.css";
4
+ export type PopoverPosition = "top" | "top-left" | "top-right" | "right" | "right-top" | "right-bottom" | "bottom" | "bottom-left" | "bottom-right" | "left" | "left-top" | "left-bottom";
5
+ interface IDSPopoverProps extends React.HTMLAttributes<HTMLDivElement> {
6
+ position?: PopoverPosition;
7
+ category?: string;
8
+ trigger: ReactNode;
9
+ maxWidth?: number;
10
+ maxHeight?: number;
11
+ show?: boolean;
12
+ noFocusTrap?: boolean;
13
+ autoFocus?: boolean;
14
+ srCloseText?: string;
15
+ onVisibilityChange?: (isVisible: boolean) => void;
16
+ headline?: ReactNode;
17
+ children?: ReactNode;
18
+ }
19
+ export declare const IDSPopover: React.FC<IDSPopoverProps>;
20
+ export {};
@@ -1,18 +1,194 @@
1
- import * as React from 'react';
2
- import { createComponent } from '@lit-labs/react';
3
- import '@inera/ids-core/components/popover/register.js';
4
- import { IDSPopover as IDSPopover$1 } from '@inera/ids-core/components/popover/popover-element.js';
5
- import { IDSPopoverContent as IDSPopoverContent$1 } from '@inera/ids-core/components/popover/content/popover-content-element.js';
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useState, useRef, useCallback, useEffect } from 'react';
4
+ import '@inera/ids-design/components/popover/popover.css';
5
+ import '@inera/ids-design/components/popover/popover-content.css';
6
+ import { useFocusTrap } from '../utils/hooks/useFocusTrap.js';
7
+ import clsx from 'clsx';
6
8
 
7
- const IDSPopover = createComponent({
8
- tagName: 'ids-popover',
9
- elementClass: IDSPopover$1,
10
- react: React
11
- });
12
- const IDSPopoverContent = createComponent({
13
- tagName: 'ids-popover-content',
14
- elementClass: IDSPopoverContent$1,
15
- react: React
16
- });
9
+ const IDSPopover = ({ position = "bottom", category = "", trigger, maxWidth = 260, maxHeight = 260, show = false, noFocusTrap = false, autoFocus = false, srCloseText = "Stäng", headline, children, className, onVisibilityChange }) => {
10
+ const [isVisible, setIsVisible] = useState(show);
11
+ const [popoverContentStyle, setPopoverContentStyle] = useState({
12
+ position: "absolute",
13
+ maxWidth: `${maxWidth}px`,
14
+ maxHeight: `${maxHeight}px`,
15
+ boxSizing: "initial"
16
+ });
17
+ const [popoverContentWrapperStyle, setPopoverContentWrapperStyle] = useState({
18
+ height: "100%"
19
+ });
20
+ const popoverRef = useRef(null);
21
+ const triggerRef = useRef(null);
22
+ const topBarRef = useRef(null);
23
+ const contentWrapperRef = useRef(null);
24
+ const popoverContentRef = useRef(null);
25
+ useFocusTrap(popoverContentRef.current, isVisible && !noFocusTrap);
26
+ const handleVisibilityChange = (isVisible) => {
27
+ setIsVisible(isVisible);
28
+ onVisibilityChange?.(isVisible);
29
+ };
30
+ const closePopover = useCallback(() => {
31
+ handleVisibilityChange(false);
32
+ triggerRef.current?.focus();
33
+ }, []);
34
+ useEffect(() => {
35
+ const wrapper = popoverRef.current;
36
+ if (!wrapper)
37
+ return;
38
+ const observer = new MutationObserver(mutations => {
39
+ for (const mutation of mutations) {
40
+ if (mutation.type === "attributes" &&
41
+ mutation.attributeName === "data-show" &&
42
+ !wrapper.hasAttribute("data-show")) {
43
+ closePopover();
44
+ }
45
+ }
46
+ });
47
+ observer.observe(wrapper, {
48
+ attributes: true,
49
+ attributeFilter: ["data-show"]
50
+ });
51
+ return () => observer.disconnect();
52
+ }, [closePopover]);
53
+ const showPopover = useCallback(() => {
54
+ if (category) {
55
+ const others = document.querySelectorAll(`[data-popover-category="${category}"]`);
56
+ others.forEach(el => {
57
+ if (el !== popoverRef.current) {
58
+ el.removeAttribute("data-show");
59
+ }
60
+ });
61
+ }
62
+ handleVisibilityChange(true);
63
+ }, [category]);
64
+ const togglePopover = (e) => {
65
+ e.preventDefault();
66
+ isVisible ? closePopover() : showPopover();
67
+ };
68
+ const handleEsc = (e) => {
69
+ if (e.key === "Escape" && isVisible) {
70
+ closePopover();
71
+ }
72
+ };
73
+ const handleTriggerKeyDown = (e) => {
74
+ if (e.key === "Enter" || e.key === " ") {
75
+ e.preventDefault();
76
+ if (!isVisible) {
77
+ showPopover();
78
+ }
79
+ }
80
+ };
81
+ useEffect(() => {
82
+ if (isVisible && autoFocus) {
83
+ const wrapper = contentWrapperRef.current;
84
+ const focusAnchor = wrapper.querySelector(".ids-focus-anchor");
85
+ if (focusAnchor) {
86
+ focusAnchor.focus();
87
+ setTimeout(() => {
88
+ focusAnchor?.scrollIntoView({
89
+ behavior: "smooth",
90
+ block: "nearest"
91
+ });
92
+ }, 2);
93
+ }
94
+ else {
95
+ wrapper.focus();
96
+ }
97
+ }
98
+ }, [isVisible, autoFocus]);
99
+ useEffect(() => {
100
+ if (!isVisible)
101
+ return;
102
+ document.addEventListener("keydown", handleEsc);
103
+ return () => document.removeEventListener("keydown", handleEsc);
104
+ }, [isVisible]);
105
+ useEffect(() => {
106
+ if (topBarRef.current && contentWrapperRef.current) {
107
+ const topBarHeight = topBarRef.current.getBoundingClientRect().height;
108
+ const contentWrapperHeight = contentWrapperRef.current.getBoundingClientRect().height;
109
+ if (contentWrapperHeight >= maxHeight - topBarHeight) {
110
+ setPopoverContentWrapperStyle({
111
+ height: `${maxHeight - topBarHeight}px`,
112
+ paddingRight: "1rem"
113
+ });
114
+ }
115
+ else {
116
+ setPopoverContentWrapperStyle({
117
+ height: "100%",
118
+ paddingRight: "0.25rem"
119
+ });
120
+ }
121
+ }
122
+ }, [topBarRef, contentWrapperRef, isVisible]);
123
+ useEffect(() => {
124
+ const content = popoverContentRef?.current;
125
+ if (!content)
126
+ return;
127
+ const width = content.offsetWidth;
128
+ const height = content.offsetHeight;
129
+ const triggerWidth = triggerRef.current.offsetWidth;
130
+ const triggerHeight = triggerRef.current.offsetHeight;
131
+ let top, left, right, bottom;
132
+ if (position === "top") {
133
+ left = `-${width / 2 - triggerWidth / 2}px`;
134
+ bottom = `calc(100% + 0.875rem)`;
135
+ }
136
+ if (position === "top-right") {
137
+ right = "0";
138
+ bottom = `calc(100% + 0.875rem)`;
139
+ }
140
+ if (position === "top-left") {
141
+ left = "0";
142
+ bottom = `calc(100% + 0.875rem)`;
143
+ }
144
+ if (position === "right") {
145
+ left = `calc(100% + 0.875rem)`;
146
+ top = `-${height / 2 - triggerHeight / 2}px`;
147
+ }
148
+ if (position === "right-top") {
149
+ left = `calc(100% + 0.875rem)`;
150
+ bottom = "0";
151
+ }
152
+ if (position === "right-bottom") {
153
+ left = `calc(100% + 0.875rem)`;
154
+ top = "0";
155
+ }
156
+ if (position === "bottom") {
157
+ left = `-${width / 2 - triggerWidth / 2}px`;
158
+ top = `calc(100% + 0.875rem)`;
159
+ }
160
+ if (position === "bottom-right") {
161
+ right = "0";
162
+ top = `calc(100% + 0.875rem)`;
163
+ }
164
+ if (position === "bottom-left") {
165
+ left = `-8px`;
166
+ top = `calc(100% + 0.875rem)`;
167
+ }
168
+ if (position === "left") {
169
+ right = `calc(100% + 0.875rem)`;
170
+ top = `-${height / 2 - triggerHeight / 2}px`;
171
+ }
172
+ if (position === "left-top") {
173
+ right = `calc(100% + 0.875rem)`;
174
+ bottom = "0";
175
+ }
176
+ if (position === "left-bottom") {
177
+ right = `calc(100% + 0.875rem)`;
178
+ top = "0";
179
+ }
180
+ setPopoverContentStyle(prev => ({
181
+ ...prev,
182
+ top: top ?? undefined,
183
+ left: left ?? undefined,
184
+ right: right ?? undefined,
185
+ bottom: bottom ?? undefined
186
+ }));
187
+ }, [position, isVisible]);
188
+ const renderCaret = (pos) => {
189
+ return (jsxs("div", { className: `ids-popover-content__caret ids-popover-content--${pos}`, children: [jsx("span", { className: `ids-popover-content__caret-body ids-popover-content--${pos}` }), jsx("span", { className: `ids-popover-content__caret-border ids-popover-content--${pos}` }), jsx("span", { className: `ids-popover-content__caret-shadow ids-popover-content--${pos}` })] }));
190
+ };
191
+ return (jsxs("span", { className: clsx("ids-popover", className), ref: popoverRef, "data-popover-category": category, ...(isVisible ? { "data-show": "true" } : {}), children: [jsx("span", { className: "ids-popover-trigger", onClick: togglePopover, onKeyDown: handleTriggerKeyDown, ref: triggerRef, children: trigger }), isVisible && (jsxs("div", { className: `ids-popover-content ${!noFocusTrap && "ids-focus-trap"}`, ref: popoverContentRef, style: popoverContentStyle, "data-position": position, children: [renderCaret(position), jsxs("div", { className: "ids-popover-content__top-bar", ref: topBarRef, children: [jsx("div", { className: "ids-popover-content__headline", children: headline }), jsx("div", { className: "ids-popover-content__close-btn-wrapper", children: jsx("button", { "aria-label": srCloseText, className: "ids-popover-content__close-btn", onClick: closePopover }) })] }), jsx("div", { className: "ids-popover-content__content-wrapper", tabIndex: 0, ref: contentWrapperRef, style: popoverContentWrapperStyle, children: jsx("div", { className: "ids-popover-content__content-wrapper-inner", children: children }) })] }))] }));
192
+ };
17
193
 
18
- export { IDSPopover, IDSPopoverContent };
194
+ export { IDSPopover };
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import "@inera/ids-design/components/progressbar/progressbar.css";
3
- interface IDSProgressbarProps {
3
+ interface IDSProgressbarProps extends React.HTMLAttributes<HTMLDivElement> {
4
4
  label: string;
5
5
  hideLabel?: boolean;
6
6
  value?: number;
@@ -1,8 +1,10 @@
1
+ "use client";
1
2
  import { jsxs, jsx } from 'react/jsx-runtime';
2
3
  import '@inera/ids-design/components/progressbar/progressbar.css';
4
+ import clsx from 'clsx';
3
5
 
4
- const IDSProgressbar = ({ label = "", hideLabel = false, value = 0, srLabel = "" }) => {
5
- return (jsxs("div", { className: "ids-progressbar", children: [hideLabel ? null : (jsxs("div", { className: "ids-progressbar__label", children: [label && 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 })] }));
6
+ const IDSProgressbar = ({ label = "", hideLabel = false, value = 0, srLabel = "", className }) => {
7
+ return (jsxs("div", { className: clsx("ids-progressbar", className), 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 })] }));
6
8
  };
7
9
 
8
10
  export { IDSProgressbar };
@@ -0,0 +1,7 @@
1
+ import React, { ReactNode } from "react";
2
+ import "@inera/ids-design/components/puff-list/puff-list.css";
3
+ interface IDSPuffListItemInfoProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ children?: ReactNode;
5
+ }
6
+ export declare const IDSPuffListItemInfo: React.FC<IDSPuffListItemInfoProps>;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import '@inera/ids-design/components/puff-list/puff-list.css';
3
+
4
+ const IDSPuffListItemInfo = ({ children }) => {
5
+ return jsx("div", { className: "ids-puff-list-item__info", children: children });
6
+ };
7
+
8
+ export { IDSPuffListItemInfo };
@@ -1,3 +1,19 @@
1
- import '@inera/ids-core/components/puff-list/register.js';
2
- import { IDSPuffListItem as PuffListItem } from '@inera/ids-core/components/puff-list/puff-list-item/puff-list-item-element.js';
3
- export declare const IDSPuffListItem: import("@lit-labs/react").ReactWebComponent<PuffListItem, {}>;
1
+ import React, { ReactNode } from "react";
2
+ import "@inera/ids-design/components/puff-list/puff-list.css";
3
+ interface IDSPuffListItemProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ headline?: ReactNode;
5
+ headlineLink?: React.ReactElement;
6
+ itemLink?: React.ReactElement;
7
+ date?: Date | null;
8
+ year?: string;
9
+ month?: number;
10
+ monthLabel?: string;
11
+ day?: number;
12
+ time?: string;
13
+ noContent?: boolean;
14
+ noMargin?: boolean;
15
+ dateLabel?: ReactNode;
16
+ children?: ReactNode;
17
+ }
18
+ export declare const IDSPuffListItem: React.FC<IDSPuffListItemProps>;
19
+ export {};
@@ -1,12 +1,59 @@
1
- import * as React from 'react';
2
- import '@inera/ids-core/components/puff-list/register.js';
3
- import { IDSPuffListItem as IDSPuffListItem$1 } from '@inera/ids-core/components/puff-list/puff-list-item/puff-list-item-element.js';
4
- import { createComponent } from '@lit-labs/react';
1
+ "use client";
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { useState, useEffect, isValidElement, cloneElement } from 'react';
4
+ import '@inera/ids-design/components/puff-list/puff-list.css';
5
+ import { getMonthAsSweText, getDayAsText } from '../../utils/utils.js';
6
+ import clsx from 'clsx';
5
7
 
6
- const IDSPuffListItem = createComponent({
7
- tagName: 'ids-puff-list-item',
8
- elementClass: IDSPuffListItem$1,
9
- react: React,
10
- });
8
+ const IDSPuffListItem = ({ headline = "", headlineLink, itemLink, date = null, year = "", month = -1, monthLabel = "", day = -1, time = "", noContent = false, noMargin = false, dateLabel, className, children }) => {
9
+ const [presentedDate, setPresentedDate] = useState(date);
10
+ useEffect(() => {
11
+ if (date) {
12
+ setPresentedDate(new Date(date));
13
+ }
14
+ }, [date]);
15
+ const hasDate = () => date || year || month !== -1 || day !== -1;
16
+ const getYear = () => presentedDate?.getFullYear() || year;
17
+ const getMonth = () => (presentedDate ? presentedDate.getMonth() + 1 : month);
18
+ const getMonthText = () => (monthLabel ? monthLabel : getMonthAsSweText(getMonth() - 1, 3));
19
+ const getDay = () => getDayAsText(presentedDate?.getDate() || day);
20
+ const getTime = () => {
21
+ if (time)
22
+ return time;
23
+ if (presentedDate) {
24
+ const hour = presentedDate.getHours();
25
+ const min = presentedDate.getMinutes();
26
+ return `${hour.toString().padStart(2, "0")}:${min.toString().padStart(2, "0")}`;
27
+ }
28
+ return "";
29
+ };
30
+ const getHeaderClass = (noMargin) => clsx("ids-puff-list-item__header", {
31
+ "ids-puff-list-item--no-margin": noMargin
32
+ });
33
+ const renderHeadline = () => {
34
+ const headlineContent = jsx(Fragment, { children: headline });
35
+ if (headlineLink && isValidElement(headlineLink)) {
36
+ return (jsx("h2", { className: getHeaderClass(noMargin), children: cloneElement(headlineLink, {
37
+ ...headlineLink.props,
38
+ children: headlineContent
39
+ }) }));
40
+ }
41
+ return jsx("h2", { className: getHeaderClass(noMargin), children: headline });
42
+ };
43
+ const renderBody = () => {
44
+ const content = (jsxs(Fragment, { children: [renderHeadline(), !noContent && jsx("div", { className: "ids-puff-list-item__body", children: children })] }));
45
+ if (itemLink && isValidElement(itemLink)) {
46
+ return cloneElement(itemLink, {
47
+ ...itemLink.props,
48
+ className: clsx("ids-puff-list-item__item-link", itemLink.props.className),
49
+ children: content
50
+ });
51
+ }
52
+ return content;
53
+ };
54
+ return (jsx("li", { className: clsx("ids-puff-list-item", {
55
+ "ids-puff-list-item--interactive": !!itemLink
56
+ }, className), 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("div", { className: "ids-puff-list-item__date", children: [`${getDay()} ${getMonthText()} ${getYear()}`, !!getTime() && jsx("span", { className: "ids-puff-list-item__time", children: getTime() })] })), renderBody()] })] }) }));
57
+ };
11
58
 
12
59
  export { IDSPuffListItem };
@@ -1,3 +1,7 @@
1
- import '@inera/ids-core/components/puff-list/register.js';
2
- import { IDSPuffList as PuffList } from '@inera/ids-core/components/puff-list/puff-list-element.js';
3
- export declare const IDSPuffList: import("@lit-labs/react").ReactWebComponent<PuffList, {}>;
1
+ import React, { ReactNode } from "react";
2
+ import "@inera/ids-design/components/puff-list/puff-list.css";
3
+ interface IDSPuffListProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ children?: ReactNode;
5
+ }
6
+ export declare const IDSPuffList: React.FC<IDSPuffListProps>;
7
+ export {};
@@ -1,12 +1,9 @@
1
- import * as React from 'react';
2
- import '@inera/ids-core/components/puff-list/register.js';
3
- import { IDSPuffList as IDSPuffList$1 } from '@inera/ids-core/components/puff-list/puff-list-element.js';
4
- import { createComponent } from '@lit-labs/react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import '@inera/ids-design/components/puff-list/puff-list.css';
3
+ import clsx from 'clsx';
5
4
 
6
- const IDSPuffList = createComponent({
7
- tagName: 'ids-puff-list',
8
- elementClass: IDSPuffList$1,
9
- react: React,
10
- });
5
+ const IDSPuffList = ({ children, className }) => {
6
+ return jsx("ul", { className: clsx("ids-puff-list", className), children: children });
7
+ };
11
8
 
12
9
  export { IDSPuffList };
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import "@inera/ids-design/components/region-icon/region-icon.css";
3
+ type Size = "xs" | "s" | "m" | "l" | "ml";
4
+ interface IDSRegionIconProps extends React.HTMLAttributes<HTMLSpanElement> {
5
+ name: string;
6
+ size?: Size;
7
+ colorPreset?: number;
8
+ light?: boolean;
9
+ inline?: boolean;
10
+ }
11
+ export declare const IDSRegionIcon: React.FC<IDSRegionIconProps>;
12
+ export {};
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import '@inera/ids-design/components/region-icon/region-icon.css';
4
+ import clsx from 'clsx';
5
+
6
+ const IDSRegionIcon = ({ name, size = "m", colorPreset = 1, light = false, inline = false, className, ...props }) => {
7
+ const getSize = () => {
8
+ switch (size) {
9
+ case "l":
10
+ return "3rem";
11
+ case "m":
12
+ return "2.5rem";
13
+ case "s":
14
+ return "2.0rem";
15
+ case "xs":
16
+ return "1.5rem";
17
+ default:
18
+ return "2.5rem";
19
+ }
20
+ };
21
+ const classNames = clsx("ids-region-icon", `ids-region-icon--${name}`, `ids-region-icon--color-preset-${light ? 4 : colorPreset}`, { "ids-region-icon--inline": inline }, className);
22
+ return jsx("span", { className: classNames, style: { fontSize: getSize() }, ...props });
23
+ };
24
+
25
+ export { IDSRegionIcon };
@@ -1,6 +1,16 @@
1
- import '@inera/ids-core/components/side-menu/register.js';
2
- import { IDSSideMenu as SideMenu } from '@inera/ids-core/components/side-menu/side-menu-element.js';
3
- export declare const IDSSideMenu: import("@lit-labs/react").ReactWebComponent<SideMenu, {
4
- onClosed: string;
5
- onOpened: string;
6
- }>;
1
+ import React, { ReactNode } from "react";
2
+ import "@inera/ids-design/components/side-menu/side-menu.css";
3
+ interface IDSSideMenuProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ label?: string;
5
+ srToggleText?: string;
6
+ expanded?: boolean;
7
+ active?: boolean;
8
+ level?: number;
9
+ icon?: string;
10
+ labelNotification?: ReactNode;
11
+ link?: ReactNode;
12
+ children?: ReactNode;
13
+ onExpandedChange?: (expanded: boolean) => void;
14
+ }
15
+ export declare const IDSSideMenu: React.FC<IDSSideMenuProps>;
16
+ export {};