@dbcdk/react-components 0.0.73 → 0.0.74

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.
@@ -41,19 +41,19 @@
41
41
 
42
42
  /* Marker variant */
43
43
  .headline.marker {
44
- padding-inline-start: calc(var(--border-width-thick) + var(--spacing-sm));
44
+ padding-inline-start: calc(var(--border-width-medium) + var(--spacing-sm));
45
45
  }
46
46
 
47
47
  .headline.marker::before {
48
48
  content: '';
49
49
  position: absolute;
50
- inset-block: 0;
50
+ inset-block-start: 50%;
51
+ transform: translateY(-50%);
52
+ block-size: 0.75em;
51
53
  inset-inline-start: 0;
52
- inline-size: var(--border-width-thick);
54
+ inline-size: var(--border-width-medium);
53
55
  background-color: var(--marker-color, var(--color-brand));
54
- border-start-start-radius: var(--border-radius-default);
55
- border-end-start-radius: var(--border-radius-default);
56
- box-shadow: inset 0 0 0 1px var(--color-border-subtle);
56
+ border-radius: var(--border-radius-sm);
57
57
  pointer-events: none;
58
58
  }
59
59
 
@@ -8,5 +8,6 @@ export interface JsonViewerProps {
8
8
  searchPlaceholder?: string;
9
9
  emptySearchText?: string;
10
10
  className?: string;
11
+ maxHeight?: number | string;
11
12
  }
12
- export declare function JsonViewer({ value, defaultExpandedDepth, expandAll, searchDebounceMs, helperText, searchPlaceholder, emptySearchText, className, }: JsonViewerProps): JSX.Element;
13
+ export declare function JsonViewer({ value, defaultExpandedDepth, expandAll, searchDebounceMs, helperText, searchPlaceholder, emptySearchText, className, maxHeight, }: JsonViewerProps): JSX.Element;
@@ -158,7 +158,7 @@ function collectInitiallyExpandedNodeIds(value, defaultExpandedDepth, expandAll,
158
158
  ]));
159
159
  return includeNode ? [nodeId, ...nested] : nested;
160
160
  }
161
- export function JsonViewer({ value, defaultExpandedDepth = 2, expandAll = false, searchDebounceMs = 180, helperText, searchPlaceholder = 'Søg i nøgler, stier og værdier', emptySearchText = 'Ingen matchende noder fundet.', className, }) {
161
+ export function JsonViewer({ value, defaultExpandedDepth = 2, expandAll = false, searchDebounceMs = 180, helperText, searchPlaceholder = 'Søg i nøgler, stier og værdier', emptySearchText = 'Ingen matchende noder fundet.', className, maxHeight, }) {
162
162
  const [queryInput, setQueryInput] = useState('');
163
163
  const [query, setQuery] = useState('');
164
164
  const normalizedQuery = normalizeSearch(query);
@@ -214,7 +214,9 @@ export function JsonViewer({ value, defaultExpandedDepth = 2, expandAll = false,
214
214
  setQuery('');
215
215
  }, children: _jsx(X, { "aria-hidden": "true" }) })) : null] }), _jsxs("div", { className: styles.actions, children: [_jsx("button", { type: "button", className: styles.toolbarButton, onClick: handleExpandAll, disabled: Boolean(normalizedQuery), children: "Fold alle ud" }), _jsx("button", { type: "button", className: styles.toolbarButton, onClick: handleCollapseAll, disabled: Boolean(normalizedQuery), children: "Fold alle sammen" })] })] }), _jsxs("div", { className: styles.metaRow, children: [helperText ? _jsx("span", { className: styles.helperText, children: helperText }) : _jsx("span", {}), _jsx("span", { className: styles.statusText, children: normalizedQuery
216
216
  ? `${matches.size} matchende node${matches.size === 1 ? '' : 'r'}`
217
- : '' })] })] }), _jsx("div", { className: styles.treePane, role: "tree", "aria-label": "JSON-visning", children: hasResults ? (_jsx(JsonNode, { keyName: undefined, path: [], value: safeValue, depth: 0, defaultExpandedDepth: defaultExpandedDepth, query: normalizedQuery, matches: matches, expandedNodeIds: expandedNodeIds, onToggleNode: handleToggleNode, copiedId: copiedId, onCopy: handleCopy })) : (_jsx("div", { className: styles.emptyState, children: emptySearchText })) })] }));
217
+ : '' })] })] }), _jsx("div", { className: styles.treePane, role: "tree", "aria-label": "JSON-visning", style: maxHeight !== undefined
218
+ ? { maxHeight: typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight }
219
+ : undefined, children: hasResults ? (_jsx(JsonNode, { keyName: undefined, path: [], value: safeValue, depth: 0, defaultExpandedDepth: defaultExpandedDepth, query: normalizedQuery, matches: matches, expandedNodeIds: expandedNodeIds, onToggleNode: handleToggleNode, copiedId: copiedId, onCopy: handleCopy })) : (_jsx("div", { className: styles.emptyState, children: emptySearchText })) })] }));
218
220
  }
219
221
  function JsonNode({ keyName, path, value, depth, defaultExpandedDepth, query, matches, expandedNodeIds, onToggleNode, copiedId, onCopy, }) {
220
222
  const nodeId = getNodeId(path);
@@ -17,17 +17,8 @@ export function Modal({ isOpen, onRequestClose, header, content, children, prima
17
17
  onRequestCloseRef.current = onRequestClose;
18
18
  }, [onRequestClose]);
19
19
  useEffect(() => {
20
- setMounted(true);
20
+ setMounted(true); // eslint-disable-line react-hooks/set-state-in-effect -- intentional: SSR portal guard, runs once after hydration
21
21
  }, []);
22
- useEffect(() => {
23
- if (!isOpen)
24
- return;
25
- const previous = document.body.style.overflow;
26
- document.body.style.overflow = 'hidden';
27
- return () => {
28
- document.body.style.overflow = previous;
29
- };
30
- }, [isOpen]);
31
22
  // Track open transition so we only autofocus once per open
32
23
  const wasOpenRef = useRef(false);
33
24
  useEffect(() => {
@@ -112,7 +103,7 @@ export function Modal({ isOpen, onRequestClose, header, content, children, prima
112
103
  const stopPropagation = e => {
113
104
  e.stopPropagation();
114
105
  };
115
- const resolvedSecondaryAction = secondaryAction !== null && secondaryAction !== void 0 ? secondaryAction : (primaryAction ? { label: 'Luk', onClick: onRequestCloseRef.current } : undefined);
106
+ const resolvedSecondaryAction = secondaryAction !== null && secondaryAction !== void 0 ? secondaryAction : (primaryAction ? { label: 'Luk', onClick: onRequestClose } : undefined);
116
107
  const shouldRenderFooter = Boolean(primaryAction || resolvedSecondaryAction);
117
108
  const body = children !== null && children !== void 0 ? children : content;
118
109
  const resolvedWidth = typeof width === 'number' ? `${width}px` : typeof width === 'string' ? width : undefined;
@@ -9,8 +9,17 @@
9
9
  padding: clamp(var(--spacing-sm), 10vh, var(--spacing-xl));
10
10
  z-index: var(--z-backdrop-modal);
11
11
 
12
- /* Overlay can scroll if modal is taller than viewport */
13
- overflow-y: auto;
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;
14
23
  }
15
24
 
16
25
  /* Default width can be overridden by --modal-width from props */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.73",
3
+ "version": "0.0.74",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",