@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,16 +1,55 @@
1
- import * as React from 'react';
2
- import '@inera/ids-core/components/side-menu/register.js';
3
- import { IDSSideMenu as IDSSideMenu$1 } from '@inera/ids-core/components/side-menu/side-menu-element.js';
4
- import { createComponent } from '@lit-labs/react';
1
+ "use client";
2
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
+ import React__default, { useState } from 'react';
4
+ import '@inera/ids-design/components/side-menu/side-menu.css';
5
+ import clsx from 'clsx';
5
6
 
6
- const IDSSideMenu = createComponent({
7
- tagName: 'ids-side-menu',
8
- elementClass: IDSSideMenu$1,
9
- react: React,
10
- events: {
11
- onClosed: 'closed',
12
- onOpened: 'opened'
13
- }
14
- });
7
+ const IDSSideMenu = ({ label = "", srToggleText = "Sektion", expanded = false, active = false, level = 1, icon = "", labelNotification, link, children, className, onExpandedChange }) => {
8
+ const [isExpanded, setIsExpanded] = useState(expanded);
9
+ const hasChildren = React__default.Children.toArray(children).some(child => React__default.isValidElement(child) && child.type === IDSSideMenu);
10
+ const toggleExpanded = (e) => {
11
+ e.stopPropagation();
12
+ if (hasChildren) {
13
+ const newExpanded = !isExpanded;
14
+ setIsExpanded(newExpanded);
15
+ onExpandedChange?.(newExpanded);
16
+ }
17
+ };
18
+ const handleKeyDown = (e) => {
19
+ if (e.code !== "Escape") {
20
+ e.stopPropagation();
21
+ }
22
+ if (e.code === "Space" || e.code === "Enter") {
23
+ e.preventDefault(); // ✅ Prevent browser from also firing `click`
24
+ toggleExpanded(e);
25
+ }
26
+ };
27
+ const renderExpandButton = () => {
28
+ if (hasChildren) {
29
+ return (jsx("button", { className: clsx("ids-side-menu__chevron-button", {
30
+ "ids-side-menu__chevron-button--expanded": isExpanded
31
+ }), onClick: toggleExpanded, onKeyDown: handleKeyDown, "aria-expanded": isExpanded, "aria-label": srToggleText }));
32
+ }
33
+ return icon ? (jsx("div", { className: "ids-side-menu__leaf-icon", children: jsx("span", { className: `ids-icon-${icon}` }) })) : (jsx("div", { className: "ids-side-menu__leaf-icon--empty" }));
34
+ };
35
+ const renderLabel = () => {
36
+ if (hasChildren) {
37
+ return (jsxs("button", { className: "ids-side-menu__label-button", onClick: toggleExpanded, onKeyDown: handleKeyDown, "aria-expanded": isExpanded, "aria-label": srToggleText, children: [jsx("div", { className: clsx("ids-side-menu__label-chevron", {
38
+ "ids-side-menu__label-chevron--expanded": isExpanded
39
+ }) }), jsxs("div", { className: "ids-side-menu__label", children: [label, labelNotification] })] }));
40
+ }
41
+ return (jsxs(Fragment, { children: [icon ? (jsx("div", { className: "ids-side-menu__leaf-icon", children: jsx("span", { className: `ids-icon-${icon}` }) })) : (jsx("div", { className: "ids-side-menu__leaf-icon--empty" })), jsxs("div", { className: "ids-side-menu__label", children: [jsx("span", { className: "ids-side-menu__label-text", children: label }), labelNotification] })] }));
42
+ };
43
+ const renderMenuPost = () => {
44
+ if (label) {
45
+ return renderLabel();
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 })] }));
48
+ };
49
+ return (jsxs("div", { className: clsx("ids-side-menu", className), children: [jsx("div", { className: clsx("ids-side-menu__header", `ids-side-menu--level-${level}`, {
50
+ "ids-side-menu--active": active,
51
+ "ids-side-menu--node-label": hasChildren && label
52
+ }), children: jsx("div", { className: "ids-side-menu__header-inner", children: renderMenuPost() }) }), isExpanded && jsx("div", { className: "ids-side-menu__children", children: children })] }));
53
+ };
15
54
 
16
55
  export { IDSSideMenu };
@@ -1,6 +1,21 @@
1
- import '@inera/ids-core/components/side-panel/register.js';
2
- import { IDSSidePanel as SidePanel } from '@inera/ids-core/components/side-panel/side-panel-element.js';
3
- export declare const IDSSidePanel: import("@lit-labs/react").ReactWebComponent<SidePanel, {
4
- onClosed: string;
5
- onOpened: string;
6
- }>;
1
+ import React, { ReactNode } from "react";
2
+ import "@inera/ids-design/components/side-panel/side-panel.css";
3
+ interface IDSSidePanelProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ show?: boolean;
5
+ left?: boolean;
6
+ elevated?: boolean;
7
+ menu?: boolean;
8
+ footer?: boolean;
9
+ srLabel?: string;
10
+ srClose?: string;
11
+ srOpen?: string;
12
+ onVisibilityChange?: (visible: boolean) => void;
13
+ onOpen?: () => void;
14
+ onClose?: () => void;
15
+ footerLinks?: ReactNode;
16
+ footerText?: ReactNode;
17
+ headline?: ReactNode;
18
+ children?: ReactNode;
19
+ }
20
+ export declare const IDSSidePanel: React.FC<IDSSidePanelProps>;
21
+ export {};
@@ -1,16 +1,77 @@
1
- import * as React from 'react';
2
- import '@inera/ids-core/components/side-panel/register.js';
3
- import { IDSSidePanel as IDSSidePanel$1 } from '@inera/ids-core/components/side-panel/side-panel-element.js';
4
- import { createComponent } from '@lit-labs/react';
1
+ "use client";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { useState, useRef, useEffect } from 'react';
4
+ import '@inera/ids-design/components/side-panel/side-panel.css';
5
+ import clsx from 'clsx';
5
6
 
6
- const IDSSidePanel = createComponent({
7
- tagName: 'ids-side-panel',
8
- elementClass: IDSSidePanel$1,
9
- react: React,
10
- events: {
11
- onClosed: 'closed',
12
- onOpened: 'opened'
13
- }
14
- });
7
+ const IDSSidePanel = ({ show = false, left = false, elevated = false, menu = false, footer = false, srLabel = "Sidopanel", srClose = "Stäng", srOpen = "Öppna", onVisibilityChange, onOpen, onClose, footerLinks, footerText, headline, className, children, ...props }) => {
8
+ const [isVisible, setIsVisible] = useState(show);
9
+ const hamburgerRef = useRef(null);
10
+ const panelRef = useRef(null);
11
+ const classNames = clsx("ids-side-panel", "ids-focus-trap--tablet", menu ? "ids-side-panel--menu" : "ids-side-panel--regular", {
12
+ "ids-side-panel--show": isVisible,
13
+ "ids-side-panel--elevated": elevated,
14
+ "ids-side-panel--left": !menu && left
15
+ }, className);
16
+ useEffect(() => {
17
+ const handleResize = () => {
18
+ if (panelRef.current) {
19
+ if (window.innerWidth <= 1024) {
20
+ panelRef.current.setAttribute("role", "dialog");
21
+ panelRef.current.setAttribute("aria-modal", "true");
22
+ panelRef.current.setAttribute("aria-label", srLabel);
23
+ }
24
+ else {
25
+ panelRef.current.removeAttribute("role");
26
+ panelRef.current.removeAttribute("aria-modal");
27
+ panelRef.current.removeAttribute("aria-label");
28
+ }
29
+ }
30
+ };
31
+ handleResize();
32
+ window.addEventListener("resize", handleResize);
33
+ return () => window.removeEventListener("resize", handleResize);
34
+ }, []);
35
+ useEffect(() => {
36
+ setIsVisible(show);
37
+ }, [show]);
38
+ useEffect(() => {
39
+ const handleKeyDown = (e) => {
40
+ if (e.key === "Escape" && isVisible) {
41
+ setIsVisible(false);
42
+ }
43
+ };
44
+ window.addEventListener("keydown", handleKeyDown);
45
+ return () => window.removeEventListener("keydown", handleKeyDown);
46
+ }, [isVisible]);
47
+ useEffect(() => {
48
+ onVisibilityChange?.(isVisible);
49
+ if (isVisible) {
50
+ onOpen?.();
51
+ // Set focus to headline if available
52
+ const headlineSlot = panelRef.current?.querySelector("[slot=headline]");
53
+ headlineSlot?.focus();
54
+ }
55
+ else {
56
+ onClose?.();
57
+ if (menu && hamburgerRef.current) {
58
+ hamburgerRef.current.focus();
59
+ }
60
+ }
61
+ }, [isVisible]);
62
+ const togglePanel = () => setIsVisible(prev => !prev);
63
+ const closePanel = () => setIsVisible(false);
64
+ const renderButton = () => {
65
+ return menu ? (jsx("button", { "aria-label": isVisible ? srClose : srOpen, className: "ids-side-panel__hamburger", id: "js-hamburger", "aria-expanded": isVisible, onClick: togglePanel, ref: hamburgerRef, children: jsx("div", { className: "ids-hamburger", children: jsx("div", { className: "ids-hamburger__lines" }) }) })) : (jsx("button", { "aria-label": srClose, "aria-expanded": isVisible, className: "ids-side-panel__close-button", onClick: closePanel }));
66
+ };
67
+ const renderFooter = () => {
68
+ if (menu && footer) {
69
+ return (jsxs("footer", { className: "ids-side-panel__footer", children: [footerLinks && jsx("div", { className: "ids-side-panel__footer-links", children: footerLinks }), jsx("div", { className: "ids-side-panel__footer-text", children: footerText })] }));
70
+ }
71
+ return null;
72
+ };
73
+ const renderContent = () => (jsxs("div", { className: "ids-side-panel__content", tabIndex: 0, children: [jsxs("div", { className: "ids-side-panel__inner", children: [headline, children] }), renderFooter()] }));
74
+ return (jsx("div", { className: classNames, ref: panelRef, ...props, children: jsxs("div", { className: "ids-side-panel__panel", children: [jsx("div", { className: "ids-side-panel__actions", children: renderButton() }), renderContent()] }) }));
75
+ };
15
76
 
16
77
  export { IDSSidePanel };
@@ -0,0 +1,18 @@
1
+ import React, { ReactNode } from "react";
2
+ import "@inera/ids-design/components/stepper/stepper.css";
3
+ export type StepState = "" | "valid" | "invalid" | "selected";
4
+ export interface IDSStepProps extends React.HTMLAttributes<HTMLDivElement> {
5
+ state?: StepState;
6
+ headline?: ReactNode;
7
+ label?: string;
8
+ stepNumber?: string;
9
+ srIndicatorText?: string;
10
+ last?: string;
11
+ expanded?: boolean;
12
+ disabled?: boolean;
13
+ onToggleExpansion?: (step: number, expanded: boolean) => void;
14
+ onExpanded?: () => void;
15
+ onClosed?: () => void;
16
+ children?: ReactNode;
17
+ }
18
+ export declare const IDSStep: React.FC<IDSStepProps>;
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useState, useEffect } from 'react';
4
+ import '@inera/ids-design/components/stepper/stepper.css';
5
+ import clsx from 'clsx';
6
+
7
+ const IDSStep = ({ state = "", headline, label = "", stepNumber = "", srIndicatorText = "", last = "false", expanded: expandedProp = false, disabled = false, onToggleExpansion, onExpanded, onClosed, className, children }) => {
8
+ const [expanded, setExpanded] = useState(expandedProp);
9
+ useEffect(() => {
10
+ setExpanded(expandedProp);
11
+ }, [expandedProp]);
12
+ useEffect(() => {
13
+ onToggleExpansion?.(Number(stepNumber), expanded);
14
+ expanded ? onExpanded?.() : onClosed?.();
15
+ }, [expanded]);
16
+ const toggleExpansion = () => {
17
+ if (!disabled) {
18
+ setExpanded(prev => !prev);
19
+ }
20
+ };
21
+ const handleKeyPress = (e) => {
22
+ if (e.key === "Enter" || e.key === " ") {
23
+ e.preventDefault();
24
+ toggleExpansion();
25
+ }
26
+ };
27
+ const renderStepIndicator = () => {
28
+ if (state === "valid" || state === "invalid")
29
+ return null;
30
+ return stepNumber;
31
+ };
32
+ return (jsxs("div", { className: clsx("ids-step", className), ...(last ? { last } : {}), children: [jsx("div", { role: "button", tabIndex: disabled ? -1 : 0, className: clsx("ids-step__button", {
33
+ "ids-step__button--disabled": disabled
34
+ }), "aria-expanded": expanded, onClick: toggleExpansion, onKeyDown: handleKeyPress, children: jsxs("div", { className: "ids-step__button-inner", children: [jsx("div", { className: "ids-step__indicator-wrapper", children: jsx("div", { "aria-label": srIndicatorText || stepNumber, role: "img", className: `ids-step__indicator ids-step__indicator--${state}`, children: renderStepIndicator() }) }), jsxs("div", { className: "ids-step__button-text", children: [jsxs("div", { className: "ids-step__headline-label", children: [label && jsx("div", { className: "ids-step__label", children: label }), headline && jsx("div", { className: "ids-step__headline", children: headline })] }), jsx("div", { className: clsx("ids-step__chevron", {
35
+ "ids-step__chevron--expanded": expanded
36
+ }) })] })] }) }), jsx("div", { className: clsx("ids-step__content", {
37
+ "ids-step__content--expanded": expanded
38
+ }), children: children })] }));
39
+ };
40
+
41
+ export { IDSStep };
@@ -1,7 +1,9 @@
1
- import '@inera/ids-core/components/stepper/register.js';
2
- import { IDSStepper as Stepper } from '@inera/ids-core/components/stepper/stepper-element.js';
3
- import { IDSStep as Step } from '@inera/ids-core/components/stepper/step/step-element.js';
4
- export declare const IDSStepper: import("@lit-labs/react").ReactWebComponent<Stepper, {
5
- onDidToggleExpansion: string;
6
- }>;
7
- export declare const IDSStep: import("@lit-labs/react").ReactWebComponent<Step, {}>;
1
+ import React, { ReactElement } from "react";
2
+ import { IDSStepProps } from "./step";
3
+ import "@inera/ids-design/components/stepper/stepper.css";
4
+ interface IDSStepperProps extends React.HTMLAttributes<HTMLDivElement> {
5
+ children: ReactElement<IDSStepProps>[] | ReactElement<IDSStepProps>;
6
+ onToggleExpansion?: (step: number, expanded: boolean) => void;
7
+ }
8
+ export declare const IDSStepper: React.FC<IDSStepperProps>;
9
+ export {};
@@ -1,21 +1,23 @@
1
- import * as React from 'react';
2
- import { createComponent } from '@lit-labs/react';
3
- import '@inera/ids-core/components/stepper/register.js';
4
- import { IDSStepper as IDSStepper$1 } from '@inera/ids-core/components/stepper/stepper-element.js';
5
- import { IDSStep as IDSStep$1 } from '@inera/ids-core/components/stepper/step/step-element.js';
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import React__default, { isValidElement, cloneElement } from 'react';
4
+ import '@inera/ids-design/components/stepper/stepper.css';
5
+ import clsx from 'clsx';
6
6
 
7
- const IDSStepper = createComponent({
8
- tagName: 'ids-stepper',
9
- elementClass: IDSStepper$1,
10
- react: React,
11
- events: {
12
- onDidToggleExpansion: 'didToggleExpansion'
13
- }
14
- });
15
- const IDSStep = createComponent({
16
- tagName: 'ids-step',
17
- elementClass: IDSStep$1,
18
- react: React
19
- });
7
+ const IDSStepper = ({ children, onToggleExpansion, className }) => {
8
+ const stepsArray = React__default.Children.toArray(children).filter(isValidElement);
9
+ const handleExpansion = (step, expanded) => {
10
+ onToggleExpansion?.(step, expanded);
11
+ };
12
+ const enhancedSteps = stepsArray.map((step, index) => {
13
+ return cloneElement(step, {
14
+ key: `step-key-${index}`,
15
+ stepNumber: `${index + 1}`,
16
+ last: index === stepsArray.length - 1 ? "true" : "false",
17
+ onToggleExpansion: handleExpansion
18
+ });
19
+ });
20
+ return jsx("div", { className: clsx("ids-stepper", className), children: enhancedSteps });
21
+ };
20
22
 
21
- export { IDSStep, IDSStepper };
23
+ export { IDSStepper };
@@ -0,0 +1,11 @@
1
+ import React, { ReactNode } from "react";
2
+ import "@inera/ids-design/components/tabs/tab-panel.css";
3
+ export interface IDSTabPanelProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ compact?: boolean;
5
+ noFocus?: boolean;
6
+ selected?: boolean;
7
+ children?: ReactNode;
8
+ id?: string;
9
+ tabId?: string;
10
+ }
11
+ export declare const IDSTabPanel: React.FC<IDSTabPanelProps>;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useRef, useEffect } from 'react';
4
+ import '@inera/ids-design/components/tabs/tab-panel.css';
5
+ import clsx from 'clsx';
6
+
7
+ const IDSTabPanel = ({ compact = false, noFocus = false, selected = false, id = "", tabId = "", children, className }) => {
8
+ const panelRef = useRef(null);
9
+ useEffect(() => {
10
+ if (panelRef.current && !noFocus) {
11
+ panelRef.current.setAttribute("tabindex", "0");
12
+ }
13
+ }, [noFocus]);
14
+ return (jsx("div", { ref: panelRef, role: "tabpanel", id: id, "aria-hidden": !selected, "aria-labelledby": tabId, hidden: !selected, className: clsx("ids-tab-panel", {
15
+ "ids-tab-panel--selected": selected,
16
+ "ids-tab-panel--compact": compact
17
+ }, className), children: children }));
18
+ };
19
+
20
+ export { IDSTabPanel };
@@ -0,0 +1,15 @@
1
+ import React, { ReactNode, KeyboardEvent } from "react";
2
+ import "@inera/ids-design/components/tabs/tab.css";
3
+ export interface IDSTabProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ notices?: number;
5
+ label: string;
6
+ index?: string;
7
+ id?: string;
8
+ panelId?: string;
9
+ icon?: string;
10
+ selected?: boolean;
11
+ notification?: ReactNode;
12
+ onTabClick?: (index: string) => void;
13
+ onKeyDown?: (e: KeyboardEvent) => void;
14
+ }
15
+ export declare const IDSTab: React.FC<IDSTabProps>;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { useRef } from 'react';
4
+ import '@inera/ids-design/components/tabs/tab.css';
5
+ import clsx from 'clsx';
6
+
7
+ const IDSTab = ({ label, index, id = "", panelId = "", selected = false, icon = "", notification, className, onTabClick, onKeyDown }) => {
8
+ const tabRef = useRef(null);
9
+ const handleClick = () => {
10
+ if (!selected) {
11
+ onTabClick?.(index);
12
+ }
13
+ };
14
+ return (jsx("div", { id: id, ref: tabRef, role: "tab", tabIndex: 0, onClick: handleClick, onKeyDown: onKeyDown, className: clsx("ids-tab", {
15
+ "ids-tab--selected": selected
16
+ }, className), "aria-selected": selected, "aria-controls": panelId, children: jsxs("div", { className: "ids-tab__label", children: [icon && jsx("span", { className: `ids-icon-${icon} ids-icon--m` }), label, notification] }) }));
17
+ };
18
+
19
+ export { IDSTab };
@@ -1,9 +1,14 @@
1
- import '@inera/ids-core/components/tabs/register.js';
2
- import { IDSTabs as Tabs } from '@inera/ids-core/components/tabs/tabs-element.js';
3
- import { IDSTab as Tab } from '@inera/ids-core/components/tabs/tab/tab-element.js';
4
- import { IDSTabPanel as TabPanel } from '@inera/ids-core/components/tabs/panel/tab-panel-element.js';
5
- export declare const IDSTabs: import("@lit-labs/react").ReactWebComponent<Tabs, {
6
- onTabChange: string;
7
- }>;
8
- export declare const IDSTab: import("@lit-labs/react").ReactWebComponent<Tab, {}>;
9
- export declare const IDSTabPanel: import("@lit-labs/react").ReactWebComponent<TabPanel, {}>;
1
+ import React, { ReactNode, ReactElement } from "react";
2
+ import "@inera/ids-design/components/tabs/tabs.css";
3
+ import { IDSTabProps } from "./tab";
4
+ interface IDSTabsProps extends React.HTMLAttributes<HTMLDivElement> {
5
+ unresponsive?: boolean;
6
+ compact?: boolean;
7
+ breakpoint?: "m" | "s";
8
+ selectLabel?: string;
9
+ tabs?: ReactElement<IDSTabProps>[];
10
+ children?: ReactNode;
11
+ onTabChange?: (index: number) => void;
12
+ }
13
+ export declare const IDSTabs: React.FC<IDSTabsProps>;
14
+ export {};
@@ -1,27 +1,81 @@
1
- import * as React from 'react';
2
- import '@inera/ids-core/components/tabs/register.js';
3
- import { IDSTabs as IDSTabs$1 } from '@inera/ids-core/components/tabs/tabs-element.js';
4
- import { IDSTab as IDSTab$1 } from '@inera/ids-core/components/tabs/tab/tab-element.js';
5
- import { IDSTabPanel as IDSTabPanel$1 } from '@inera/ids-core/components/tabs/panel/tab-panel-element.js';
6
- import { createComponent } from '@lit-labs/react';
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import React__default, { useState } from 'react';
4
+ import { IDSSelect } from '../form/select/select.js';
5
+ import '@inera/ids-design/components/tabs/tabs.css';
6
+ import { useElementId } from '../utils/hooks/useElementId.js';
7
+ import clsx from 'clsx';
7
8
 
8
- const IDSTabs = createComponent({
9
- tagName: 'ids-tabs',
10
- elementClass: IDSTabs$1,
11
- react: React,
12
- events: {
13
- onTabChange: 'tabChange'
14
- }
15
- });
16
- const IDSTab = createComponent({
17
- tagName: 'ids-tab',
18
- elementClass: IDSTab$1,
19
- react: React
20
- });
21
- const IDSTabPanel = createComponent({
22
- tagName: 'ids-tab-panel',
23
- elementClass: IDSTabPanel$1,
24
- react: React
25
- });
9
+ const IDSTabs = ({ unresponsive = false, compact = false, breakpoint = "m", selectLabel = "", tabs = [], children, className, onTabChange }) => {
10
+ const tabsId = useElementId();
11
+ const initialSelectedIndex = tabs.findIndex(tab => React__default.isValidElement(tab) && tab.props.selected === true);
12
+ const [activeTab, setActiveTab] = useState(initialSelectedIndex !== -1 ? initialSelectedIndex : 0);
13
+ const responsiveOnM = breakpoint === "m" && !unresponsive;
14
+ const responsiveOnS = breakpoint === "s" && !unresponsive;
15
+ const handleSelect = (index) => {
16
+ setActiveTab(index);
17
+ onTabChange?.(index);
18
+ };
19
+ const handleKeydown = (e, index) => {
20
+ if (e.key === "Enter" || e.key === " ") {
21
+ e.preventDefault();
22
+ handleSelect(index);
23
+ }
24
+ else if (e.key === "ArrowLeft" && index > 0) {
25
+ e.preventDefault();
26
+ document.getElementById(getTabId(index - 1))?.focus();
27
+ }
28
+ else if (e.key === "ArrowRight" && index < tabs.length - 1) {
29
+ e.preventDefault();
30
+ document.getElementById(getTabId(index + 1))?.focus();
31
+ }
32
+ };
33
+ const getTabId = (index) => {
34
+ return `${tabsId}-tab-${index}`;
35
+ };
36
+ const getTabPanelId = (index) => {
37
+ return `${tabsId}-tab-panel-${index}`;
38
+ };
39
+ const enhancedTabs = React__default.Children.map(tabs, (tab, idx) => {
40
+ if (!React__default.isValidElement(tab))
41
+ return tab;
42
+ return React__default.cloneElement(tab, {
43
+ key: `tab-key-${idx}`,
44
+ id: getTabId(idx),
45
+ panelId: getTabPanelId(idx),
46
+ index: `${idx}`,
47
+ label: tab.props.label,
48
+ selected: activeTab === idx,
49
+ onTabClick: () => handleSelect(idx),
50
+ onKeyDown: (e) => handleKeydown(e, idx)
51
+ });
52
+ });
53
+ const enhancedTabPanels = React__default.Children.map(children, (panel, idx) => {
54
+ if (!React__default.isValidElement(panel))
55
+ return panel;
56
+ return React__default.cloneElement(panel, {
57
+ key: `tab-panel-key-${idx}`,
58
+ id: getTabPanelId(idx),
59
+ tabId: getTabId(idx),
60
+ role: "tabpanel",
61
+ hidden: activeTab !== idx,
62
+ selected: activeTab === idx,
63
+ compact
64
+ });
65
+ });
66
+ const tabChangedFromSelect = (e) => {
67
+ const index = Number(e.target.value);
68
+ handleSelect(index);
69
+ };
70
+ const renderTabOptions = () => tabs?.map((tab, i) => {
71
+ const label = React__default.isValidElement(tab) ? tab.props.label || `Tab ${i + 1}` : `Tab ${i + 1}`;
72
+ return (jsx("option", { value: i, children: label }, i));
73
+ });
74
+ return (jsxs("div", { className: clsx("ids-tabs", {
75
+ "ids-tabs--unresponsive": unresponsive,
76
+ "ids-tabs--responsive-on-m": responsiveOnM,
77
+ "ids-tabs--responsive-on-s": responsiveOnS
78
+ }, className), children: [jsx("div", { className: "ids-tabs__select", children: jsx(IDSSelect, { label: selectLabel, onChange: tabChangedFromSelect, value: activeTab, children: renderTabOptions() }) }), jsx("div", { className: "ids-tabs__tabs", role: "tablist", children: enhancedTabs }), jsx("div", { className: "ids-tabs__panels", children: enhancedTabPanels })] }));
79
+ };
26
80
 
27
- export { IDSTab, IDSTabPanel, IDSTabs };
81
+ export { IDSTabs };
@@ -1,11 +1,10 @@
1
- import React from "react";
1
+ import React, { ReactNode } from "react";
2
2
  import "@inera/ids-design/components/tag/tag.css";
3
- type IDSTagProps = {
4
- closeable?: boolean;
3
+ interface IDSTagProps extends React.HTMLAttributes<HTMLButtonElement> {
5
4
  srCloseLabel?: string;
6
5
  onClose?: () => void;
7
- children?: React.ReactNode;
8
- clickable?: React.ReactElement<any>;
9
- };
6
+ onClick?: () => void;
7
+ children?: ReactNode;
8
+ }
10
9
  export declare const IDSTag: React.FC<IDSTagProps>;
11
10
  export {};
@@ -1,16 +1,16 @@
1
1
  "use client";
2
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
- import React__default from 'react';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
3
  import '@inera/ids-design/components/tag/tag.css';
4
+ import clsx from 'clsx';
5
5
 
6
- const IDSTag = ({ closeable = false, srCloseLabel = "", onClose, children, clickable }) => {
7
- return (jsx(Fragment, { children: clickable ? (React__default.cloneElement(clickable, {
8
- className: `${clickable.props.className || ""} ids-tag ids-tag--clickable`
9
- })) : (jsxs("span", { className: `${clickable ? "" : "ids-tag"}`, children: [jsx("div", { className: "ids-tag__content", children: children }), closeable && !clickable && (jsx("button", { className: "ids-tag__close-btn", "aria-label": srCloseLabel, onClick: e => {
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 => {
10
11
  e.stopPropagation();
11
- if (onClose)
12
- onClose();
13
- } }))] })) }));
12
+ onClose?.();
13
+ } }))] }) }));
14
14
  };
15
15
 
16
16
  export { IDSTag };
@@ -1,3 +1,10 @@
1
- import '@inera/ids-core/components/tooltip/register.js';
2
- import { IDSTooltip as Tooltip } from '@inera/ids-core/components/tooltip/tooltip-element.js';
3
- export declare const IDSTooltip: import("@lit-labs/react").ReactWebComponent<Tooltip, {}>;
1
+ import React, { ReactNode } from "react";
2
+ import "@inera/ids-design/components/tooltip/tooltip.css";
3
+ export type TooltipPosition = "top-left" | "top" | "top-right" | "bottom-left" | "bottom" | "bottom-right";
4
+ interface IDSTooltipProps extends React.HTMLAttributes<HTMLDivElement> {
5
+ position?: TooltipPosition;
6
+ trigger: ReactNode;
7
+ children?: ReactNode;
8
+ }
9
+ export declare const IDSTooltip: React.FC<IDSTooltipProps>;
10
+ export {};