@dbcdk/react-components 0.0.4 → 0.0.5

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 (223) hide show
  1. package/dist/assets/logo.cjs +10 -10
  2. package/dist/assets/logo.js +10 -10
  3. package/dist/components/__stories__/story-components/Colors.cjs +159 -0
  4. package/dist/components/__stories__/story-components/Colors.d.ts +10 -0
  5. package/dist/components/__stories__/story-components/Colors.js +151 -0
  6. package/dist/components/__stories__/story-components/Colors.module.css +27 -0
  7. package/dist/components/__stories__/story-components/Spacing.cjs +190 -0
  8. package/dist/components/__stories__/story-components/Spacing.d.ts +1 -0
  9. package/dist/components/__stories__/story-components/Spacing.js +184 -0
  10. package/dist/components/__stories__/story-components/Spacing.module.css +154 -0
  11. package/dist/components/app-header/AppHeader.module.css +10 -15
  12. package/dist/components/attribute-chip/AttributeChip.cjs +22 -0
  13. package/dist/components/attribute-chip/AttributeChip.d.ts +8 -0
  14. package/dist/components/attribute-chip/AttributeChip.js +16 -0
  15. package/dist/components/attribute-chip/AttributeChip.module.css +65 -0
  16. package/dist/components/avatar/Avatar.cjs +38 -4
  17. package/dist/components/avatar/Avatar.d.ts +4 -2
  18. package/dist/components/avatar/Avatar.js +39 -5
  19. package/dist/components/avatar/Avatar.module.css +27 -0
  20. package/dist/components/breadcrumbs/Breadcrumbs.cjs +1 -2
  21. package/dist/components/breadcrumbs/Breadcrumbs.js +1 -2
  22. package/dist/components/breadcrumbs/Breadcrumbs.module.css +19 -22
  23. package/dist/components/button/Button.cjs +20 -12
  24. package/dist/components/button/Button.d.ts +4 -1
  25. package/dist/components/button/Button.js +20 -12
  26. package/dist/components/button/Button.module.css +118 -55
  27. package/dist/components/card/Card.cjs +53 -13
  28. package/dist/components/card/Card.d.ts +21 -6
  29. package/dist/components/card/Card.js +54 -14
  30. package/dist/components/card/Card.module.css +148 -44
  31. package/dist/components/card-container/CardContainer.cjs +6 -5
  32. package/dist/components/card-container/CardContainer.d.ts +5 -2
  33. package/dist/components/card-container/CardContainer.js +6 -5
  34. package/dist/components/card-container/CardContainer.module.css +40 -0
  35. package/dist/components/checkbox/Checkbox.cjs +3 -4
  36. package/dist/components/checkbox/Checkbox.d.ts +1 -1
  37. package/dist/components/checkbox/Checkbox.js +3 -4
  38. package/dist/components/checkbox/Checkbox.module.css +10 -10
  39. package/dist/components/chip/Chip.cjs +2 -1
  40. package/dist/components/chip/Chip.d.ts +2 -1
  41. package/dist/components/chip/Chip.js +2 -1
  42. package/dist/components/chip/Chip.module.css +42 -27
  43. package/dist/components/circle/Circle.module.css +11 -11
  44. package/dist/components/clear-button/ClearButton.cjs +3 -3
  45. package/dist/components/clear-button/ClearButton.js +3 -3
  46. package/dist/components/clear-button/ClearButton.module.css +8 -7
  47. package/dist/components/code-block/CodeBlock.cjs +18 -0
  48. package/dist/components/code-block/CodeBlock.d.ts +6 -0
  49. package/dist/components/code-block/CodeBlock.js +12 -0
  50. package/dist/components/code-block/CodeBlock.module.css +60 -0
  51. package/dist/components/copy-button/CopyButton.cjs +35 -0
  52. package/dist/components/copy-button/CopyButton.d.ts +9 -0
  53. package/dist/components/copy-button/CopyButton.js +29 -0
  54. package/dist/components/copy-button/CopyButton.module.css +6 -0
  55. package/dist/components/datetime-picker/DateTimePicker.cjs +504 -0
  56. package/dist/components/datetime-picker/DateTimePicker.d.ts +39 -0
  57. package/dist/components/datetime-picker/DateTimePicker.js +498 -0
  58. package/dist/components/datetime-picker/DateTimePicker.module.css +144 -0
  59. package/dist/components/filter-field/FilterField.cjs +34 -19
  60. package/dist/components/filter-field/FilterField.d.ts +2 -2
  61. package/dist/components/filter-field/FilterField.js +35 -20
  62. package/dist/components/filter-field/FilterField.module.css +14 -20
  63. package/dist/components/headline/Headline.cjs +10 -4
  64. package/dist/components/headline/Headline.d.ts +9 -1
  65. package/dist/components/headline/Headline.js +10 -4
  66. package/dist/components/headline/Headline.module.css +32 -7
  67. package/dist/components/icon/Icon.module.css +10 -9
  68. package/dist/components/input/Input.cjs +60 -19
  69. package/dist/components/input/Input.d.ts +7 -2
  70. package/dist/components/input/Input.js +60 -19
  71. package/dist/components/input/Input.module.css +90 -43
  72. package/dist/components/link/Link.cjs +46 -0
  73. package/dist/components/link/Link.d.ts +9 -0
  74. package/dist/components/link/Link.js +21 -0
  75. package/dist/components/link/Link.module.css +32 -0
  76. package/dist/components/menu/Menu.module.css +10 -32
  77. package/dist/components/meta-bar/MetaBar.cjs +29 -0
  78. package/dist/components/meta-bar/MetaBar.d.ts +11 -0
  79. package/dist/components/meta-bar/MetaBar.js +22 -0
  80. package/dist/components/meta-bar/MetaBar.module.css +12 -0
  81. package/dist/components/modal/Modal.cjs +134 -0
  82. package/dist/components/modal/Modal.d.ts +21 -0
  83. package/dist/components/modal/Modal.js +128 -0
  84. package/dist/components/modal/Modal.module.css +66 -0
  85. package/dist/components/modal/provider/ModalProvider.cjs +80 -0
  86. package/dist/components/modal/provider/ModalProvider.d.ts +21 -0
  87. package/dist/components/modal/provider/ModalProvider.js +77 -0
  88. package/dist/components/multi-select/MultiSelect.cjs +12 -1
  89. package/dist/components/multi-select/MultiSelect.js +12 -1
  90. package/dist/components/nav-bar/NavBar.module.css +11 -16
  91. package/dist/components/page/Page.module.css +2 -2
  92. package/dist/components/page-layout/PageLayout.cjs +5 -22
  93. package/dist/components/page-layout/PageLayout.d.ts +1 -8
  94. package/dist/components/page-layout/PageLayout.js +5 -22
  95. package/dist/components/page-layout/PageLayout.module.css +4 -80
  96. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.cjs +32 -0
  97. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.d.ts +11 -0
  98. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +25 -0
  99. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.module.css +84 -0
  100. package/dist/components/pagination/Pagination.cjs +83 -67
  101. package/dist/components/pagination/Pagination.d.ts +3 -1
  102. package/dist/components/pagination/Pagination.js +84 -68
  103. package/dist/components/pagination/Pagination.module.css +11 -3
  104. package/dist/components/panel/Panel.module.css +5 -7
  105. package/dist/components/popover/Popover.cjs +25 -8
  106. package/dist/components/popover/Popover.d.ts +2 -1
  107. package/dist/components/popover/Popover.js +25 -8
  108. package/dist/components/popover/Popover.module.css +4 -6
  109. package/dist/components/search-box/SearchBox.cjs +50 -37
  110. package/dist/components/search-box/SearchBox.d.ts +10 -7
  111. package/dist/components/search-box/SearchBox.js +50 -37
  112. package/dist/components/search-box/SearchBox.module.css +0 -1
  113. package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +12 -6
  114. package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +12 -6
  115. package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +5 -1
  116. package/dist/components/select/Select.cjs +82 -13
  117. package/dist/components/select/Select.d.ts +2 -1
  118. package/dist/components/select/Select.js +83 -14
  119. package/dist/components/sidebar/Sidebar.cjs +3 -30
  120. package/dist/components/sidebar/Sidebar.d.ts +2 -1
  121. package/dist/components/sidebar/Sidebar.js +4 -26
  122. package/dist/components/sidebar/components/SidebarItem.cjs +3 -1
  123. package/dist/components/sidebar/components/SidebarItem.js +3 -1
  124. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +40 -14
  125. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +3 -1
  126. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +40 -14
  127. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +9 -38
  128. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +50 -0
  129. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +8 -0
  130. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +43 -0
  131. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +155 -0
  132. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +16 -9
  133. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +2 -1
  134. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +16 -9
  135. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +25 -12
  136. package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +2 -1
  137. package/dist/components/sidebar/components/sidebar-items/SidebarItems.d.ts +1 -1
  138. package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +2 -1
  139. package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +29 -2
  140. package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +25 -2
  141. package/dist/components/sidebar/providers/SidebarProvider.cjs +108 -10
  142. package/dist/components/sidebar/providers/SidebarProvider.d.ts +7 -3
  143. package/dist/components/sidebar/providers/SidebarProvider.js +109 -11
  144. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +1 -1
  145. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +1 -1
  146. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +0 -12
  147. package/dist/components/split-pane/SplitPane.cjs +123 -0
  148. package/dist/components/split-pane/SplitPane.d.ts +34 -0
  149. package/dist/components/split-pane/SplitPane.js +114 -0
  150. package/dist/components/split-pane/SplitPane.module.css +106 -0
  151. package/dist/components/split-pane/provider/SplitPaneContext.cjs +87 -0
  152. package/dist/components/split-pane/provider/SplitPaneContext.d.ts +23 -0
  153. package/dist/components/split-pane/provider/SplitPaneContext.js +79 -0
  154. package/dist/components/table/Table.cjs +180 -112
  155. package/dist/components/table/Table.d.ts +22 -6
  156. package/dist/components/table/Table.js +181 -113
  157. package/dist/components/table/Table.module.css +74 -47
  158. package/dist/components/table/components/empty-state/EmptyState.cjs +52 -0
  159. package/dist/components/table/components/empty-state/EmptyState.d.ts +40 -0
  160. package/dist/components/table/components/empty-state/EmptyState.js +46 -0
  161. package/dist/components/table/components/empty-state/EmptyState.module.css +16 -0
  162. package/dist/components/table/components/table-settings/TableSettings.cjs +32 -0
  163. package/dist/components/table/components/table-settings/TableSettings.d.ts +7 -0
  164. package/dist/components/table/components/table-settings/TableSettings.js +30 -0
  165. package/dist/{tanstack.cjs → components/table/tanstack.cjs} +61 -99
  166. package/dist/components/table/tanstack.d.ts +14 -0
  167. package/dist/{tanstack.js → components/table/tanstack.js} +61 -99
  168. package/dist/components/tabs/Tabs.cjs +33 -17
  169. package/dist/components/tabs/Tabs.d.ts +6 -3
  170. package/dist/components/tabs/Tabs.js +33 -17
  171. package/dist/components/tabs/Tabs.module.css +9 -9
  172. package/dist/components/toast/Toast.cjs +47 -0
  173. package/dist/components/toast/Toast.d.ts +14 -0
  174. package/dist/components/toast/Toast.js +41 -0
  175. package/dist/components/toast/Toast.module.css +101 -0
  176. package/dist/components/toast/provider/ToastProvider.cjs +98 -0
  177. package/dist/components/toast/provider/ToastProvider.d.ts +23 -0
  178. package/dist/components/toast/provider/ToastProvider.js +91 -0
  179. package/dist/components/tooltip/Tooltip.cjs +134 -29
  180. package/dist/components/tooltip/Tooltip.js +135 -30
  181. package/dist/components/tooltip/Tooltip.module.css +25 -43
  182. package/dist/components/user-display/UserDisplay.module.css +2 -2
  183. package/dist/constants/severity.cjs +12 -12
  184. package/dist/constants/severity.js +12 -12
  185. package/dist/constants/sizes.cjs +1 -0
  186. package/dist/constants/sizes.d.ts +1 -1
  187. package/dist/constants/sizes.js +1 -0
  188. package/dist/hooks/usePagination.cjs +88 -0
  189. package/dist/hooks/usePagination.d.ts +33 -0
  190. package/dist/hooks/usePagination.js +86 -0
  191. package/dist/hooks/useSorting.cjs +118 -0
  192. package/dist/hooks/useSorting.d.ts +49 -0
  193. package/dist/hooks/useSorting.js +116 -0
  194. package/dist/hooks/useTableData.cjs +52 -0
  195. package/dist/hooks/useTableData.d.ts +40 -0
  196. package/dist/hooks/useTableData.js +50 -0
  197. package/dist/hooks/useTableSelection.cjs +130 -0
  198. package/dist/hooks/useTableSelection.d.ts +25 -0
  199. package/dist/hooks/useTableSelection.js +128 -0
  200. package/dist/hooks/useTableSettings.cjs +28 -0
  201. package/dist/hooks/useTableSettings.d.ts +7 -0
  202. package/dist/hooks/useTableSettings.js +26 -0
  203. package/dist/hooks/useTimeDuration.cjs +39 -0
  204. package/dist/hooks/useTimeDuration.d.ts +22 -0
  205. package/dist/hooks/useTimeDuration.js +37 -0
  206. package/dist/hooks/useViewportFill.js +1 -1
  207. package/dist/index.cjs +119 -0
  208. package/dist/index.d.ts +17 -0
  209. package/dist/index.js +17 -0
  210. package/dist/src/styles/styles.css +101 -8
  211. package/dist/styles/css-helper-classes/flex.css +97 -0
  212. package/dist/styles/css-helper-classes/typography.css +7 -0
  213. package/dist/styles/styles.css +101 -8
  214. package/dist/styles/themes/dbc/dark.css +206 -99
  215. package/dist/styles/themes/dbc/light.css +183 -89
  216. package/dist/types/sizes.types.d.ts +2 -2
  217. package/package.json +17 -11
  218. package/dist/components/data-summary/DataSummary.cjs +0 -49
  219. package/dist/components/data-summary/DataSummary.d.ts +0 -19
  220. package/dist/components/data-summary/DataSummary.js +0 -43
  221. package/dist/components/data-summary/DataSummary.module.css +0 -51
  222. package/dist/components/sidebar/Sidebar.module.css +0 -66
  223. package/dist/tanstack.d.ts +0 -25
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var react = require('react');
5
5
  var styles = require('./Tabs.module.css');
6
6
  var Headline = require('../headline/Headline');
7
+ var Chip = require('../chip/Chip');
7
8
 
8
9
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
10
 
@@ -13,33 +14,44 @@ function Tabs({
13
14
  variant,
14
15
  header,
15
16
  tabs,
16
- activeIndex = 0,
17
+ activeId,
17
18
  onTabChange,
19
+ manuallySetActiveTab,
18
20
  addition,
19
21
  panelStyle
20
22
  }) {
21
- const [currentIndex, setCurrentIndex] = react.useState(activeIndex);
23
+ var _a;
24
+ const [currentId, setCurrentId] = react.useState(activeId);
22
25
  react.useEffect(() => {
23
- if (activeIndex !== void 0) {
24
- setCurrentIndex(activeIndex);
26
+ if (activeId !== void 0) {
27
+ setCurrentId(activeId);
25
28
  }
26
- }, [activeIndex]);
29
+ }, [activeId]);
27
30
  const setActiveTab = react.useCallback(
28
- (index) => {
29
- setCurrentIndex(index);
31
+ (id) => {
32
+ setCurrentId(id);
30
33
  },
31
- [setCurrentIndex]
34
+ [setCurrentId]
32
35
  );
33
36
  const handleTabChange = react.useCallback(
34
- (index) => {
35
- if (!onTabChange) {
36
- setActiveTab(index);
37
+ (index, tab) => {
38
+ if (!manuallySetActiveTab) {
39
+ setActiveTab(tab.id);
37
40
  }
38
- onTabChange == null ? void 0 : onTabChange(index);
41
+ onTabChange == null ? void 0 : onTabChange(index, tab);
39
42
  },
40
- [onTabChange]
43
+ [onTabChange, manuallySetActiveTab, setActiveTab]
41
44
  );
42
45
  const filteredTabs = react.useMemo(() => tabs.filter((tab) => !tab.hidden), [tabs]);
46
+ const activeIndex = react.useMemo(() => {
47
+ var _a2, _b;
48
+ return (_b = filteredTabs.findIndex((tab) => tab.id === currentId)) != null ? _b : (_a2 = filteredTabs[0]) == null ? void 0 : _a2.id;
49
+ }, [currentId, filteredTabs]);
50
+ react.useEffect(() => {
51
+ if (activeIndex === -1 && filteredTabs.length > 0) {
52
+ setActiveTab(filteredTabs[0].id);
53
+ }
54
+ }, [activeIndex, filteredTabs, setActiveTab]);
43
55
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grow-container", children: [
44
56
  header && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.headerContainer, children: [
45
57
  /* @__PURE__ */ jsxRuntime.jsx(Headline.Headline, { disableMargin: true, size: 2, children: header }),
@@ -50,23 +62,27 @@ function Tabs({
50
62
  "div",
51
63
  {
52
64
  "data-index": index,
53
- className: `${styles__default.default.tab} ${currentIndex === index ? styles__default.default.active : ""}`,
65
+ className: `${styles__default.default.tab} ${activeIndex === index ? styles__default.default.active : ""}`,
54
66
  children: /* @__PURE__ */ jsxRuntime.jsxs(
55
67
  "button",
56
68
  {
57
69
  className: `${styles__default.default.tabButton}`,
58
- onClick: () => handleTabChange(index),
70
+ onClick: () => handleTabChange(index, tab),
59
71
  disabled: tab.disabled,
60
72
  children: [
61
73
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.icon, children: tab.headerIcon }),
62
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.header, children: tab.header })
74
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.header, children: tab.header }),
75
+ tab.badge !== void 0 && tab.badge > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.badge, children: [
76
+ " ",
77
+ /* @__PURE__ */ jsxRuntime.jsx(Chip.Chip, { severity: "info", size: "sm", children: tab.badge.toLocaleString("da-DK") })
78
+ ] })
63
79
  ]
64
80
  }
65
81
  )
66
82
  },
67
83
  index
68
84
  )) }),
69
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${styles__default.default.tabContent} scrollable`, children: tabs[currentIndex].content })
85
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${styles__default.default.tabContent} scrollable`, children: (_a = filteredTabs[activeIndex]) == null ? void 0 : _a.content })
70
86
  ] })
71
87
  ] });
72
88
  }
@@ -1,18 +1,21 @@
1
1
  export type TabItem = {
2
2
  header: string;
3
+ id: string | number;
3
4
  headerIcon?: React.ReactNode;
4
5
  content: React.ReactNode;
5
6
  disabled?: boolean;
6
7
  hidden?: boolean;
8
+ badge?: number;
7
9
  };
8
10
  interface TabsProps {
9
11
  header?: string;
10
12
  variant: 'filled' | 'outlined';
11
13
  panelStyle?: boolean;
12
14
  tabs: TabItem[];
13
- activeIndex?: number;
14
- onTabChange?: (index: number) => void;
15
+ activeId?: number | string;
16
+ onTabChange?: (index: number, tabItem: TabItem) => void;
17
+ manuallySetActiveTab?: boolean;
15
18
  addition?: React.ReactNode;
16
19
  }
17
- export declare function Tabs({ variant, header, tabs, activeIndex, onTabChange, addition, panelStyle, }: TabsProps): React.ReactNode;
20
+ export declare function Tabs({ variant, header, tabs, activeId, onTabChange, manuallySetActiveTab, addition, panelStyle, }: TabsProps): React.ReactNode;
18
21
  export {};
@@ -2,38 +2,50 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { useState, useEffect, useCallback, useMemo } from 'react';
3
3
  import styles from './Tabs.module.css';
4
4
  import { Headline } from '../headline/Headline';
5
+ import { Chip } from '../chip/Chip';
5
6
 
6
7
  function Tabs({
7
8
  variant,
8
9
  header,
9
10
  tabs,
10
- activeIndex = 0,
11
+ activeId,
11
12
  onTabChange,
13
+ manuallySetActiveTab,
12
14
  addition,
13
15
  panelStyle
14
16
  }) {
15
- const [currentIndex, setCurrentIndex] = useState(activeIndex);
17
+ var _a;
18
+ const [currentId, setCurrentId] = useState(activeId);
16
19
  useEffect(() => {
17
- if (activeIndex !== void 0) {
18
- setCurrentIndex(activeIndex);
20
+ if (activeId !== void 0) {
21
+ setCurrentId(activeId);
19
22
  }
20
- }, [activeIndex]);
23
+ }, [activeId]);
21
24
  const setActiveTab = useCallback(
22
- (index) => {
23
- setCurrentIndex(index);
25
+ (id) => {
26
+ setCurrentId(id);
24
27
  },
25
- [setCurrentIndex]
28
+ [setCurrentId]
26
29
  );
27
30
  const handleTabChange = useCallback(
28
- (index) => {
29
- if (!onTabChange) {
30
- setActiveTab(index);
31
+ (index, tab) => {
32
+ if (!manuallySetActiveTab) {
33
+ setActiveTab(tab.id);
31
34
  }
32
- onTabChange == null ? void 0 : onTabChange(index);
35
+ onTabChange == null ? void 0 : onTabChange(index, tab);
33
36
  },
34
- [onTabChange]
37
+ [onTabChange, manuallySetActiveTab, setActiveTab]
35
38
  );
36
39
  const filteredTabs = useMemo(() => tabs.filter((tab) => !tab.hidden), [tabs]);
40
+ const activeIndex = useMemo(() => {
41
+ var _a2, _b;
42
+ return (_b = filteredTabs.findIndex((tab) => tab.id === currentId)) != null ? _b : (_a2 = filteredTabs[0]) == null ? void 0 : _a2.id;
43
+ }, [currentId, filteredTabs]);
44
+ useEffect(() => {
45
+ if (activeIndex === -1 && filteredTabs.length > 0) {
46
+ setActiveTab(filteredTabs[0].id);
47
+ }
48
+ }, [activeIndex, filteredTabs, setActiveTab]);
37
49
  return /* @__PURE__ */ jsxs("div", { className: "grow-container", children: [
38
50
  header && /* @__PURE__ */ jsxs("div", { className: styles.headerContainer, children: [
39
51
  /* @__PURE__ */ jsx(Headline, { disableMargin: true, size: 2, children: header }),
@@ -44,23 +56,27 @@ function Tabs({
44
56
  "div",
45
57
  {
46
58
  "data-index": index,
47
- className: `${styles.tab} ${currentIndex === index ? styles.active : ""}`,
59
+ className: `${styles.tab} ${activeIndex === index ? styles.active : ""}`,
48
60
  children: /* @__PURE__ */ jsxs(
49
61
  "button",
50
62
  {
51
63
  className: `${styles.tabButton}`,
52
- onClick: () => handleTabChange(index),
64
+ onClick: () => handleTabChange(index, tab),
53
65
  disabled: tab.disabled,
54
66
  children: [
55
67
  /* @__PURE__ */ jsx("span", { className: styles.icon, children: tab.headerIcon }),
56
- /* @__PURE__ */ jsx("span", { className: styles.header, children: tab.header })
68
+ /* @__PURE__ */ jsx("span", { className: styles.header, children: tab.header }),
69
+ tab.badge !== void 0 && tab.badge > 0 && /* @__PURE__ */ jsxs("span", { className: styles.badge, children: [
70
+ " ",
71
+ /* @__PURE__ */ jsx(Chip, { severity: "info", size: "sm", children: tab.badge.toLocaleString("da-DK") })
72
+ ] })
57
73
  ]
58
74
  }
59
75
  )
60
76
  },
61
77
  index
62
78
  )) }),
63
- /* @__PURE__ */ jsx("div", { className: `${styles.tabContent} scrollable`, children: tabs[currentIndex].content })
79
+ /* @__PURE__ */ jsx("div", { className: `${styles.tabContent} scrollable`, children: (_a = filteredTabs[activeIndex]) == null ? void 0 : _a.content })
64
80
  ] })
65
81
  ] });
66
82
  }
@@ -9,7 +9,7 @@
9
9
  /* ========== Filled variant ========== */
10
10
  .tabs.filled .tab.active {
11
11
  background: var(--opac-bg-brand);
12
- color: var(--color-primary);
12
+ color: var(--color-brand);
13
13
  border: var(--border-width-thin) solid var(--opac-bg-dark);
14
14
  border-block-end: 0;
15
15
  }
@@ -23,7 +23,7 @@
23
23
  }
24
24
  .tabs.filled .tab {
25
25
  border: var(--border-width-thin) solid transparent;
26
- color: var(--color-text-muted);
26
+ color: var(--color-fg-muted);
27
27
  font-size: var(--font-size-sm);
28
28
  z-index: 3;
29
29
  transition:
@@ -33,11 +33,11 @@
33
33
  border-start-end-radius: var(--border-radius-default);
34
34
  }
35
35
  .tabs.filled .tab:not(.active):hover {
36
- color: var(--color-primary);
36
+ color: var(--color-brand);
37
37
  }
38
38
  .tabs.filled .tabContent {
39
39
  border: var(--border-width-thin) solid var(--opac-bg-dark);
40
- background: var(--color-background);
40
+ background: var(--color-bg-surface);
41
41
  padding: var(--spacing-lg);
42
42
  flex-grow: 1;
43
43
  overflow: auto;
@@ -45,7 +45,7 @@
45
45
 
46
46
  /* ========== Panel style variant ========== */
47
47
  .panelStyle .tabList {
48
- border: var(--border-width-thin) solid var(--color-border);
48
+ border: var(--border-width-thin) solid var(--color-border-default);
49
49
  border-block-end: 0;
50
50
  }
51
51
  .panelStyle .tab.active {
@@ -90,10 +90,10 @@
90
90
  display: flex;
91
91
  flex-direction: column;
92
92
  border-radius: 0;
93
- border-block-end: 2px solid var(--color-border);
93
+ border-block-end: 2px solid var(--color-border-default);
94
94
  }
95
95
  .tab.active {
96
- border-block-end-color: var(--color-primary);
96
+ border-block-end-color: var(--color-brand);
97
97
  }
98
98
 
99
99
  .tab .icon {
@@ -101,8 +101,8 @@
101
101
  color: inherit;
102
102
  }
103
103
  .tab .icon svg {
104
- inline-size: var(--icon-size);
105
- block-size: var(--icon-size);
104
+ inline-size: var(--icon-size-md);
105
+ block-size: var(--icon-size-md);
106
106
  }
107
107
 
108
108
  .headerContainer {
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var Button = require('../button/Button');
5
+ var lucideReact = require('lucide-react');
6
+ var styles = require('./Toast.module.css');
7
+ var Headline = require('../headline/Headline');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var styles__default = /*#__PURE__*/_interopDefault(styles);
12
+
13
+ function Toast({
14
+ title,
15
+ message,
16
+ severity = "info",
17
+ action,
18
+ onClose
19
+ }) {
20
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.toast} ${styles__default.default[severity]}`, role: "status", children: [
21
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.content, children: [
22
+ /* @__PURE__ */ jsxRuntime.jsx(
23
+ Headline.Headline,
24
+ {
25
+ size: 4,
26
+ severity: title ? severity : void 0,
27
+ disableMargin: true,
28
+ addition: onClose && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(
29
+ Button.Button,
30
+ {
31
+ type: "button",
32
+ variant: "inline",
33
+ "aria-label": "Dismiss notification",
34
+ onClick: onClose,
35
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: styles__default.default.closeIcon, "aria-hidden": "true" })
36
+ }
37
+ ) }),
38
+ children: title
39
+ }
40
+ ),
41
+ message && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.message, children: message })
42
+ ] }),
43
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.actions, children: action && /* @__PURE__ */ jsxRuntime.jsx(Button.Button, { type: "button", variant: "primary", onClick: action.onClick, children: action.label }) })
44
+ ] });
45
+ }
46
+
47
+ exports.Toast = Toast;
@@ -0,0 +1,14 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { Severity } from '@/constants/severity.types';
3
+ export type ToastActionConfig = {
4
+ label: string;
5
+ onClick?: () => void;
6
+ };
7
+ export type ToastProps = {
8
+ title?: ReactNode;
9
+ message?: ReactNode;
10
+ severity: Severity;
11
+ action?: ToastActionConfig;
12
+ onClose?: () => void;
13
+ };
14
+ export declare function Toast({ title, message, severity, action, onClose, }: ToastProps): React.ReactNode;
@@ -0,0 +1,41 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { Button } from '../button/Button';
3
+ import { X } from 'lucide-react';
4
+ import styles from './Toast.module.css';
5
+ import { Headline } from '../headline/Headline';
6
+
7
+ function Toast({
8
+ title,
9
+ message,
10
+ severity = "info",
11
+ action,
12
+ onClose
13
+ }) {
14
+ return /* @__PURE__ */ jsxs("div", { className: `${styles.toast} ${styles[severity]}`, role: "status", children: [
15
+ /* @__PURE__ */ jsxs("div", { className: styles.content, children: [
16
+ /* @__PURE__ */ jsx(
17
+ Headline,
18
+ {
19
+ size: 4,
20
+ severity: title ? severity : void 0,
21
+ disableMargin: true,
22
+ addition: onClose && /* @__PURE__ */ jsx("div", { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(
23
+ Button,
24
+ {
25
+ type: "button",
26
+ variant: "inline",
27
+ "aria-label": "Dismiss notification",
28
+ onClick: onClose,
29
+ children: /* @__PURE__ */ jsx(X, { className: styles.closeIcon, "aria-hidden": "true" })
30
+ }
31
+ ) }),
32
+ children: title
33
+ }
34
+ ),
35
+ message && /* @__PURE__ */ jsx("div", { className: styles.message, children: message })
36
+ ] }),
37
+ /* @__PURE__ */ jsx("div", { className: styles.actions, children: action && /* @__PURE__ */ jsx(Button, { type: "button", variant: "primary", onClick: action.onClick, children: action.label }) })
38
+ ] });
39
+ }
40
+
41
+ export { Toast };
@@ -0,0 +1,101 @@
1
+ .container {
2
+ position: fixed;
3
+ inset-inline-end: var(--spacing-lg);
4
+ inset-block-start: var(--spacing-lg);
5
+ display: flex;
6
+ flex-direction: column;
7
+ gap: var(--spacing-xs);
8
+ z-index: var(--z-toast);
9
+ min-width: 280px;
10
+ }
11
+
12
+ @media (max-width: var(--bp-sm)) {
13
+ .container {
14
+ inset-inline: var(--spacing-md);
15
+ inset-block-end: var(--spacing-md);
16
+ }
17
+ }
18
+
19
+ .toast {
20
+ display: flex;
21
+ flex-direction: column;
22
+ gap: var(--spacing-xs);
23
+ padding: var(--spacing-xs) var(--spacing-md);
24
+ border-radius: var(--border-radius-md);
25
+ box-shadow: var(--shadow-md);
26
+ background-color: var(--color-bg-surface);
27
+ border: var(--border-width-thin) solid var(--color-border-default);
28
+ font-family: var(--font-family);
29
+ max-width: 360px;
30
+ animation: toast-enter var(--transition-normal) var(--ease-standard);
31
+ border-left-width: var(--border-width-thick);
32
+ }
33
+
34
+ .info {
35
+ border-left-color: var(--color-status-info-border);
36
+ }
37
+
38
+ .success {
39
+ border-left-color: var(--color-status-success-border);
40
+ }
41
+
42
+ .warning {
43
+ border-left-color: var(--color-status-warning-border);
44
+ }
45
+
46
+ .error {
47
+ border-left-color: var(--color-status-error-border);
48
+ }
49
+
50
+ .iconContainer {
51
+ display: inline-flex;
52
+ align-items: center;
53
+ justify-content: center;
54
+ }
55
+
56
+ .icon {
57
+ width: var(--icon-size-md);
58
+ height: var(--icon-size-md);
59
+ }
60
+
61
+ .content {
62
+ flex: 1;
63
+ min-width: 0;
64
+ display: flex;
65
+ flex-direction: column;
66
+ gap: var(--spacing-xs);
67
+ }
68
+
69
+ .title {
70
+ font-size: var(--font-size-sm);
71
+ font-weight: var(--font-weight-semibold);
72
+ line-height: var(--line-height-tight);
73
+ }
74
+
75
+ .message {
76
+ font-size: var(--font-size-sm);
77
+ line-height: var(--line-height-normal);
78
+ }
79
+
80
+ .actions {
81
+ display: flex;
82
+ justify-content: flex-end;
83
+ gap: var(--spacing-xs);
84
+ }
85
+
86
+ .closeIcon {
87
+ width: var(--icon-size-sm);
88
+ height: var(--icon-size-sm);
89
+ }
90
+
91
+ /* Simple enter animation */
92
+ @keyframes toast-enter {
93
+ from {
94
+ opacity: 0;
95
+ transform: translateY(6px);
96
+ }
97
+ to {
98
+ opacity: 1;
99
+ transform: translateY(0);
100
+ }
101
+ }
@@ -0,0 +1,98 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+ var Toast = require('../Toast');
6
+ var styles = require('../Toast.module.css');
7
+
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var styles__default = /*#__PURE__*/_interopDefault(styles);
11
+
12
+ const ToastContext = react.createContext(void 0);
13
+ function ToastProvider({
14
+ children,
15
+ defaultDuration = 1e4
16
+ }) {
17
+ const [toasts, setToasts] = react.useState([]);
18
+ const timeouts = react.useRef(/* @__PURE__ */ new Map());
19
+ const clearTimeoutForId = (id) => {
20
+ const timeoutId = timeouts.current.get(id);
21
+ if (timeoutId) {
22
+ window.clearTimeout(timeoutId);
23
+ timeouts.current.delete(id);
24
+ }
25
+ };
26
+ const hideToast = react.useCallback((id) => {
27
+ clearTimeoutForId(id);
28
+ setToasts((prev) => prev.filter((t) => t.id !== id));
29
+ }, []);
30
+ const scheduleAutoDismiss = react.useCallback(
31
+ (toast) => {
32
+ var _a;
33
+ const duration = (_a = toast.duration) != null ? _a : defaultDuration;
34
+ if (!duration || duration <= 0) return;
35
+ clearTimeoutForId(toast.id);
36
+ const timeoutId = window.setTimeout(() => {
37
+ hideToast(toast.id);
38
+ }, duration);
39
+ timeouts.current.set(toast.id, timeoutId);
40
+ },
41
+ [defaultDuration, hideToast]
42
+ );
43
+ const showToast = react.useCallback(
44
+ (config) => {
45
+ var _a, _b, _c;
46
+ const id = (_c = (_b = config.id) != null ? _b : (_a = crypto.randomUUID) == null ? void 0 : _a.call(crypto)) != null ? _c : `${Date.now()}-${Math.random()}`;
47
+ const toast = { ...config, id };
48
+ setToasts((prev) => [...prev, toast]);
49
+ scheduleAutoDismiss(toast);
50
+ return id;
51
+ },
52
+ [scheduleAutoDismiss]
53
+ );
54
+ const clearToasts = react.useCallback(() => {
55
+ toasts.forEach((t) => clearTimeoutForId(t.id));
56
+ setToasts([]);
57
+ }, [toasts]);
58
+ react.useEffect(
59
+ () => () => {
60
+ toasts.forEach((t) => clearTimeoutForId(t.id));
61
+ },
62
+ [toasts]
63
+ );
64
+ return /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value: { showToast, hideToast, clearToasts }, children: [
65
+ children,
66
+ toasts.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.container, "aria-live": "polite", "aria-atomic": "false", children: toasts.map((toast) => {
67
+ var _a;
68
+ return /* @__PURE__ */ jsxRuntime.jsx(
69
+ Toast.Toast,
70
+ {
71
+ title: toast.title,
72
+ message: toast.message,
73
+ severity: (_a = toast.severity) != null ? _a : "info",
74
+ action: toast.action && {
75
+ label: toast.action.label,
76
+ onClick: () => {
77
+ var _a2, _b;
78
+ (_b = (_a2 = toast.action) == null ? void 0 : _a2.onClick) == null ? void 0 : _b.call(_a2);
79
+ hideToast(toast.id);
80
+ }
81
+ },
82
+ onClose: () => hideToast(toast.id)
83
+ },
84
+ toast.id
85
+ );
86
+ }) })
87
+ ] });
88
+ }
89
+ function useToast() {
90
+ const ctx = react.useContext(ToastContext);
91
+ if (!ctx) {
92
+ throw new Error("useToast must be used within a ToastProvider");
93
+ }
94
+ return ctx;
95
+ }
96
+
97
+ exports.ToastProvider = ToastProvider;
98
+ exports.useToast = useToast;
@@ -0,0 +1,23 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { ToastActionConfig } from '../Toast';
3
+ import { Severity } from '@/constants/severity.types';
4
+ export type ToastConfig = {
5
+ id?: string;
6
+ title?: ReactNode;
7
+ message?: ReactNode;
8
+ severity?: Severity;
9
+ action?: ToastActionConfig;
10
+ duration?: number;
11
+ };
12
+ type ToastContextValue = {
13
+ showToast: (config: ToastConfig) => string;
14
+ hideToast: (id: string) => void;
15
+ clearToasts: () => void;
16
+ };
17
+ type ToastProviderProps = {
18
+ children: ReactNode;
19
+ defaultDuration?: number;
20
+ };
21
+ export declare function ToastProvider({ children, defaultDuration, }: ToastProviderProps): React.ReactNode;
22
+ export declare function useToast(): ToastContextValue;
23
+ export {};