@dbcdk/react-components 0.0.10 → 0.0.13
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.
- package/dist/components/accordion/Accordion.d.ts +2 -2
- package/dist/components/accordion/Accordion.js +34 -41
- package/dist/components/accordion/Accordion.module.css +13 -72
- package/dist/components/accordion/components/AccordionRow.d.ts +10 -0
- package/dist/components/accordion/components/AccordionRow.js +51 -0
- package/dist/components/accordion/components/AccordionRow.module.css +82 -0
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +0 -1
- package/dist/components/button/Button.module.css +7 -7
- package/dist/components/card/Card.d.ts +15 -6
- package/dist/components/card/Card.js +39 -13
- package/dist/components/card/Card.module.css +22 -28
- package/dist/components/card/components/CardMeta.d.ts +15 -0
- package/dist/components/card/components/CardMeta.js +20 -0
- package/dist/components/card/components/CardMeta.module.css +51 -0
- package/dist/components/card-container/CardContainer.js +1 -1
- package/dist/components/card-container/CardContainer.module.css +3 -1
- package/dist/components/chip/Chip.module.css +7 -2
- package/dist/components/circle/Circle.d.ts +2 -1
- package/dist/components/circle/Circle.js +2 -2
- package/dist/components/circle/Circle.module.css +6 -2
- package/dist/components/code-block/CodeBlock.js +1 -1
- package/dist/components/code-block/CodeBlock.module.css +30 -17
- package/dist/components/copy-button/CopyButton.d.ts +1 -0
- package/dist/components/copy-button/CopyButton.js +10 -2
- package/dist/components/datetime-picker/DateTimePicker.d.ts +33 -8
- package/dist/components/datetime-picker/DateTimePicker.js +119 -78
- package/dist/components/datetime-picker/DateTimePicker.module.css +2 -0
- package/dist/components/datetime-picker/dateTimeHelpers.d.ts +15 -3
- package/dist/components/datetime-picker/dateTimeHelpers.js +137 -23
- package/dist/components/filter-field/FilterField.js +16 -11
- package/dist/components/filter-field/FilterField.module.css +137 -16
- package/dist/components/forms/checkbox/Checkbox.d.ts +2 -2
- package/dist/components/forms/checkbox-group/CheckboxGroup.js +1 -1
- package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +1 -1
- package/dist/components/forms/form-select/FormSelect.d.ts +35 -0
- package/dist/components/forms/form-select/FormSelect.js +86 -0
- package/dist/components/forms/form-select/FormSelect.module.css +236 -0
- package/dist/components/forms/input/Input.d.ts +0 -3
- package/dist/components/forms/input/Input.js +1 -4
- package/dist/components/forms/input/Input.module.css +8 -7
- package/dist/components/forms/input-container/InputContainer.module.css +1 -1
- package/dist/components/forms/radio-buttons/RadioButtons.module.css +1 -0
- package/dist/components/forms/select/Select.js +55 -16
- package/dist/components/hyperlink/Hyperlink.d.ts +19 -7
- package/dist/components/hyperlink/Hyperlink.js +35 -11
- package/dist/components/hyperlink/Hyperlink.module.css +50 -2
- package/dist/components/interval-select/IntervalSelect.d.ts +9 -2
- package/dist/components/interval-select/IntervalSelect.js +21 -6
- package/dist/components/menu/Menu.d.ts +29 -0
- package/dist/components/menu/Menu.js +61 -16
- package/dist/components/menu/Menu.module.css +73 -5
- package/dist/components/overlay/modal/Modal.module.css +4 -3
- package/dist/components/overlay/modal/provider/ModalProvider.js +1 -3
- package/dist/components/overlay/side-panel/SidePanel.js +18 -1
- package/dist/components/overlay/side-panel/SidePanel.module.css +1 -3
- package/dist/components/overlay/tooltip/useTooltipTrigger.js +4 -2
- package/dist/components/page-layout/PageLayout.d.ts +16 -4
- package/dist/components/page-layout/PageLayout.js +57 -28
- package/dist/components/page-layout/PageLayout.module.css +153 -33
- package/dist/components/popover/Popover.d.ts +17 -4
- package/dist/components/popover/Popover.js +147 -65
- package/dist/components/popover/Popover.module.css +5 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +22 -18
- package/dist/components/sidebar/providers/SidebarProvider.d.ts +4 -1
- package/dist/components/sidebar/providers/SidebarProvider.js +66 -18
- package/dist/components/split-button/SplitButton.d.ts +1 -1
- package/dist/components/split-button/SplitButton.js +3 -1
- package/dist/components/split-button/SplitButton.module.css +4 -4
- package/dist/components/split-pane/SplitPane.d.ts +10 -24
- package/dist/components/split-pane/SplitPane.js +83 -54
- package/dist/components/split-pane/SplitPane.module.css +11 -6
- package/dist/components/split-pane/provider/SplitPaneContext.js +5 -11
- package/dist/components/state-page/StatePage.module.css +1 -1
- package/dist/components/sticky-footer-layout/StickyFooterLayout.d.ts +3 -8
- package/dist/components/sticky-footer-layout/StickyFooterLayout.js +57 -20
- package/dist/components/table/Table.d.ts +8 -8
- package/dist/components/table/Table.js +37 -79
- package/dist/components/table/Table.module.css +62 -46
- package/dist/components/table/{tanstack.d.ts → TanstackTable.d.ts} +7 -3
- package/dist/components/table/TanstackTable.js +84 -0
- package/dist/components/table/components/column-resizer/ColumnResizer.js +1 -1
- package/dist/components/table/components/column-resizer/ColumnResizer.module.css +17 -7
- package/dist/components/table/components/table-settings/TableSettings.d.ts +13 -3
- package/dist/components/table/components/table-settings/TableSettings.js +55 -4
- package/dist/components/table/table.utils.d.ts +17 -0
- package/dist/components/table/table.utils.js +61 -0
- package/dist/components/table/tanstackTable.utils.d.ts +22 -0
- package/dist/components/table/tanstackTable.utils.js +104 -0
- package/dist/components/tabs/Tabs.d.ts +35 -12
- package/dist/components/tabs/Tabs.js +114 -26
- package/dist/components/tabs/Tabs.module.css +158 -71
- package/dist/hooks/useTableSettings.d.ts +23 -4
- package/dist/hooks/useTableSettings.js +64 -17
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/src/styles/styles.css +38 -23
- package/dist/styles/animation.d.ts +5 -0
- package/dist/styles/animation.js +5 -0
- package/dist/styles/styles.css +38 -23
- package/dist/styles/themes/dbc/base.css +136 -0
- package/dist/styles/themes/dbc/dark.css +39 -202
- package/dist/styles/themes/dbc/light.css +17 -174
- package/dist/utils/localStorage.utils.d.ts +19 -0
- package/dist/utils/localStorage.utils.js +78 -0
- package/package.json +4 -4
- package/dist/components/table/tanstack.js +0 -162
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.grid {
|
|
2
|
+
margin: 0;
|
|
3
|
+
display: grid;
|
|
4
|
+
gap: var(--spacing-xs) var(--spacing-lg);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* Base: single column */
|
|
8
|
+
.cols1,
|
|
9
|
+
.cols2,
|
|
10
|
+
.cols3 {
|
|
11
|
+
grid-template-columns: 1fr;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media (min-width: 640px) {
|
|
15
|
+
.cols2 {
|
|
16
|
+
grid-template-columns: 1fr 1fr;
|
|
17
|
+
}
|
|
18
|
+
.cols3 {
|
|
19
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.row {
|
|
24
|
+
--label-width: 120px;
|
|
25
|
+
display: grid;
|
|
26
|
+
grid-template-columns: var(--label-width) 1fr;
|
|
27
|
+
gap: var(--spacing-xs);
|
|
28
|
+
align-items: baseline;
|
|
29
|
+
min-inline-size: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.label {
|
|
33
|
+
font-size: var(--font-size-xs);
|
|
34
|
+
color: var(--color-fg-subtle);
|
|
35
|
+
letter-spacing: var(--letter-spacing-wide);
|
|
36
|
+
text-transform: uppercase;
|
|
37
|
+
margin: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.value {
|
|
41
|
+
margin: 0;
|
|
42
|
+
font-size: var(--font-size-sm);
|
|
43
|
+
color: var(--color-fg-default);
|
|
44
|
+
font-weight: var(--font-weight-medium);
|
|
45
|
+
min-inline-size: 0;
|
|
46
|
+
word-break: break-word;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.nowrap {
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
}
|
|
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Headline } from '../../components/headline/Headline';
|
|
3
3
|
import styles from './CardContainer.module.css';
|
|
4
4
|
export function CardContainer({ children, headline, expand, severity, displayHeaderMarker, }) {
|
|
5
|
-
return (_jsxs("div", { className: styles.wrapper, children: [headline && (_jsx(Headline, { marker: displayHeaderMarker, severity: severity, children: headline })), _jsx("div", { className: styles.container, style: { ['--expand']: expand ? '1' : '0' }, children: children })] }));
|
|
5
|
+
return (_jsxs("div", { className: styles.wrapper, children: [headline && (_jsx(Headline, { marker: displayHeaderMarker, severity: severity, disableMargin: true, children: headline })), _jsx("div", { className: styles.container, style: { ['--expand']: expand ? '1' : '0' }, children: children })] }));
|
|
6
6
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
border-radius: var(--border-radius-default);
|
|
12
12
|
border: var(--border-width-thin) solid transparent;
|
|
13
13
|
|
|
14
|
-
padding-block:
|
|
14
|
+
padding-block: var(--spacing-xxs);
|
|
15
15
|
padding-inline: var(--spacing-md);
|
|
16
16
|
|
|
17
17
|
font-family: var(--font-family);
|
|
@@ -39,10 +39,15 @@
|
|
|
39
39
|
block-size: var(--icon-size-md);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
.sm svg {
|
|
43
|
+
inline-size: var(--icon-size-sm);
|
|
44
|
+
block-size: var(--icon-size-sm);
|
|
45
|
+
}
|
|
46
|
+
|
|
42
47
|
/* Small size */
|
|
43
48
|
.sm {
|
|
44
49
|
height: var(--component-size-xs);
|
|
45
|
-
padding-block:
|
|
50
|
+
padding-block: var(--spacing-xxs);
|
|
46
51
|
padding-inline: var(--spacing-xs);
|
|
47
52
|
font-size: var(--font-size-xs);
|
|
48
53
|
}
|
|
@@ -5,8 +5,9 @@ interface CircleProps {
|
|
|
5
5
|
severity: Severity;
|
|
6
6
|
children?: ReactNode;
|
|
7
7
|
glow?: boolean;
|
|
8
|
+
muted?: boolean;
|
|
8
9
|
pulse?: boolean;
|
|
9
10
|
size?: CircleSize;
|
|
10
11
|
}
|
|
11
|
-
export declare function Circle({ severity, children, glow, pulse, size }: CircleProps): JSX.Element;
|
|
12
|
+
export declare function Circle({ severity, children, glow, muted, pulse, size, }: CircleProps): JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styles from './Circle.module.css';
|
|
3
|
-
export function Circle({ severity, children, glow, pulse, size = 'sm' }) {
|
|
4
|
-
return (_jsxs("span", { className: styles.container, children: [_jsx("span", { "data-glow": glow, "data-pulse": pulse, "data-size": size, className: `${styles.circle} ${styles[severity]}` }), children] }));
|
|
3
|
+
export function Circle({ severity, children, glow, muted, pulse, size = 'sm', }) {
|
|
4
|
+
return (_jsxs("span", { className: styles.container, children: [_jsx("span", { "data-glow": glow, "data-pulse": pulse, "data-size": size, "data-muted": muted, className: `${styles.circle} ${styles[severity]}` }), children] }));
|
|
5
5
|
}
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
block-size: var(--component-size-sm);
|
|
17
17
|
border-radius: var(--border-radius-round);
|
|
18
18
|
flex-shrink: 0;
|
|
19
|
-
|
|
20
19
|
transition:
|
|
21
20
|
background-color var(--transition-fast) var(--ease-standard),
|
|
22
|
-
box-shadow var(--transition-fast) var(--ease-standard)
|
|
21
|
+
box-shadow var(--transition-fast) var(--ease-standard),
|
|
22
|
+
opacity var(--transition-normal) var(--ease-standard);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/* Density modifier (optional) */
|
|
@@ -77,6 +77,10 @@
|
|
|
77
77
|
block-size: 18px;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
.circle[data-muted='true'] {
|
|
81
|
+
opacity: 0.4;
|
|
82
|
+
}
|
|
83
|
+
|
|
80
84
|
.circle[data-size='lg'] {
|
|
81
85
|
inline-size: 22px;
|
|
82
86
|
block-size: 22px;
|
|
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import styles from './CodeBlock.module.css';
|
|
3
3
|
import { CopyButton } from '../copy-button/CopyButton';
|
|
4
4
|
export function CodeBlock({ code, copyButton, size = 'md' }) {
|
|
5
|
-
return (_jsxs("pre", { className: `${styles.container} ${styles[size]}`, children: [copyButton && (_jsx("span", { className: styles.copyButton, children: _jsx(CopyButton, { text: code }) })), _jsx("code", { className: styles.code, children: code })] }));
|
|
5
|
+
return (_jsxs("pre", { className: `${styles.container} ${styles[size]}`, tabIndex: 0, children: [copyButton && (_jsx("span", { className: styles.copyButton, children: _jsx(CopyButton, { style: "link", text: code }) })), _jsx("code", { className: styles.code, children: code })] }));
|
|
6
6
|
}
|
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
.container {
|
|
2
|
-
background-color: var(--color-bg-contextual);
|
|
3
2
|
position: relative;
|
|
4
|
-
padding: var(--spacing-sm);
|
|
5
|
-
border-radius: var(--border-radius-default);
|
|
6
|
-
border: var(--border-width-thin) solid var(--color-border-default);
|
|
7
3
|
margin-block: 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
|
|
5
|
+
background: var(--color-bg-contextual-subtle);
|
|
6
|
+
border: var(--border-width-thin) solid var(--color-border-default);
|
|
7
|
+
border-radius: var(--border-radius-lg);
|
|
8
|
+
box-shadow: var(--shadow-xs);
|
|
9
|
+
|
|
10
|
+
padding: var(--spacing-sm);
|
|
12
11
|
padding-inline-end: calc(var(--spacing-sm) + 40px);
|
|
12
|
+
|
|
13
|
+
font-family: var(--font-family-mono);
|
|
14
|
+
line-height: var(--line-height-relaxed);
|
|
15
|
+
|
|
16
|
+
overflow-x: auto;
|
|
17
|
+
overflow-y: hidden;
|
|
18
|
+
|
|
19
|
+
/* Nice: avoids layout shift if/when scrollbars appear (supported in modern browsers) */
|
|
20
|
+
scrollbar-gutter: stable;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.container:focus-within {
|
|
24
|
+
border-color: var(--color-border-selected);
|
|
25
|
+
box-shadow: var(--shadow-xs), var(--focus-ring);
|
|
13
26
|
}
|
|
14
27
|
|
|
15
28
|
.container.sm {
|
|
16
29
|
padding: var(--spacing-xs);
|
|
17
|
-
padding-inline-end: calc(var(--spacing-
|
|
18
|
-
min-height: 0;
|
|
30
|
+
padding-inline-end: calc(var(--spacing-xs) + 40px);
|
|
19
31
|
}
|
|
20
32
|
|
|
21
33
|
.container.sm .code {
|
|
@@ -25,6 +37,7 @@
|
|
|
25
37
|
.container.md .code {
|
|
26
38
|
font-size: var(--font-size-sm);
|
|
27
39
|
}
|
|
40
|
+
|
|
28
41
|
.container.lg .code {
|
|
29
42
|
font-size: var(--font-size-base);
|
|
30
43
|
}
|
|
@@ -33,11 +46,15 @@
|
|
|
33
46
|
display: block;
|
|
34
47
|
margin: 0;
|
|
35
48
|
font-family: var(--font-family-mono);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
49
|
+
color: var(--color-fg-default);
|
|
50
|
+
|
|
51
|
+
/* ✅ Preserve formatting but avoid ugly breaking */
|
|
52
|
+
white-space: pre-wrap;
|
|
53
|
+
overflow-wrap: anywhere;
|
|
54
|
+
word-break: normal; /* <- not break-all */
|
|
39
55
|
}
|
|
40
56
|
|
|
57
|
+
/* Copy button stays overlayed; does not affect layout */
|
|
41
58
|
.copyButton {
|
|
42
59
|
position: absolute;
|
|
43
60
|
top: var(--spacing-xs);
|
|
@@ -54,7 +71,3 @@
|
|
|
54
71
|
opacity: 1;
|
|
55
72
|
pointer-events: auto;
|
|
56
73
|
}
|
|
57
|
-
|
|
58
|
-
.copyButton button {
|
|
59
|
-
pointer-events: auto;
|
|
60
|
-
}
|
|
@@ -4,8 +4,9 @@ import { Check, Copy } from 'lucide-react';
|
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import styles from './CopyButton.module.css';
|
|
6
6
|
import { Button } from '../button/Button';
|
|
7
|
+
import { Hyperlink } from '../hyperlink/Hyperlink';
|
|
7
8
|
export function CopyButton(props) {
|
|
8
|
-
var _a;
|
|
9
|
+
var _a, _b;
|
|
9
10
|
const { text, variant = 'outlined', size = 'sm', children, ...rest } = props;
|
|
10
11
|
const [copied, setCopied] = useState(false);
|
|
11
12
|
const handleCopy = async () => {
|
|
@@ -18,5 +19,12 @@ export function CopyButton(props) {
|
|
|
18
19
|
console.error('Failed to copy: ', err);
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
+
if (props.style === 'link') {
|
|
23
|
+
return (_jsx(Hyperlink, { asChild: true, variant: "secondary", inline: props.variant === 'inline', children: _jsxs("button", { "aria-label": children ? '' : ((_a = rest['aria-label']) !== null && _a !== void 0 ? _a : 'Kopier til udklipsholder'), onClick: e => {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
handleCopy();
|
|
27
|
+
}, className: `${styles.link} ${copied ? styles.copied : ''}`, children: [children, copied ? _jsx(Check, {}) : _jsx(Copy, {})] }) }));
|
|
28
|
+
}
|
|
29
|
+
return (_jsxs(Button, { ...rest, "aria-label": children ? '' : ((_b = rest['aria-label']) !== null && _b !== void 0 ? _b : 'Kopier til udklipsholder'), onClick: handleCopy, variant: variant, size: size, children: [_jsx("span", { className: `${styles.container} ${copied ? styles.copied : ''}`, children: copied ? _jsx(Check, {}) : _jsx(Copy, {}) }), children] }));
|
|
22
30
|
}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Input } from '../../components/forms/input/Input';
|
|
3
|
-
import { type UtcIsoString } from './dateTimeHelpers';
|
|
3
|
+
import { type DateOnlyString, type UtcIsoString } from './dateTimeHelpers';
|
|
4
4
|
type Mode = 'single' | 'range';
|
|
5
5
|
type WeekStart = 0 | 1;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Contract (recommended):
|
|
8
|
+
* - UI is always local time
|
|
9
|
+
*
|
|
10
|
+
* SINGLE:
|
|
11
|
+
* - enableTime=true => value is UtcIsoString | null (UTC instant in/out)
|
|
12
|
+
* - enableTime=false => value is DateOnlyString | null (calendar date in/out)
|
|
13
|
+
*
|
|
14
|
+
* RANGE:
|
|
15
|
+
* - always date-only in UI AND value: { start/end: DateOnlyString | null }
|
|
16
|
+
*/
|
|
17
|
+
type RangeValue = {
|
|
18
|
+
start: DateOnlyString | null;
|
|
19
|
+
end: DateOnlyString | null;
|
|
9
20
|
};
|
|
10
21
|
type InputProps = React.ComponentProps<typeof Input>;
|
|
11
|
-
|
|
22
|
+
type BaseProps = {
|
|
12
23
|
mode?: Mode;
|
|
13
|
-
value: DateValue;
|
|
14
|
-
onChange: (next: DateValue) => void;
|
|
15
24
|
enableTime?: boolean;
|
|
16
25
|
timeStep?: number;
|
|
17
26
|
min?: Date;
|
|
@@ -34,6 +43,22 @@ export interface DateTimePickerProps {
|
|
|
34
43
|
locale: string;
|
|
35
44
|
enableTime: boolean;
|
|
36
45
|
}) => string;
|
|
37
|
-
}
|
|
46
|
+
};
|
|
47
|
+
export type DateTimePickerProps = (BaseProps & {
|
|
48
|
+
mode?: 'single';
|
|
49
|
+
enableTime?: true;
|
|
50
|
+
value: UtcIsoString | null;
|
|
51
|
+
onChange: (next: UtcIsoString | null) => void;
|
|
52
|
+
}) | (BaseProps & {
|
|
53
|
+
mode?: 'single';
|
|
54
|
+
enableTime?: false;
|
|
55
|
+
value: DateOnlyString | null;
|
|
56
|
+
onChange: (next: DateOnlyString | null) => void;
|
|
57
|
+
}) | (BaseProps & {
|
|
58
|
+
mode: 'range';
|
|
59
|
+
enableTime?: boolean;
|
|
60
|
+
value: RangeValue;
|
|
61
|
+
onChange: (next: RangeValue) => void;
|
|
62
|
+
});
|
|
38
63
|
export declare const DateTimePicker: React.ForwardRefExoticComponent<DateTimePickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
39
64
|
export {};
|