@dbcdk/react-components 0.0.77 → 0.0.79

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.
@@ -149,7 +149,7 @@ const MenuRadioItem = React.forwardRef(({ name, value, checked, disabled, label,
149
149
  if ((_a = target.closest('label')) !== null && _a !== void 0 ? _a : target.closest('input'))
150
150
  return;
151
151
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(value);
152
- }, children: _jsx(RadioButton, { noContainer: true, name: name, value: value, checked: checked, disabled: disabled, label: label, onChange: (v, _e) => onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(v) }) }) }));
152
+ }, children: _jsx(RadioButton, { noContainer: true, name: name, size: "sm", value: value, checked: checked, disabled: disabled, label: label, onChange: (v, _e) => onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(v) }) }) }));
153
153
  });
154
154
  MenuRadioItem.displayName = 'Menu.RadioItem';
155
155
  const MenuSeparator = React.forwardRef(({ className, ...props }, ref) => (_jsx("li", { ref: ref, role: "separator", className: [styles.separator, className].filter(Boolean).join(' '), ...props })));
@@ -22,21 +22,18 @@
22
22
  inline-size: 100%;
23
23
  text-align: start;
24
24
  text-decoration: none;
25
-
26
- padding-block: var(--spacing-xs);
25
+ padding-block: var(--spacing-xxs);
27
26
  padding-inline: var(--spacing-md);
28
-
27
+ margin-block: var(--spacing-2xs);
28
+ min-block-size: var(--component-size-sm);
29
29
  background: transparent;
30
30
  border: none;
31
-
32
31
  font-family: var(--font-family);
33
32
  font-size: var(--font-size-sm);
34
33
  line-height: var(--line-height-normal);
35
34
  color: var(--color-fg-default);
36
35
  cursor: pointer;
37
-
38
- border-radius: var(--border-radius-sm);
39
-
36
+ border-radius: var(--border-radius-md);
40
37
  transition:
41
38
  background-color var(--transition-fast) var(--ease-standard),
42
39
  color var(--transition-fast) var(--ease-standard);
@@ -56,17 +53,19 @@
56
53
  .interactiveChild {
57
54
  display: block;
58
55
  inline-size: 100%;
59
- border-radius: var(--border-radius-sm);
56
+ border-radius: var(--border-radius-md);
60
57
  }
61
58
 
62
59
  /* NEW: make wrapper-children (Checkbox/Radio) look/space like menu rows */
63
60
  .row > .interactiveChild {
64
61
  display: flex;
65
- align-items: flex-start;
62
+ align-items: center;
66
63
  inline-size: 100%;
67
- padding-block: var(--spacing-xs);
64
+ padding-block: var(--spacing-xxs);
68
65
  padding-inline: var(--spacing-md);
69
- border-radius: var(--border-radius-sm);
66
+ margin-block: var(--spacing-2xs);
67
+ min-block-size: var(--component-size-sm);
68
+ border-radius: var(--border-radius-md);
70
69
  cursor: pointer;
71
70
  }
72
71
 
@@ -174,7 +173,7 @@
174
173
  /* Visual separator row (used by <Menu.Separator />) */
175
174
  .separator {
176
175
  block-size: 1px;
177
- margin-block: var(--spacing-2xs);
176
+ margin-block: var(--spacing-xxs);
178
177
  background: var(--color-border-subtle);
179
178
  opacity: 0.8;
180
179
  border-radius: 999px;
@@ -201,7 +200,7 @@
201
200
  /* Bordered item variant */
202
201
  .rowBordered {
203
202
  border: 1px solid var(--color-border-default);
204
- border-radius: var(--border-radius-default);
203
+ border-radius: var(--border-radius-md);
205
204
  overflow: hidden;
206
205
  }
207
206
 
@@ -13,6 +13,7 @@ type ModalContextValue = {
13
13
  openModal: (config: ModalConfig) => void;
14
14
  closeModal: () => void;
15
15
  confirm: (config: ConfirmModalConfig) => Promise<boolean>;
16
+ markAsLoading: (loading?: boolean) => void;
16
17
  };
17
18
  type ModalProviderProps = {
18
19
  children: ReactNode;
@@ -8,7 +8,11 @@ export function ModalProvider({ children }) {
8
8
  const [isOpen, setIsOpen] = useState(false);
9
9
  const [config, setConfig] = useState(null);
10
10
  const [mounted, setMounted] = useState(false);
11
- useEffect(() => setMounted(true), []);
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), []);
12
16
  const pendingResolverRef = useRef(null);
13
17
  const resolvePending = useCallback((value) => {
14
18
  if (pendingResolverRef.current) {
@@ -18,6 +22,7 @@ export function ModalProvider({ children }) {
18
22
  }, []);
19
23
  const closeModal = useCallback(() => {
20
24
  setIsOpen(false);
25
+ setIsLoading(false);
21
26
  }, []);
22
27
  const openModal = useCallback((newConfig) => {
23
28
  resolvePending(false);
@@ -54,8 +59,8 @@ export function ModalProvider({ children }) {
54
59
  setIsOpen(true);
55
60
  });
56
61
  }, [resolvePending]);
57
- const modalNode = (_jsxs(ModalContext.Provider, { value: { openModal, closeModal, confirm }, children: [children, mounted &&
58
- createPortal(_jsx(Modal, { ...(config !== null && config !== void 0 ? config : {}), isOpen: isOpen, onRequestClose: handleRequestClose, children: config === null || config === void 0 ? void 0 : config.children }), document.body)] }));
62
+ const modalNode = (_jsxs(ModalContext.Provider, { value: { openModal, closeModal, confirm, markAsLoading }, children: [children, mounted &&
63
+ 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)] }));
59
64
  return modalNode;
60
65
  }
61
66
  export function useModal() {
@@ -1,11 +1,12 @@
1
1
  import type { ReactNode, JSX } from 'react';
2
2
  interface PanelProps {
3
- header: string;
3
+ header: ReactNode;
4
4
  headerIcon?: ReactNode;
5
+ headerAddition?: ReactNode;
5
6
  severity?: Severity;
6
7
  children: ReactNode;
7
8
  size?: 'sm' | 'md' | 'lg';
8
9
  }
9
10
  import { Severity } from '../../constants/severity.types';
10
- export declare function Panel({ header, headerIcon, children, severity, size }: PanelProps): JSX.Element;
11
+ export declare function Panel({ header, headerIcon, headerAddition, children, severity, size, }: PanelProps): JSX.Element;
11
12
  export {};
@@ -2,6 +2,6 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import styles from './Panel.module.css';
4
4
  import { Headline } from '../headline/Headline';
5
- export function Panel({ header, headerIcon, children, severity, size }) {
6
- return (_jsxs("section", { className: `${styles.container} ${size ? styles[size] : ''}`, children: [_jsx("div", { className: styles.header, children: _jsx(Headline, { disableMargin: true, size: 3, icon: headerIcon, severity: severity, children: header }) }), _jsx("div", { className: styles.content, children: children })] }));
5
+ export function Panel({ header, headerIcon, headerAddition, children, severity, size, }) {
6
+ return (_jsxs("section", { className: `${styles.container} ${size ? styles[size] : ''}`, children: [_jsx("div", { className: styles.header, children: _jsx(Headline, { disableMargin: true, size: size === 'sm' ? 4 : 3, icon: headerIcon, addition: headerAddition, severity: severity, children: header }) }), _jsx("div", { className: styles.content, children: children })] }));
7
7
  }
@@ -1,6 +1,6 @@
1
1
  .container {
2
- border: var(--border-width-thin) solid var(--color-border-default);
3
- border-radius: var(--border-radius-default);
2
+ border: var(--border-width-thin) solid var(--color-border-subtle);
3
+ border-radius: var(--border-radius-md);
4
4
  background-color: var(--color-bg-surface);
5
5
  box-sizing: border-box;
6
6
  display: flex;
@@ -8,7 +8,8 @@
8
8
  }
9
9
 
10
10
  .header {
11
- border-bottom: var(--border-width-thin) solid var(--color-border-default);
11
+ border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
12
+ border-bottom: var(--border-width-thin) solid var(--color-border-subtle);
12
13
  }
13
14
 
14
15
  .content {
@@ -17,11 +18,12 @@
17
18
 
18
19
  .header {
19
20
  padding: var(--spacing-sm) var(--spacing-md);
21
+ background-color: var(--table-header-bg);
20
22
  }
21
23
 
22
24
  .container.sm {
23
25
  .header,
24
26
  .content {
25
- padding: var(--spacing-sm) var(--spacing-md);
27
+ padding: var(--spacing-xs) var(--spacing-md);
26
28
  }
27
29
  }
@@ -41,7 +41,7 @@
41
41
  border: 1px solid var(--color-border-subtle);
42
42
  background-color: var(--color-bg-surface);
43
43
  border-radius: var(--border-radius-lg);
44
- padding-block: var(--spacing-xxs);
44
+ padding: var(--spacing-xxs);
45
45
  z-index: var(--z-popover);
46
46
  overflow: auto;
47
47
  box-shadow:
@@ -52,8 +52,3 @@
52
52
  .content[hidden] {
53
53
  display: none;
54
54
  }
55
-
56
- .content svg {
57
- height: 20px;
58
- width: 20px;
59
- }
@@ -47,7 +47,7 @@
47
47
  }
48
48
 
49
49
  .container:not(.active):hover {
50
- background-color: var(--color-bg-contextual);
50
+ background-color: var(--color-bg-toolbar-hover);
51
51
 
52
52
  color: var(--color-fg-default);
53
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.77",
3
+ "version": "0.0.79",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",