@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
@@ -0,0 +1,134 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+ var styles = require('./Modal.module.css');
6
+ var Headline = require('../headline/Headline');
7
+ var Button = require('../button/Button');
8
+ var lucideReact = require('lucide-react');
9
+
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ var styles__default = /*#__PURE__*/_interopDefault(styles);
13
+
14
+ function Modal({
15
+ isOpen,
16
+ onRequestClose,
17
+ header,
18
+ content,
19
+ primaryAction,
20
+ secondaryAction,
21
+ closeOnOverlayClick = true,
22
+ severity,
23
+ disableContentSpacing = false,
24
+ isLoading
25
+ }) {
26
+ const titleId = react.useId();
27
+ const dialogRef = react.useRef(null);
28
+ const lastActiveElementRef = react.useRef(null);
29
+ react.useEffect(() => {
30
+ if (!isOpen) return;
31
+ lastActiveElementRef.current = document.activeElement;
32
+ const dialog = dialogRef.current;
33
+ if (dialog) {
34
+ const focusableSelectors = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
35
+ const focusable = dialog.querySelectorAll(focusableSelectors);
36
+ if (focusable.length > 0) {
37
+ focusable[0].focus();
38
+ } else {
39
+ dialog.focus();
40
+ }
41
+ }
42
+ const handleKeyDown = (event) => {
43
+ if (event.key === "Escape") {
44
+ onRequestClose();
45
+ return;
46
+ }
47
+ if (event.key === "Tab" && dialogRef.current) {
48
+ const focusableSelectors = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
49
+ const focusable = dialogRef.current.querySelectorAll(focusableSelectors);
50
+ if (focusable.length === 0) return;
51
+ const first = focusable[0];
52
+ const last = focusable[focusable.length - 1];
53
+ if (event.shiftKey) {
54
+ if (document.activeElement === first) {
55
+ event.preventDefault();
56
+ last.focus();
57
+ }
58
+ } else {
59
+ if (document.activeElement === last) {
60
+ event.preventDefault();
61
+ first.focus();
62
+ }
63
+ }
64
+ }
65
+ };
66
+ document.addEventListener("keydown", handleKeyDown);
67
+ return () => {
68
+ document.removeEventListener("keydown", handleKeyDown);
69
+ if (lastActiveElementRef.current) {
70
+ lastActiveElementRef.current.focus();
71
+ }
72
+ };
73
+ }, [isOpen, onRequestClose]);
74
+ if (!isOpen) return null;
75
+ const handleOverlayClick = () => {
76
+ if (closeOnOverlayClick) {
77
+ onRequestClose();
78
+ }
79
+ };
80
+ const stopPropagation = (e) => {
81
+ e.stopPropagation();
82
+ };
83
+ const resolvedSecondaryAction = secondaryAction != null ? secondaryAction : primaryAction ? { label: "Luk", onClick: onRequestClose } : void 0;
84
+ const shouldRenderFooter = Boolean(primaryAction || resolvedSecondaryAction);
85
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.overlay, onClick: handleOverlayClick, children: /* @__PURE__ */ jsxRuntime.jsxs(
86
+ "div",
87
+ {
88
+ ref: dialogRef,
89
+ className: `${styles__default.default.modal} ${disableContentSpacing ? "" : styles__default.default.contentSpacing}`,
90
+ onClick: stopPropagation,
91
+ role: "dialog",
92
+ "aria-modal": "true",
93
+ "aria-labelledby": header ? titleId : void 0,
94
+ children: [
95
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.header, children: [
96
+ header && /* @__PURE__ */ jsxRuntime.jsx(Headline.Headline, { severity, size: 3, disableMargin: true, children: header }),
97
+ /* @__PURE__ */ jsxRuntime.jsx(Button.Button, { type: "button", variant: "inline", onClick: onRequestClose, "aria-label": "Luk", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}) })
98
+ ] }),
99
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.body, children: content }),
100
+ shouldRenderFooter && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.footer, children: [
101
+ resolvedSecondaryAction && /* @__PURE__ */ jsxRuntime.jsxs(
102
+ Button.Button,
103
+ {
104
+ type: "button",
105
+ variant: "outlined",
106
+ onClick: resolvedSecondaryAction.onClick,
107
+ disabled: isLoading,
108
+ children: [
109
+ resolvedSecondaryAction.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.icon, children: resolvedSecondaryAction.icon }),
110
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: resolvedSecondaryAction.label })
111
+ ]
112
+ }
113
+ ),
114
+ primaryAction && /* @__PURE__ */ jsxRuntime.jsxs(
115
+ Button.Button,
116
+ {
117
+ type: "button",
118
+ variant: "primary",
119
+ onClick: primaryAction.onClick,
120
+ disabled: primaryAction.disabled || isLoading,
121
+ loading: isLoading,
122
+ children: [
123
+ primaryAction.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.icon, children: primaryAction.icon }),
124
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: primaryAction.label })
125
+ ]
126
+ }
127
+ )
128
+ ] })
129
+ ]
130
+ }
131
+ ) });
132
+ }
133
+
134
+ exports.Modal = Modal;
@@ -0,0 +1,21 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { Severity } from '@/constants/severity.types';
3
+ export type ModalActionConfig = {
4
+ label: string;
5
+ onClick?: () => void;
6
+ icon?: ReactNode;
7
+ disabled?: boolean;
8
+ };
9
+ export type ModalProps = {
10
+ isLoading?: boolean;
11
+ isOpen: boolean;
12
+ onRequestClose: () => void;
13
+ header?: ReactNode;
14
+ content?: ReactNode;
15
+ primaryAction?: ModalActionConfig;
16
+ secondaryAction?: ModalActionConfig;
17
+ closeOnOverlayClick?: boolean;
18
+ severity?: Severity;
19
+ disableContentSpacing?: boolean;
20
+ };
21
+ export declare function Modal({ isOpen, onRequestClose, header, content, primaryAction, secondaryAction, closeOnOverlayClick, severity, disableContentSpacing, isLoading, }: ModalProps): React.ReactNode;
@@ -0,0 +1,128 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { useId, useRef, useEffect } from 'react';
3
+ import styles from './Modal.module.css';
4
+ import { Headline } from '../headline/Headline';
5
+ import { Button } from '../button/Button';
6
+ import { X } from 'lucide-react';
7
+
8
+ function Modal({
9
+ isOpen,
10
+ onRequestClose,
11
+ header,
12
+ content,
13
+ primaryAction,
14
+ secondaryAction,
15
+ closeOnOverlayClick = true,
16
+ severity,
17
+ disableContentSpacing = false,
18
+ isLoading
19
+ }) {
20
+ const titleId = useId();
21
+ const dialogRef = useRef(null);
22
+ const lastActiveElementRef = useRef(null);
23
+ useEffect(() => {
24
+ if (!isOpen) return;
25
+ lastActiveElementRef.current = document.activeElement;
26
+ const dialog = dialogRef.current;
27
+ if (dialog) {
28
+ const focusableSelectors = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
29
+ const focusable = dialog.querySelectorAll(focusableSelectors);
30
+ if (focusable.length > 0) {
31
+ focusable[0].focus();
32
+ } else {
33
+ dialog.focus();
34
+ }
35
+ }
36
+ const handleKeyDown = (event) => {
37
+ if (event.key === "Escape") {
38
+ onRequestClose();
39
+ return;
40
+ }
41
+ if (event.key === "Tab" && dialogRef.current) {
42
+ const focusableSelectors = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
43
+ const focusable = dialogRef.current.querySelectorAll(focusableSelectors);
44
+ if (focusable.length === 0) return;
45
+ const first = focusable[0];
46
+ const last = focusable[focusable.length - 1];
47
+ if (event.shiftKey) {
48
+ if (document.activeElement === first) {
49
+ event.preventDefault();
50
+ last.focus();
51
+ }
52
+ } else {
53
+ if (document.activeElement === last) {
54
+ event.preventDefault();
55
+ first.focus();
56
+ }
57
+ }
58
+ }
59
+ };
60
+ document.addEventListener("keydown", handleKeyDown);
61
+ return () => {
62
+ document.removeEventListener("keydown", handleKeyDown);
63
+ if (lastActiveElementRef.current) {
64
+ lastActiveElementRef.current.focus();
65
+ }
66
+ };
67
+ }, [isOpen, onRequestClose]);
68
+ if (!isOpen) return null;
69
+ const handleOverlayClick = () => {
70
+ if (closeOnOverlayClick) {
71
+ onRequestClose();
72
+ }
73
+ };
74
+ const stopPropagation = (e) => {
75
+ e.stopPropagation();
76
+ };
77
+ const resolvedSecondaryAction = secondaryAction != null ? secondaryAction : primaryAction ? { label: "Luk", onClick: onRequestClose } : void 0;
78
+ const shouldRenderFooter = Boolean(primaryAction || resolvedSecondaryAction);
79
+ return /* @__PURE__ */ jsx("div", { className: styles.overlay, onClick: handleOverlayClick, children: /* @__PURE__ */ jsxs(
80
+ "div",
81
+ {
82
+ ref: dialogRef,
83
+ className: `${styles.modal} ${disableContentSpacing ? "" : styles.contentSpacing}`,
84
+ onClick: stopPropagation,
85
+ role: "dialog",
86
+ "aria-modal": "true",
87
+ "aria-labelledby": header ? titleId : void 0,
88
+ children: [
89
+ /* @__PURE__ */ jsxs("div", { className: styles.header, children: [
90
+ header && /* @__PURE__ */ jsx(Headline, { severity, size: 3, disableMargin: true, children: header }),
91
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "inline", onClick: onRequestClose, "aria-label": "Luk", children: /* @__PURE__ */ jsx(X, {}) })
92
+ ] }),
93
+ /* @__PURE__ */ jsx("div", { className: styles.body, children: content }),
94
+ shouldRenderFooter && /* @__PURE__ */ jsxs("div", { className: styles.footer, children: [
95
+ resolvedSecondaryAction && /* @__PURE__ */ jsxs(
96
+ Button,
97
+ {
98
+ type: "button",
99
+ variant: "outlined",
100
+ onClick: resolvedSecondaryAction.onClick,
101
+ disabled: isLoading,
102
+ children: [
103
+ resolvedSecondaryAction.icon && /* @__PURE__ */ jsx("span", { className: styles.icon, children: resolvedSecondaryAction.icon }),
104
+ /* @__PURE__ */ jsx("span", { children: resolvedSecondaryAction.label })
105
+ ]
106
+ }
107
+ ),
108
+ primaryAction && /* @__PURE__ */ jsxs(
109
+ Button,
110
+ {
111
+ type: "button",
112
+ variant: "primary",
113
+ onClick: primaryAction.onClick,
114
+ disabled: primaryAction.disabled || isLoading,
115
+ loading: isLoading,
116
+ children: [
117
+ primaryAction.icon && /* @__PURE__ */ jsx("span", { className: styles.icon, children: primaryAction.icon }),
118
+ /* @__PURE__ */ jsx("span", { children: primaryAction.label })
119
+ ]
120
+ }
121
+ )
122
+ ] })
123
+ ]
124
+ }
125
+ ) });
126
+ }
127
+
128
+ export { Modal };
@@ -0,0 +1,66 @@
1
+ .overlay {
2
+ position: fixed;
3
+ inset: 0;
4
+ background: var(--overlay-scrim);
5
+ display: flex;
6
+ align-items: flex-start;
7
+ justify-content: center;
8
+ padding-top: clamp(var(--spacing-md), 12vh, 24vh);
9
+ padding-bottom: var(--spacing-md);
10
+ z-index: var(--z-modal);
11
+ overflow-y: auto;
12
+ }
13
+
14
+ .modal {
15
+ background: var(--color-bg-surface);
16
+ border-radius: var(--border-radius-lg);
17
+ min-width: 320px;
18
+ max-width: 540px;
19
+ max-height: calc(100vh - (2 * var(--spacing-md)));
20
+ display: flex;
21
+ flex-direction: column;
22
+ box-shadow: var(--shadow-lg);
23
+ font-family: var(--font-family);
24
+ min-width: 400px;
25
+ color: var(--color-fg-default);
26
+ }
27
+
28
+ /* Slightly more relaxed on small screens */
29
+ @media (max-width: var(--bp-sm)) {
30
+ .modal {
31
+ width: calc(100% - 2 * var(--spacing-md));
32
+ max-width: 100%;
33
+ }
34
+ }
35
+
36
+ .header {
37
+ font-size: var(--font-size-md);
38
+ font-weight: var(--font-weight-semibold);
39
+ display: flex;
40
+ justify-content: space-between;
41
+ align-items: center;
42
+ padding: var(--spacing-md);
43
+ padding-bottom: 0;
44
+ }
45
+
46
+ .body {
47
+ overflow-y: auto;
48
+ font-size: var(--font-size-sm);
49
+ line-height: var(--line-height-normal);
50
+ color: var(--color-fg-muted);
51
+ padding: var(--spacing-md);
52
+ }
53
+
54
+ .footer {
55
+ display: flex;
56
+ justify-content: flex-end;
57
+ gap: var(--spacing-xs);
58
+ padding-top: 0;
59
+ padding: var(--spacing-md);
60
+ }
61
+
62
+ .icon {
63
+ display: inline-flex;
64
+ align-items: center;
65
+ justify-content: center;
66
+ }
@@ -0,0 +1,80 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+ var Modal = require('../Modal');
6
+
7
+ const ModalContext = react.createContext(void 0);
8
+ function ModalProvider({ children }) {
9
+ const [isOpen, setIsOpen] = react.useState(false);
10
+ const [config, setConfig] = react.useState(null);
11
+ const pendingResolverRef = react.useRef(null);
12
+ const resolvePending = react.useCallback((value) => {
13
+ if (pendingResolverRef.current) {
14
+ pendingResolverRef.current(value);
15
+ pendingResolverRef.current = null;
16
+ }
17
+ }, []);
18
+ const closeModal = react.useCallback(() => {
19
+ setIsOpen(false);
20
+ }, []);
21
+ const openModal = react.useCallback(
22
+ (newConfig) => {
23
+ resolvePending(false);
24
+ setConfig(newConfig);
25
+ setIsOpen(true);
26
+ },
27
+ [resolvePending]
28
+ );
29
+ const handleRequestClose = react.useCallback(() => {
30
+ if (config == null ? void 0 : config.onRequestClose) {
31
+ config.onRequestClose();
32
+ }
33
+ resolvePending(false);
34
+ closeModal();
35
+ }, [config, closeModal, resolvePending]);
36
+ const confirm = react.useCallback(
37
+ (confirmConfig) => {
38
+ return new Promise((resolve) => {
39
+ resolvePending(false);
40
+ pendingResolverRef.current = resolve;
41
+ const { confirmLabel = "OK", cancelLabel = "Annuller", ...rest } = confirmConfig;
42
+ const primaryAction = {
43
+ label: confirmLabel,
44
+ onClick: () => {
45
+ resolvePending(true);
46
+ closeModal();
47
+ }
48
+ };
49
+ const secondaryAction = {
50
+ label: cancelLabel,
51
+ onClick: () => {
52
+ resolvePending(false);
53
+ closeModal();
54
+ }
55
+ };
56
+ setConfig({
57
+ ...rest,
58
+ primaryAction,
59
+ secondaryAction
60
+ });
61
+ setIsOpen(true);
62
+ });
63
+ },
64
+ [closeModal, resolvePending]
65
+ );
66
+ return /* @__PURE__ */ jsxRuntime.jsxs(ModalContext.Provider, { value: { openModal, closeModal, confirm }, children: [
67
+ children,
68
+ /* @__PURE__ */ jsxRuntime.jsx(Modal.Modal, { ...config != null ? config : {}, isOpen, onRequestClose: handleRequestClose })
69
+ ] });
70
+ }
71
+ function useModal() {
72
+ const ctx = react.useContext(ModalContext);
73
+ if (!ctx) {
74
+ throw new Error("useModal must be used within a ModalProvider");
75
+ }
76
+ return ctx;
77
+ }
78
+
79
+ exports.ModalProvider = ModalProvider;
80
+ exports.useModal = useModal;
@@ -0,0 +1,21 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { ModalProps } from '../Modal';
3
+ type ModalConfig = Omit<ModalProps, 'isOpen' | 'onRequestClose'> & {
4
+ onRequestClose?: () => void;
5
+ };
6
+ type ConfirmModalConfig = Omit<ModalConfig, 'primaryAction' | 'secondaryAction' | 'onRequestClose'> & {
7
+ /** Optional labels for confirm/cancel buttons */
8
+ confirmLabel?: string;
9
+ cancelLabel?: string;
10
+ };
11
+ type ModalContextValue = {
12
+ openModal: (config: ModalConfig) => void;
13
+ closeModal: () => void;
14
+ confirm: (config: ConfirmModalConfig) => Promise<boolean>;
15
+ };
16
+ type ModalProviderProps = {
17
+ children: ReactNode;
18
+ };
19
+ export declare function ModalProvider({ children }: ModalProviderProps): React.ReactNode;
20
+ export declare function useModal(): ModalContextValue;
21
+ export {};
@@ -0,0 +1,77 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { createContext, useState, useRef, useCallback, useContext } from 'react';
3
+ import { Modal } from '../Modal';
4
+
5
+ const ModalContext = createContext(void 0);
6
+ function ModalProvider({ children }) {
7
+ const [isOpen, setIsOpen] = useState(false);
8
+ const [config, setConfig] = useState(null);
9
+ const pendingResolverRef = useRef(null);
10
+ const resolvePending = useCallback((value) => {
11
+ if (pendingResolverRef.current) {
12
+ pendingResolverRef.current(value);
13
+ pendingResolverRef.current = null;
14
+ }
15
+ }, []);
16
+ const closeModal = useCallback(() => {
17
+ setIsOpen(false);
18
+ }, []);
19
+ const openModal = useCallback(
20
+ (newConfig) => {
21
+ resolvePending(false);
22
+ setConfig(newConfig);
23
+ setIsOpen(true);
24
+ },
25
+ [resolvePending]
26
+ );
27
+ const handleRequestClose = useCallback(() => {
28
+ if (config == null ? void 0 : config.onRequestClose) {
29
+ config.onRequestClose();
30
+ }
31
+ resolvePending(false);
32
+ closeModal();
33
+ }, [config, closeModal, resolvePending]);
34
+ const confirm = useCallback(
35
+ (confirmConfig) => {
36
+ return new Promise((resolve) => {
37
+ resolvePending(false);
38
+ pendingResolverRef.current = resolve;
39
+ const { confirmLabel = "OK", cancelLabel = "Annuller", ...rest } = confirmConfig;
40
+ const primaryAction = {
41
+ label: confirmLabel,
42
+ onClick: () => {
43
+ resolvePending(true);
44
+ closeModal();
45
+ }
46
+ };
47
+ const secondaryAction = {
48
+ label: cancelLabel,
49
+ onClick: () => {
50
+ resolvePending(false);
51
+ closeModal();
52
+ }
53
+ };
54
+ setConfig({
55
+ ...rest,
56
+ primaryAction,
57
+ secondaryAction
58
+ });
59
+ setIsOpen(true);
60
+ });
61
+ },
62
+ [closeModal, resolvePending]
63
+ );
64
+ return /* @__PURE__ */ jsxs(ModalContext.Provider, { value: { openModal, closeModal, confirm }, children: [
65
+ children,
66
+ /* @__PURE__ */ jsx(Modal, { ...config != null ? config : {}, isOpen, onRequestClose: handleRequestClose })
67
+ ] });
68
+ }
69
+ function useModal() {
70
+ const ctx = useContext(ModalContext);
71
+ if (!ctx) {
72
+ throw new Error("useModal must be used within a ModalProvider");
73
+ }
74
+ return ctx;
75
+ }
76
+
77
+ export { ModalProvider, useModal };
@@ -36,7 +36,18 @@ function MultiSelect({
36
36
  onChange(option.value);
37
37
  },
38
38
  children: [
39
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { pointerEvents: "none", display: "flex", alignItems: "center" }, children: (selectedValues == null ? void 0 : selectedValues.includes(option.value)) ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Square, {}) }),
39
+ /* @__PURE__ */ jsxRuntime.jsx(
40
+ "span",
41
+ {
42
+ style: {
43
+ pointerEvents: "none",
44
+ display: "flex",
45
+ alignItems: "center",
46
+ color: !(selectedValues == null ? void 0 : selectedValues.includes(option.value)) ? "var(--color-border-strong)" : "inherit"
47
+ },
48
+ children: (selectedValues == null ? void 0 : selectedValues.includes(option.value)) ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Square, {})
49
+ }
50
+ ),
40
51
  option.label
41
52
  ]
42
53
  }
@@ -34,7 +34,18 @@ function MultiSelect({
34
34
  onChange(option.value);
35
35
  },
36
36
  children: [
37
- /* @__PURE__ */ jsx("span", { style: { pointerEvents: "none", display: "flex", alignItems: "center" }, children: (selectedValues == null ? void 0 : selectedValues.includes(option.value)) ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Square, {}) }),
37
+ /* @__PURE__ */ jsx(
38
+ "span",
39
+ {
40
+ style: {
41
+ pointerEvents: "none",
42
+ display: "flex",
43
+ alignItems: "center",
44
+ color: !(selectedValues == null ? void 0 : selectedValues.includes(option.value)) ? "var(--color-border-strong)" : "inherit"
45
+ },
46
+ children: (selectedValues == null ? void 0 : selectedValues.includes(option.value)) ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Square, {})
47
+ }
48
+ ),
38
49
  option.label
39
50
  ]
40
51
  }
@@ -15,8 +15,8 @@
15
15
  text-decoration: none;
16
16
  }
17
17
  .productName svg {
18
- inline-size: var(--icon-size);
19
- block-size: var(--icon-size);
18
+ inline-size: var(--icon-size-md);
19
+ block-size: var(--icon-size-md);
20
20
  }
21
21
 
22
22
  .navItems {
@@ -41,11 +41,10 @@
41
41
  display: inline-flex;
42
42
  align-items: center;
43
43
  gap: var(--spacing-xs);
44
- color: var(--color-text-secondary);
44
+ color: var(--color-fg-muted);
45
45
  font-family: var(--font-family);
46
46
  font-size: var(--font-size-sm);
47
47
  text-decoration: none;
48
- text-transform: var(--nav-link-transform);
49
48
  border-radius: var(--border-radius-default);
50
49
  padding-block: calc(var(--spacing-xs) + var(--density));
51
50
  padding-inline: var(--spacing-sm);
@@ -57,23 +56,18 @@
57
56
 
58
57
  /* Hover + focus */
59
58
  .link:hover {
60
- background-color: var(--color-surface-hover);
61
- color: var(--color-text);
59
+ background-color: var(--color-bg-hover-subtle);
60
+ color: var(--color-fg-default);
62
61
  }
63
62
  .link:focus-visible {
64
63
  outline: none;
65
64
  box-shadow: var(--focus-ring);
66
65
  }
67
66
 
68
- /* Active underline (no radius warp) */
69
- .link {
70
- position: relative; /* establish positioning context for ::after */
71
- }
72
-
73
- /* Base: reset any previous inset shadows */
67
+ /* Active underline */
74
68
  .link.active,
75
69
  .link[aria-current='page'] {
76
- color: var(--color-text);
70
+ color: var(--color-fg-default);
77
71
  box-shadow: none;
78
72
  }
79
73
 
@@ -84,7 +78,7 @@
84
78
  inset-block-end: 0;
85
79
  inline-size: 0;
86
80
  block-size: 2px;
87
- background-color: var(--color-primary);
81
+ background-color: var(--color-brand);
88
82
  transition: inline-size var(--transition-fast) var(--ease-standard);
89
83
  }
90
84
 
@@ -92,10 +86,11 @@
92
86
  .link[aria-current='page']::after {
93
87
  inline-size: 100%;
94
88
  }
89
+
95
90
  /* Icons/images inside links */
96
91
  .link svg,
97
92
  .link img {
98
- inline-size: var(--icon-size);
99
- block-size: var(--icon-size);
93
+ inline-size: var(--icon-size-md);
94
+ block-size: var(--icon-size-md);
100
95
  flex: 0 0 auto;
101
96
  }
@@ -21,6 +21,6 @@
21
21
 
22
22
  .content:not(.disableContentBox) {
23
23
  padding: var(--spacing-lg);
24
- border: 1px solid var(--opac-bg-dark);
24
+ border: 1px solid var(--color-border-default);
25
25
  border-radius: var(--border-radius-default);
26
- }
26
+ }