@dbcdk/react-components 0.0.96 → 0.0.97

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/components/table/Table.d.ts +1 -1
  2. package/dist/components/table/Table.types.d.ts +3 -0
  3. package/dist/components/table/components/TableHeader.d.ts +2 -1
  4. package/dist/index.cjs +12750 -0
  5. package/dist/index.css +7149 -0
  6. package/dist/index.js +12641 -79
  7. package/dist/tanstack.cjs +2674 -0
  8. package/dist/tanstack.css +1267 -0
  9. package/dist/tanstack.js +2650 -3
  10. package/dist/themes/dbc.css +3 -0
  11. package/dist/themes/forfatterweb.css +2 -0
  12. package/package.json +11 -10
  13. package/dist/assets/logo.js +0 -2
  14. package/dist/components/__stories__/_data/table.d.ts +0 -15
  15. package/dist/components/__stories__/_data/table.js +0 -55
  16. package/dist/components/__stories__/_data/tabs.d.ts +0 -9
  17. package/dist/components/__stories__/_data/tabs.js +0 -31
  18. package/dist/components/__stories__/story-components/Colors.d.ts +0 -11
  19. package/dist/components/__stories__/story-components/Colors.js +0 -96
  20. package/dist/components/__stories__/story-components/Colors.module.css +0 -27
  21. package/dist/components/__stories__/story-components/ComponentSizes.d.ts +0 -2
  22. package/dist/components/__stories__/story-components/ComponentSizes.js +0 -26
  23. package/dist/components/__stories__/story-components/Elevation.d.ts +0 -2
  24. package/dist/components/__stories__/story-components/Elevation.js +0 -49
  25. package/dist/components/__stories__/story-components/Flex.d.ts +0 -2
  26. package/dist/components/__stories__/story-components/Flex.js +0 -177
  27. package/dist/components/__stories__/story-components/Flex.module.css +0 -317
  28. package/dist/components/__stories__/story-components/Spacing.d.ts +0 -6
  29. package/dist/components/__stories__/story-components/Spacing.js +0 -76
  30. package/dist/components/__stories__/story-components/Spacing.module.css +0 -154
  31. package/dist/components/accordion/Accordion.js +0 -70
  32. package/dist/components/accordion/Accordion.module.css +0 -28
  33. package/dist/components/accordion/components/AccordionRow.js +0 -53
  34. package/dist/components/accordion/components/AccordionRow.module.css +0 -90
  35. package/dist/components/alert/Alert.js +0 -17
  36. package/dist/components/alert/Alert.module.css +0 -98
  37. package/dist/components/app-header/AppHeader.js +0 -5
  38. package/dist/components/app-header/AppHeader.module.css +0 -74
  39. package/dist/components/attribute-chip/AttributeChip.js +0 -5
  40. package/dist/components/attribute-chip/AttributeChip.module.css +0 -65
  41. package/dist/components/avatar/Avatar.js +0 -48
  42. package/dist/components/avatar/Avatar.module.css +0 -91
  43. package/dist/components/breadcrumbs/Breadcrumbs.js +0 -6
  44. package/dist/components/breadcrumbs/Breadcrumbs.module.css +0 -80
  45. package/dist/components/button/Button.js +0 -81
  46. package/dist/components/button/Button.module.css +0 -249
  47. package/dist/components/button-select/ButtonSelect.js +0 -7
  48. package/dist/components/button-select/ButtonSelect.module.css +0 -40
  49. package/dist/components/card/Card.js +0 -71
  50. package/dist/components/card/Card.module.css +0 -160
  51. package/dist/components/card/components/CardMeta.js +0 -26
  52. package/dist/components/card/components/CardMeta.module.css +0 -55
  53. package/dist/components/card-container/CardContainer.js +0 -6
  54. package/dist/components/card-container/CardContainer.module.css +0 -61
  55. package/dist/components/chip/Chip.js +0 -31
  56. package/dist/components/chip/Chip.module.css +0 -236
  57. package/dist/components/circle/Circle.js +0 -5
  58. package/dist/components/circle/Circle.module.css +0 -128
  59. package/dist/components/clear-button/ClearButton.js +0 -13
  60. package/dist/components/clear-button/ClearButton.module.css +0 -26
  61. package/dist/components/code-block/CodeBlock.js +0 -58
  62. package/dist/components/code-block/CodeBlock.module.css +0 -124
  63. package/dist/components/copy-button/CopyButton.js +0 -78
  64. package/dist/components/copy-button/CopyButton.module.css +0 -22
  65. package/dist/components/datetime-picker/DateTimePicker.js +0 -403
  66. package/dist/components/datetime-picker/DateTimePicker.module.css +0 -155
  67. package/dist/components/datetime-picker/dateTimeHelpers.js +0 -248
  68. package/dist/components/divider/Divider.js +0 -12
  69. package/dist/components/filter-field/FilterField.js +0 -191
  70. package/dist/components/filter-field/FilterField.module.css +0 -379
  71. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +0 -52
  72. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +0 -59
  73. package/dist/components/forms/checkbox/Checkbox.js +0 -28
  74. package/dist/components/forms/checkbox/Checkbox.module.css +0 -103
  75. package/dist/components/forms/checkbox-group/CheckboxGroup.js +0 -75
  76. package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +0 -115
  77. package/dist/components/forms/form-select/FormSelect.js +0 -86
  78. package/dist/components/forms/form-select/FormSelect.module.css +0 -236
  79. package/dist/components/forms/input/Input.js +0 -77
  80. package/dist/components/forms/input/Input.module.css +0 -468
  81. package/dist/components/forms/input-container/InputContainer.js +0 -15
  82. package/dist/components/forms/input-container/InputContainer.module.css +0 -60
  83. package/dist/components/forms/multi-select/MultiSelect.js +0 -122
  84. package/dist/components/forms/radio-buttons/RadioButton.js +0 -26
  85. package/dist/components/forms/radio-buttons/RadioButtonGroup.js +0 -19
  86. package/dist/components/forms/radio-buttons/RadioButtons.module.css +0 -118
  87. package/dist/components/forms/select/Select.js +0 -185
  88. package/dist/components/forms/select/Select.module.css +0 -32
  89. package/dist/components/forms/text-area/Textarea.js +0 -47
  90. package/dist/components/forms/text-area/Textarea.module.css +0 -70
  91. package/dist/components/forms/typeahead/Typeahead.js +0 -668
  92. package/dist/components/forms/typeahead/Typeahead.module.css +0 -38
  93. package/dist/components/grid/Grid.js +0 -23
  94. package/dist/components/grid/Grid.module.css +0 -35
  95. package/dist/components/headline/CollapsibleHeadline.js +0 -29
  96. package/dist/components/headline/Headline.js +0 -26
  97. package/dist/components/headline/Headline.module.css +0 -185
  98. package/dist/components/hyperlink/Hyperlink.js +0 -40
  99. package/dist/components/hyperlink/Hyperlink.module.css +0 -107
  100. package/dist/components/icon/Icon.js +0 -14
  101. package/dist/components/icon/Icon.module.css +0 -36
  102. package/dist/components/interval-select/IntervalSelect.js +0 -99
  103. package/dist/components/json-viewer/HighlightedText.js +0 -6
  104. package/dist/components/json-viewer/JsonNode.js +0 -30
  105. package/dist/components/json-viewer/JsonViewer.js +0 -68
  106. package/dist/components/json-viewer/JsonViewer.module.css +0 -346
  107. package/dist/components/json-viewer/types.js +0 -1
  108. package/dist/components/json-viewer/useClipboardStatus.js +0 -11
  109. package/dist/components/json-viewer/utils.js +0 -125
  110. package/dist/components/menu/Menu.js +0 -165
  111. package/dist/components/menu/Menu.module.css +0 -220
  112. package/dist/components/meta-bar/MetaBar.js +0 -9
  113. package/dist/components/meta-bar/MetaBar.module.css +0 -27
  114. package/dist/components/nav-bar/NavBar.js +0 -29
  115. package/dist/components/nav-bar/NavBar.module.css +0 -221
  116. package/dist/components/overlay/fade-overlay/FadeOverlay.js +0 -8
  117. package/dist/components/overlay/fade-overlay/FadeOverlay.module.css +0 -54
  118. package/dist/components/overlay/modal/Modal.js +0 -115
  119. package/dist/components/overlay/modal/Modal.module.css +0 -109
  120. package/dist/components/overlay/modal/provider/ModalProvider.js +0 -73
  121. package/dist/components/overlay/side-panel/SidePanel.js +0 -83
  122. package/dist/components/overlay/side-panel/SidePanel.module.css +0 -177
  123. package/dist/components/overlay/side-panel/useSidePanel.js +0 -11
  124. package/dist/components/overlay/tooltip/Tooltip.js +0 -17
  125. package/dist/components/overlay/tooltip/Tooltip.module.css +0 -104
  126. package/dist/components/overlay/tooltip/TooltipProvider.js +0 -255
  127. package/dist/components/overlay/tooltip/useTooltipTrigger.js +0 -118
  128. package/dist/components/page/Page.js +0 -11
  129. package/dist/components/page/Page.module.css +0 -89
  130. package/dist/components/page-layout/PageLayout.js +0 -76
  131. package/dist/components/page-layout/PageLayout.module.css +0 -236
  132. package/dist/components/page-layout/components/layout-footer/LayoutFooter.js +0 -27
  133. package/dist/components/page-layout/components/layout-footer/LayoutFooter.module.css +0 -89
  134. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +0 -14
  135. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.module.css +0 -84
  136. package/dist/components/pagination/Pagination.js +0 -56
  137. package/dist/components/pagination/Pagination.module.css +0 -25
  138. package/dist/components/panel/Panel.js +0 -7
  139. package/dist/components/panel/Panel.module.css +0 -29
  140. package/dist/components/popover/Popover.js +0 -257
  141. package/dist/components/popover/Popover.module.css +0 -54
  142. package/dist/components/search-box/SearchBox.js +0 -170
  143. package/dist/components/search-box/SearchBox.module.css +0 -21
  144. package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +0 -48
  145. package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +0 -167
  146. package/dist/components/sidebar/Sidebar.js +0 -6
  147. package/dist/components/sidebar/components/SidebarItem.js +0 -8
  148. package/dist/components/sidebar/components/SidebarItem.module.css +0 -0
  149. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +0 -63
  150. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +0 -29
  151. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +0 -153
  152. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +0 -260
  153. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +0 -18
  154. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +0 -106
  155. package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +0 -26
  156. package/dist/components/sidebar/components/sidebar-items/SidebarItems.module.css +0 -20
  157. package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +0 -30
  158. package/dist/components/sidebar/providers/SidebarProvider.js +0 -229
  159. package/dist/components/skeleton-loader/SkeletonLoader.js +0 -73
  160. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +0 -13
  161. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +0 -51
  162. package/dist/components/split-button/SplitButton.js +0 -10
  163. package/dist/components/split-button/SplitButton.module.css +0 -32
  164. package/dist/components/split-pane/SplitPane.js +0 -107
  165. package/dist/components/split-pane/SplitPane.module.css +0 -111
  166. package/dist/components/split-pane/provider/SplitPaneContext.js +0 -124
  167. package/dist/components/stack/Stack.js +0 -33
  168. package/dist/components/stack/Stack.module.css +0 -61
  169. package/dist/components/state-page/StatePage.js +0 -20
  170. package/dist/components/state-page/StatePage.module.css +0 -9
  171. package/dist/components/state-page/empty.js +0 -2
  172. package/dist/components/state-page/error.js +0 -2
  173. package/dist/components/state-page/notFound.js +0 -2
  174. package/dist/components/sticky-footer-layout/StickyFooterLayout.js +0 -64
  175. package/dist/components/table/Table.js +0 -50
  176. package/dist/components/table/Table.module.css +0 -536
  177. package/dist/components/table/Table.types.js +0 -1
  178. package/dist/components/table/TanstackTable.js +0 -111
  179. package/dist/components/table/components/TableBody.js +0 -10
  180. package/dist/components/table/components/TableHeader.js +0 -7
  181. package/dist/components/table/components/TableHeaderCell.js +0 -24
  182. package/dist/components/table/components/TableLoadingBody.js +0 -26
  183. package/dist/components/table/components/TablePagination.js +0 -1
  184. package/dist/components/table/components/TableRow.js +0 -54
  185. package/dist/components/table/components/TableSelectionCell.js +0 -16
  186. package/dist/components/table/components/column-resizer/ColumnResizer.js +0 -5
  187. package/dist/components/table/components/column-resizer/ColumnResizer.module.css +0 -22
  188. package/dist/components/table/components/empty-state/EmptyState.js +0 -23
  189. package/dist/components/table/components/empty-state/EmptyState.module.css +0 -4
  190. package/dist/components/table/components/table-settings/TableSettings.js +0 -63
  191. package/dist/components/table/hooks/useTableRowInteractions.js +0 -30
  192. package/dist/components/table/table.classes.js +0 -23
  193. package/dist/components/table/table.utils.js +0 -47
  194. package/dist/components/table/tanstackTable.utils.js +0 -175
  195. package/dist/components/tabs/Tabs.js +0 -125
  196. package/dist/components/tabs/Tabs.module.css +0 -233
  197. package/dist/components/theme-button/ThemeButton.js +0 -23
  198. package/dist/components/toast/Toast.js +0 -20
  199. package/dist/components/toast/Toast.module.css +0 -161
  200. package/dist/components/toast/provider/ToastProvider.js +0 -70
  201. package/dist/components/user-display/UserDisplay.js +0 -6
  202. package/dist/components/user-display/UserDisplay.module.css +0 -25
  203. package/dist/constants/severity.js +0 -24
  204. package/dist/constants/severity.types.js +0 -1
  205. package/dist/constants/sizes.js +0 -7
  206. package/dist/hooks/useDeviceSize.js +0 -32
  207. package/dist/hooks/useListNavigation.js +0 -234
  208. package/dist/hooks/usePagination.js +0 -140
  209. package/dist/hooks/useSorting.js +0 -118
  210. package/dist/hooks/useTableData.js +0 -45
  211. package/dist/hooks/useTableSelection.js +0 -164
  212. package/dist/hooks/useTableSettings.js +0 -71
  213. package/dist/hooks/useTheme.js +0 -66
  214. package/dist/hooks/useTimeDuration.js +0 -68
  215. package/dist/hooks/useViewportFill.js +0 -77
  216. package/dist/styles/animation.js +0 -5
  217. package/dist/styles/themes/types.js +0 -1
  218. package/dist/types/a11y-props.types.js +0 -1
  219. package/dist/types/sizes.types.js +0 -1
  220. package/dist/utils/arrays/nested-filtering.js +0 -48
  221. package/dist/utils/date/formatDate.js +0 -51
  222. package/dist/utils/localStorage.utils.js +0 -78
  223. package/dist/utils/text/get-highlighted-segments.js +0 -46
@@ -1,54 +0,0 @@
1
- .overlay {
2
- --fade-overlay-color: var(--color-bg-surface);
3
- --fade-overlay-size: 65%;
4
-
5
- position: absolute;
6
- inset: 0;
7
- z-index: 1;
8
- pointer-events: none;
9
- border-radius: inherit;
10
- }
11
-
12
- .bottom {
13
- background: linear-gradient(
14
- to top,
15
- var(--fade-overlay-color) 0%,
16
- transparent var(--fade-overlay-size)
17
- );
18
- }
19
-
20
- .top {
21
- background: linear-gradient(
22
- to bottom,
23
- var(--fade-overlay-color) 0%,
24
- transparent var(--fade-overlay-size)
25
- );
26
- }
27
-
28
- .left {
29
- background: linear-gradient(
30
- to right,
31
- var(--fade-overlay-color) 0%,
32
- transparent var(--fade-overlay-size)
33
- );
34
- }
35
-
36
- .right {
37
- background: linear-gradient(
38
- to left,
39
- var(--fade-overlay-color) 0%,
40
- transparent var(--fade-overlay-size)
41
- );
42
- }
43
-
44
- .sm {
45
- --fade-overlay-size: 40%;
46
- }
47
-
48
- .md {
49
- --fade-overlay-size: 65%;
50
- }
51
-
52
- .lg {
53
- --fade-overlay-size: 85%;
54
- }
@@ -1,115 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { X } from 'lucide-react';
4
- import { useEffect, useId, useRef, useState } from 'react';
5
- import { createPortal } from 'react-dom';
6
- import { Button } from '../../../components/button/Button';
7
- import { Headline } from '../../../components/headline/Headline';
8
- import styles from './Modal.module.css';
9
- export function Modal({ isOpen, onRequestClose, header, subheader, content, children, primaryAction, secondaryAction, closeOnOverlayClick = true, severity, disableContentSpacing = false, isLoading, dataCy, width, }) {
10
- const titleId = useId();
11
- const dialogRef = useRef(null);
12
- const lastActiveElementRef = useRef(null);
13
- const [mounted, setMounted] = useState(false);
14
- // Always call the latest onRequestClose without re-running effects
15
- const onRequestCloseRef = useRef(onRequestClose);
16
- useEffect(() => {
17
- onRequestCloseRef.current = onRequestClose;
18
- }, [onRequestClose]);
19
- useEffect(() => {
20
- setMounted(true); // eslint-disable-line react-hooks/set-state-in-effect -- intentional: SSR portal guard, runs once after hydration
21
- }, []);
22
- // Track open transition so we only autofocus once per open
23
- const wasOpenRef = useRef(false);
24
- useEffect(() => {
25
- var _a;
26
- const wasOpen = wasOpenRef.current;
27
- wasOpenRef.current = isOpen;
28
- if (!isOpen)
29
- return;
30
- // Only do focus setup when opening (false -> true)
31
- if (!wasOpen) {
32
- lastActiveElementRef.current = document.activeElement;
33
- const dialog = dialogRef.current;
34
- if (dialog) {
35
- const focusableSelectors = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
36
- const focusable = dialog.querySelectorAll(focusableSelectors);
37
- if (focusable.length > 0) {
38
- const preferred = (_a = dialog.querySelector('input, select, textarea')) !== null && _a !== void 0 ? _a : focusable[0];
39
- preferred.focus();
40
- }
41
- else {
42
- dialog.focus();
43
- }
44
- }
45
- }
46
- const focusableSelectors = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
47
- const getFocusable = () => { var _a, _b; return (_b = (_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(focusableSelectors)) !== null && _b !== void 0 ? _b : []; };
48
- const handleKeyDown = (event) => {
49
- if (event.key === 'Escape') {
50
- onRequestCloseRef.current();
51
- return;
52
- }
53
- if (event.key === 'Tab' && dialogRef.current) {
54
- const focusable = getFocusable();
55
- if (focusable.length === 0)
56
- return;
57
- const first = focusable[0];
58
- const last = focusable[focusable.length - 1];
59
- if (event.shiftKey) {
60
- if (document.activeElement === first ||
61
- !dialogRef.current.contains(document.activeElement)) {
62
- event.preventDefault();
63
- last.focus();
64
- }
65
- }
66
- else {
67
- if (document.activeElement === last ||
68
- !dialogRef.current.contains(document.activeElement)) {
69
- event.preventDefault();
70
- first.focus();
71
- }
72
- }
73
- }
74
- };
75
- // Redirect focus back into the dialog if it escapes (e.g. via mouse click on overlay)
76
- const handleFocusIn = (event) => {
77
- const dialog = dialogRef.current;
78
- if (!dialog || dialog.contains(event.target))
79
- return;
80
- const focusable = getFocusable();
81
- if (focusable.length > 0)
82
- focusable[0].focus();
83
- else
84
- dialog.focus();
85
- };
86
- document.addEventListener('keydown', handleKeyDown);
87
- document.addEventListener('focusin', handleFocusIn);
88
- return () => {
89
- document.removeEventListener('keydown', handleKeyDown);
90
- document.removeEventListener('focusin', handleFocusIn);
91
- if (lastActiveElementRef.current) {
92
- lastActiveElementRef.current.focus();
93
- }
94
- };
95
- }, [isOpen]);
96
- if (!isOpen || !mounted)
97
- return null;
98
- const handleOverlayClick = () => {
99
- if (closeOnOverlayClick) {
100
- onRequestCloseRef.current();
101
- }
102
- };
103
- const stopPropagation = e => {
104
- e.stopPropagation();
105
- };
106
- const resolvedSecondaryAction = primaryAction || secondaryAction
107
- ? { label: 'Luk', onClick: onRequestClose, ...secondaryAction }
108
- : undefined;
109
- const shouldRenderFooter = Boolean(primaryAction || resolvedSecondaryAction);
110
- const body = children !== null && children !== void 0 ? children : content;
111
- const resolvedWidth = typeof width === 'number' ? `${width}px` : typeof width === 'string' ? width : undefined;
112
- return createPortal(_jsx("div", { className: styles.overlay, onClick: handleOverlayClick, children: _jsxs("div", { "data-cy": dataCy, ref: dialogRef, className: `${styles.modal} ${disableContentSpacing ? '' : styles.contentSpacing}`, style: resolvedWidth
113
- ? { ['--modal-width']: resolvedWidth }
114
- : undefined, onClick: stopPropagation, role: "dialog", "aria-modal": "true", "aria-labelledby": header ? titleId : undefined, tabIndex: -1, children: [_jsxs("div", { className: styles.header, children: [header && (_jsx(Headline, { severity: severity, size: 3, disableMargin: true, subheader: subheader, children: header })), _jsx(Button, { type: "button", variant: "inline", onClick: () => onRequestCloseRef.current(), "aria-label": "Luk", shape: "round", icon: _jsx(X, {}) })] }), _jsx("div", { className: styles.body, children: body }), shouldRenderFooter && (_jsxs("div", { className: styles.footer, children: [resolvedSecondaryAction && (_jsxs(Button, { type: "button", onClick: resolvedSecondaryAction.onClick, disabled: isLoading, children: [resolvedSecondaryAction.icon && (_jsx("span", { className: styles.icon, children: resolvedSecondaryAction.icon })), _jsx("span", { children: resolvedSecondaryAction.label })] })), primaryAction && (_jsxs(Button, { type: "button", variant: primaryAction.severity || 'primary', onClick: primaryAction.onClick, disabled: primaryAction.disabled || isLoading, loading: isLoading, children: [primaryAction.icon && _jsx("span", { className: styles.icon, children: primaryAction.icon }), _jsx("span", { children: primaryAction.label })] }))] }))] }) }), document.body);
115
- }
@@ -1,109 +0,0 @@
1
- .overlay {
2
- position: fixed;
3
- inset: 0;
4
- background: var(--overlay-scrim);
5
-
6
- display: flex;
7
- justify-content: center;
8
-
9
- padding: clamp(var(--spacing-sm), 10vh, var(--spacing-xl));
10
- z-index: var(--z-backdrop-modal);
11
-
12
- /* Always a scroll container so overscroll-behavior can absorb wheel/touch
13
- events and prevent the background page from scrolling. */
14
- overflow-y: scroll;
15
- overscroll-behavior: none;
16
-
17
- /* Hide the overlay's own scrollbar — it's only there to absorb events */
18
- scrollbar-width: none;
19
- }
20
-
21
- .overlay::-webkit-scrollbar {
22
- display: none;
23
- }
24
-
25
- /* Default width can be overridden by --modal-width from props */
26
- .modal {
27
- --modal-width: 500px;
28
-
29
- background: var(--color-bg-surface);
30
- border-radius: var(--border-radius-lg);
31
- box-shadow: var(--shadow-lg);
32
- font-family: var(--font-family);
33
- color: var(--color-fg-default);
34
- z-index: var(--z-modal);
35
-
36
- /* Responsive width: never exceed viewport */
37
- width: min(
38
- var(--modal-width),
39
- calc(100vw - 2 * clamp(var(--spacing-sm), 4vw, var(--spacing-lg)))
40
- );
41
- min-width: 320px;
42
-
43
- /* Critical: prevent “below bottom of screen”
44
- Prefer svh on mobile; fallback to vh. */
45
- max-height: calc(100svh - 2 * clamp(var(--spacing-sm), 10vh, var(--spacing-xl)));
46
- max-height: calc(100vh - 2 * clamp(var(--spacing-sm), 10vh, var(--spacing-xl)));
47
-
48
- display: flex;
49
- flex-direction: column;
50
-
51
- /* If you want it slightly lower than top padding, keep it aligned start */
52
- align-self: flex-start;
53
-
54
- /* Helps on iOS when address bar changes */
55
- overscroll-behavior: contain;
56
- }
57
-
58
- /* Header/footer pinned; body scrolls */
59
- .header {
60
- font-size: var(--font-size-md);
61
- font-weight: var(--font-weight-semibold);
62
-
63
- display: flex;
64
- justify-content: space-between;
65
- align-items: center;
66
-
67
- padding: var(--spacing-md);
68
- padding-bottom: 0;
69
-
70
- /* Keeps header readable if body scrolls underneath */
71
- flex: 0 0 auto;
72
- }
73
-
74
- .body {
75
- flex: 1 1 auto;
76
- overflow: auto;
77
-
78
- font-size: var(--font-size-sm);
79
- line-height: var(--line-height-normal);
80
- color: var(--color-fg-muted);
81
-
82
- padding: var(--spacing-md);
83
- min-height: 0; /* IMPORTANT: allows flex child to actually scroll */
84
- }
85
-
86
- .footer {
87
- flex: 0 0 auto;
88
-
89
- display: flex;
90
- justify-content: flex-end;
91
- gap: var(--spacing-xs);
92
-
93
- padding: var(--spacing-md);
94
- padding-top: 0;
95
- }
96
-
97
- .icon {
98
- display: inline-flex;
99
- align-items: center;
100
- justify-content: center;
101
- }
102
-
103
- .contentSpacing .body > :first-child {
104
- margin-top: 0;
105
- }
106
-
107
- .contentSpacing .body > :last-child {
108
- margin-bottom: 0;
109
- }
@@ -1,73 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { createContext, useCallback, useContext, useEffect, useRef, useState, } from 'react';
4
- import { createPortal } from 'react-dom';
5
- import { Modal } from '../Modal';
6
- const ModalContext = createContext(undefined);
7
- export function ModalProvider({ children }) {
8
- const [isOpen, setIsOpen] = useState(false);
9
- const [config, setConfig] = useState(null);
10
- const [mounted, setMounted] = useState(false);
11
- useEffect(() => {
12
- setMounted(true); // eslint-disable-line react-hooks/set-state-in-effect -- intentional: SSR portal guard, runs once after hydration
13
- }, []);
14
- const [isLoading, setIsLoading] = useState(false);
15
- const markAsLoading = useCallback((loading = true) => setIsLoading(loading), []);
16
- const pendingResolverRef = useRef(null);
17
- const resolvePending = useCallback((value) => {
18
- if (pendingResolverRef.current) {
19
- pendingResolverRef.current(value);
20
- pendingResolverRef.current = null;
21
- }
22
- }, []);
23
- const closeModal = useCallback(() => {
24
- setIsOpen(false);
25
- setIsLoading(false);
26
- }, []);
27
- const openModal = useCallback((newConfig) => {
28
- resolvePending(false);
29
- setConfig(newConfig);
30
- setIsOpen(true);
31
- }, [resolvePending]);
32
- const handleRequestClose = useCallback(() => {
33
- var _a;
34
- (_a = config === null || config === void 0 ? void 0 : config.onRequestClose) === null || _a === void 0 ? void 0 : _a.call(config);
35
- resolvePending(false);
36
- closeModal();
37
- }, [config, closeModal, resolvePending]);
38
- const confirm = useCallback((confirmConfig) => {
39
- return new Promise(resolve => {
40
- resolvePending(false);
41
- pendingResolverRef.current = resolve;
42
- const { confirmLabel = 'Ok', cancelLabel = 'Annuller', ...rest } = confirmConfig;
43
- setConfig({
44
- ...rest,
45
- primaryAction: {
46
- label: confirmLabel,
47
- severity: confirmConfig.confirmButtonSeverity || 'primary',
48
- onClick: () => {
49
- resolvePending(true);
50
- closeModal();
51
- },
52
- },
53
- secondaryAction: {
54
- label: cancelLabel,
55
- onClick: () => {
56
- resolvePending(false);
57
- closeModal();
58
- },
59
- },
60
- });
61
- setIsOpen(true);
62
- });
63
- }, [resolvePending]);
64
- const modalNode = (_jsxs(ModalContext.Provider, { value: { openModal, closeModal, confirm, markAsLoading }, children: [children, mounted &&
65
- createPortal(_jsx(Modal, { ...(config !== null && config !== void 0 ? config : {}), isOpen: isOpen, isLoading: isLoading, onRequestClose: handleRequestClose, children: config === null || config === void 0 ? void 0 : config.children }), document.body)] }));
66
- return modalNode;
67
- }
68
- export function useModal() {
69
- const ctx = useContext(ModalContext);
70
- if (!ctx)
71
- throw new Error('useModal must be used within a ModalProvider');
72
- return ctx;
73
- }
@@ -1,83 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { X } from 'lucide-react';
3
- import { useEffect, useRef, useState, } from 'react';
4
- import { createPortal } from 'react-dom';
5
- import { Button } from '../../../components/button/Button';
6
- import { Headline } from '../../../components/headline/Headline';
7
- import { MOTION_MS } from '../../../styles/animation';
8
- import styles from './SidePanel.module.css';
9
- export function SidePanel({ isOpen, onClose, children, header, subheader, headerAddition, actions, showBackdrop = true, severity, showHeaderMarker = true, width = '400px', details, detailsHeader = 'Output', detailsWidth = '420px', onCloseDetails, detailsHeaderAddition, ...props }) {
10
- const [mounted, setMounted] = useState(false);
11
- const [shouldRender, setShouldRender] = useState(isOpen);
12
- const [isActive, setIsActive] = useState(false);
13
- const panelRef = useRef(null);
14
- useEffect(() => setMounted(true), []);
15
- // OPEN: ensure rendered so animation can play
16
- useEffect(() => {
17
- if (isOpen)
18
- setShouldRender(true);
19
- }, [isOpen]);
20
- // Close on ESC key
21
- useEffect(() => {
22
- if (!isOpen)
23
- return;
24
- const handleKeyDown = (e) => {
25
- if (e.key === 'Escape') {
26
- e.stopPropagation();
27
- onClose();
28
- }
29
- };
30
- document.addEventListener('keydown', handleKeyDown);
31
- return () => {
32
- document.removeEventListener('keydown', handleKeyDown);
33
- };
34
- }, [isOpen, onClose]);
35
- // Two-phase OPEN/CLOSE class toggle (lets CSS transitions kick in reliably)
36
- useEffect(() => {
37
- if (!shouldRender)
38
- return;
39
- if (!isOpen) {
40
- setIsActive(false);
41
- return;
42
- }
43
- const raf = requestAnimationFrame(() => setIsActive(true));
44
- return () => cancelAnimationFrame(raf);
45
- }, [isOpen, shouldRender]);
46
- // When closing: wait for transform transition end to unmount.
47
- useEffect(() => {
48
- if (!shouldRender)
49
- return;
50
- const el = panelRef.current;
51
- if (!el)
52
- return;
53
- const onTransitionEnd = (e) => {
54
- if (e.target !== el)
55
- return;
56
- if (e.propertyName !== 'transform')
57
- return;
58
- if (!isOpen)
59
- setShouldRender(false);
60
- };
61
- el.addEventListener('transitionend', onTransitionEnd);
62
- return () => el.removeEventListener('transitionend', onTransitionEnd);
63
- }, [isOpen, shouldRender]);
64
- if (!mounted)
65
- return null;
66
- if (!shouldRender)
67
- return null;
68
- const hasDetails = Boolean(details);
69
- return createPortal(_jsxs(_Fragment, { children: [showBackdrop && (_jsx("div", { className: `${styles.backdrop} ${isActive ? styles.backdropOpen : ''}`, onClick: e => {
70
- e.stopPropagation();
71
- onClose(e);
72
- } })), _jsxs("div", { ref: panelRef, ...props, className: `${styles.sidePanel} ${isActive ? styles.open : ''} ${hasDetails ? styles.withDetails : styles.noDetails}`, style: {
73
- '--side-panel-width': width,
74
- '--details-width': detailsWidth,
75
- '--panel-dur': MOTION_MS.panelSlide + 'ms',
76
- }, "data-cy": "details-panel", role: "dialog", "aria-modal": "true", children: [hasDetails ? (_jsxs("aside", { className: styles.detailsCol, "data-cy": "details-panel-details", children: [_jsxs("div", { className: styles.detailsHeader, children: [_jsx("div", { className: styles.detailsTitle, children: detailsHeader }), _jsxs("div", { className: styles.detailsHeaderActions, children: [detailsHeaderAddition, onCloseDetails ? (_jsx(Button, { type: "button", size: "sm", variant: "outlined", onClick: e => {
77
- e.stopPropagation();
78
- onCloseDetails();
79
- }, children: "Luk" })) : null] })] }), _jsx("div", { className: styles.detailsContent, children: details })] })) : null, _jsxs("section", { className: styles.mainCol, "data-cy": "details-panel-main", children: [_jsx("div", { className: styles.header, children: _jsxs("div", { className: "dbc-flex dbc-justify-between", children: [_jsx(Headline, { size: 3, disableMargin: true, severity: severity, marker: showHeaderMarker, subheader: subheader, children: header }), _jsxs("span", { className: "dbc-flex dbc-items-center dbc-gap-xs", children: [headerAddition, _jsx(Button, { type: "button", size: "md", shape: "round", variant: "inline", onClick: e => {
80
- e.stopPropagation();
81
- onClose(e);
82
- }, "aria-label": "Luk panel", "data-cy": "side-panel-close-button", children: _jsx(X, {}) })] })] }) }), _jsx("div", { className: styles.content, "data-cy": "details-panel-content", children: children }), actions && _jsx("div", { className: styles.actions, children: actions })] })] })] }), document.body);
83
- }
@@ -1,177 +0,0 @@
1
- .sidePanel {
2
- --col-pad: var(--spacing-md);
3
-
4
- --panel-ease: cubic-bezier(0.22, 1, 0.36, 1); /* smooth spring-ish without overshoot */
5
-
6
- /* Shadow + edge */
7
- --shadow-opacity: 0.22;
8
- --edge-opacity: 0.12;
9
-
10
- box-sizing: border-box;
11
- padding: 0;
12
- height: 100vh;
13
-
14
- position: fixed;
15
- right: 0;
16
- top: 0;
17
-
18
- background-color: var(--color-bg-surface);
19
- z-index: var(--z-drawer);
20
-
21
- transform: translate3d(100%, 0, 0);
22
- transition: transform var(--panel-dur) var(--panel-ease);
23
- will-change: transform;
24
-
25
- display: grid;
26
- gap: var(--spacing-md);
27
- align-items: stretch;
28
-
29
- overflow: hidden;
30
- pointer-events: auto;
31
-
32
- /* Make pseudo-elements layer properly */
33
- isolation: isolate;
34
- }
35
-
36
- /* “Lift” layer: drop-shadow + edge highlight (both fade in) */
37
- .sidePanel::before {
38
- content: '';
39
- position: absolute;
40
- inset: 0;
41
- pointer-events: none;
42
- z-index: -1; /* behind content but within isolated stacking context */
43
-
44
- /* 1) drop-shadow = smoother than animating box-shadow
45
- 2) edge gradient = premium depth cue */
46
- filter: drop-shadow(0 16px 32px rgba(0, 0, 0, var(--shadow-opacity)));
47
- opacity: 0;
48
-
49
- /* Edge highlight from the left edge (panel’s leading edge) */
50
- background: linear-gradient(
51
- 90deg,
52
- rgba(255, 255, 255, var(--edge-opacity)),
53
- rgba(255, 255, 255, 0) 36%
54
- );
55
-
56
- transition: opacity var(--panel-dur) var(--panel-ease);
57
-
58
- will-change: opacity;
59
- }
60
-
61
- /* Optional: super subtle “sheen” right as it settles (feels snappy) */
62
- .sidePanel.open::before {
63
- opacity: 1;
64
- }
65
-
66
- .sidePanel.open {
67
- transform: translate3d(0, 0, 0);
68
- }
69
-
70
- /* MAIN TRACK WIDTH = content + padding*2 */
71
- .sidePanel.noDetails {
72
- grid-template-columns: calc(var(--side-panel-width, 400px) + (var(--col-pad) * 2));
73
- width: calc(var(--side-panel-width, 400px) + (var(--col-pad) * 2));
74
- }
75
-
76
- /* when details show, main track stays the same; panel grows */
77
- .sidePanel.withDetails {
78
- grid-template-columns:
79
- calc(var(--side-panel-width, 400px) + (var(--col-pad) * 2))
80
- calc(var(--details-width, 420px) + (var(--col-pad) * 2));
81
-
82
- width: calc(
83
- (var(--side-panel-width, 400px) + (var(--col-pad) * 2)) +
84
- (var(--details-width, 420px) + (var(--col-pad) * 2)) + var(--spacing-md)
85
- );
86
- }
87
-
88
- /* columns get the padding */
89
- .mainCol,
90
- .detailsCol {
91
- box-sizing: border-box;
92
- padding: 0 var(--col-pad);
93
-
94
- min-width: 0;
95
- min-height: 0;
96
-
97
- display: flex;
98
- flex-direction: column;
99
- gap: var(--spacing-md);
100
- }
101
-
102
- .header {
103
- padding: var(--spacing-md) 0;
104
- }
105
-
106
- .content {
107
- flex: 1;
108
- min-height: 0;
109
- overflow: auto;
110
- font-size: var(--font-size-sm);
111
- }
112
-
113
- .actions {
114
- padding: var(--spacing-md) 0;
115
- display: flex;
116
- justify-content: flex-end;
117
- gap: var(--spacing-sm);
118
- min-width: 0;
119
- }
120
-
121
- /* details styling */
122
- .detailsCol {
123
- border: 1px solid var(--color-border-subtle);
124
- border-radius: var(--radius-md);
125
- overflow: hidden;
126
- background: var(--color-bg-surface);
127
- }
128
-
129
- .detailsHeader {
130
- padding: var(--spacing-sm) 0;
131
- border-bottom: 1px solid var(--color-border-subtle);
132
- display: flex;
133
- align-items: center;
134
- justify-content: space-between;
135
- gap: var(--spacing-sm);
136
- }
137
-
138
- .detailsTitle {
139
- font-weight: 600;
140
- }
141
-
142
- .detailsHeaderActions {
143
- display: flex;
144
- align-items: center;
145
- gap: var(--spacing-sm);
146
- }
147
-
148
- .detailsContent {
149
- padding: var(--spacing-md) 0;
150
- overflow: auto;
151
- min-height: 0;
152
- flex: 1 1 auto;
153
- }
154
-
155
- /* Backdrop with a nice fade */
156
- .backdrop {
157
- position: fixed;
158
- inset: 0;
159
- background-color: rgba(0, 0, 0, 0.45);
160
- z-index: var(--z-backdrop-drawer);
161
-
162
- opacity: 0;
163
- transition: opacity var(--panel-dur) var(--panel-ease);
164
- will-change: opacity;
165
- }
166
-
167
- .backdropOpen {
168
- opacity: 1;
169
- }
170
-
171
- @media (prefers-reduced-motion: reduce) {
172
- .sidePanel,
173
- .sidePanel::before,
174
- .backdrop {
175
- transition: none !important;
176
- }
177
- }
@@ -1,11 +0,0 @@
1
- import { useState } from 'react';
2
- export function useSidePanel(initialOpen = false) {
3
- const [isOpen, setIsOpen] = useState(initialOpen);
4
- const openSidePanel = () => setIsOpen(true);
5
- const closeSidePanel = () => setIsOpen(false);
6
- return {
7
- isOpen,
8
- openSidePanel,
9
- closeSidePanel,
10
- };
11
- }
@@ -1,17 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
3
- import { useTooltipTrigger } from './useTooltipTrigger';
4
- export function Tooltip({ children, content, placement = 'top', open, offset = 8, delayOpenMs, delayCloseMs, className, ...rest }) {
5
- const { triggerProps } = useTooltipTrigger({
6
- content,
7
- placement,
8
- offset,
9
- open,
10
- delayOpenMs,
11
- delayCloseMs,
12
- });
13
- const rootClass = useMemo(() => ['TooltipContainer', className].filter(Boolean).join(' '), [className]);
14
- if (!content)
15
- return _jsx(_Fragment, { children: children });
16
- return (_jsx("span", { className: rootClass, ...rest, children: _jsx("span", { className: "TooltipTrigger", tabIndex: 0, ...triggerProps, children: children }) }));
17
- }