@dbcdk/react-components 0.0.164 → 0.0.166
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/button/Button.cjs +4 -3
- package/dist/components/button/Button.js +4 -3
- package/dist/components/chip/Chip.module.css +1 -1
- package/dist/components/filter-field/FilterField.cjs +0 -5
- package/dist/components/filter-field/FilterField.js +0 -5
- package/dist/components/overlay/modal/provider/ModalProvider.cjs +1 -1
- package/dist/components/overlay/modal/provider/ModalProvider.js +1 -1
- package/dist/components/page-layout/PageLayout.module.css +10 -0
- package/dist/components/page-layout/components/footer/Footer.module.css +0 -3
- package/dist/components/search-box/SearchBox.cjs +0 -4
- package/dist/components/search-box/SearchBox.js +0 -4
- package/dist/components/skeleton-loader/SkeletonLoader.cjs +1 -1
- package/dist/components/skeleton-loader/SkeletonLoader.js +1 -1
- package/dist/components/split-pane/SplitPane.cjs +4 -1
- package/dist/components/split-pane/SplitPane.js +5 -2
- package/dist/components/split-pane/provider/SplitPaneContext.cjs +1 -1
- package/dist/components/split-pane/provider/SplitPaneContext.js +1 -1
- package/dist/components/table/Table.module.css +10 -7
- package/dist/components/table/TanstackTable.cjs +1 -1
- package/dist/components/table/TanstackTable.js +1 -1
- package/dist/components/table/table.utils.cjs +1 -1
- package/dist/components/table/table.utils.d.ts +1 -1
- package/dist/components/table/table.utils.js +1 -1
- package/dist/hooks/usePersistentState.cjs +1 -2
- package/dist/hooks/usePersistentState.js +1 -2
- package/dist/hooks/useSorting.d.ts +1 -1
- package/dist/hooks/useTimeDuration.cjs +9 -6
- package/dist/hooks/useTimeDuration.js +9 -6
- package/dist/index.cjs +35 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/styles/styles.css +4 -3
- package/dist/styles/themes/dbc/base.css +5 -0
- package/dist/styles/themes/dbc/colors.css +1 -1
- package/dist/styles.css +4 -3
- package/package.json +3 -3
|
@@ -78,6 +78,7 @@ const Button = React__namespace.forwardRef(function Button2({
|
|
|
78
78
|
placement: tooltipPlacement,
|
|
79
79
|
offset: 8
|
|
80
80
|
});
|
|
81
|
+
const { ref: hoverRef, onPointerEnter: hoverEnter, onPointerLeave: hoverLeave } = triggerProps;
|
|
81
82
|
const describedBy = (() => {
|
|
82
83
|
const existing = typeof buttonProps["aria-describedby"] === "string" ? buttonProps["aria-describedby"] : "";
|
|
83
84
|
const ids = [existing, tooltipEnabled ? tooltipId : ""].filter(Boolean);
|
|
@@ -130,9 +131,9 @@ const Button = React__namespace.forwardRef(function Button2({
|
|
|
130
131
|
buttonEl = /* @__PURE__ */ jsxRuntime.jsx(
|
|
131
132
|
"span",
|
|
132
133
|
{
|
|
133
|
-
ref:
|
|
134
|
-
onPointerEnter:
|
|
135
|
-
onPointerLeave:
|
|
134
|
+
ref: hoverRef,
|
|
135
|
+
onPointerEnter: hoverEnter,
|
|
136
|
+
onPointerLeave: hoverLeave,
|
|
136
137
|
style: {
|
|
137
138
|
display: fullWidth ? "flex" : "inline-flex",
|
|
138
139
|
cursor: "not-allowed"
|
|
@@ -53,6 +53,7 @@ const Button = React.forwardRef(function Button2({
|
|
|
53
53
|
placement: tooltipPlacement,
|
|
54
54
|
offset: 8
|
|
55
55
|
});
|
|
56
|
+
const { ref: hoverRef, onPointerEnter: hoverEnter, onPointerLeave: hoverLeave } = triggerProps;
|
|
56
57
|
const describedBy = (() => {
|
|
57
58
|
const existing = typeof buttonProps["aria-describedby"] === "string" ? buttonProps["aria-describedby"] : "";
|
|
58
59
|
const ids = [existing, tooltipEnabled ? tooltipId : ""].filter(Boolean);
|
|
@@ -105,9 +106,9 @@ const Button = React.forwardRef(function Button2({
|
|
|
105
106
|
buttonEl = /* @__PURE__ */ jsx(
|
|
106
107
|
"span",
|
|
107
108
|
{
|
|
108
|
-
ref:
|
|
109
|
-
onPointerEnter:
|
|
110
|
-
onPointerLeave:
|
|
109
|
+
ref: hoverRef,
|
|
110
|
+
onPointerEnter: hoverEnter,
|
|
111
|
+
onPointerLeave: hoverLeave,
|
|
111
112
|
style: {
|
|
112
113
|
display: fullWidth ? "flex" : "inline-flex",
|
|
113
114
|
cursor: "not-allowed"
|
|
@@ -60,14 +60,9 @@ function OperatorDropdown({
|
|
|
60
60
|
disabled
|
|
61
61
|
}) {
|
|
62
62
|
const popRef = react.useRef(null);
|
|
63
|
-
const [activeIndex, setActiveIndex] = react.useState(() => Math.max(0, operators.indexOf(value)));
|
|
64
|
-
react.useEffect(() => {
|
|
65
|
-
setActiveIndex(Math.max(0, operators.indexOf(value)));
|
|
66
|
-
}, [operators, value]);
|
|
67
63
|
const handleSelect = (op) => {
|
|
68
64
|
var _a;
|
|
69
65
|
onChange(op);
|
|
70
|
-
setActiveIndex(operators.indexOf(op));
|
|
71
66
|
(_a = popRef.current) == null ? void 0 : _a.close();
|
|
72
67
|
};
|
|
73
68
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -54,14 +54,9 @@ function OperatorDropdown({
|
|
|
54
54
|
disabled
|
|
55
55
|
}) {
|
|
56
56
|
const popRef = useRef(null);
|
|
57
|
-
const [activeIndex, setActiveIndex] = useState(() => Math.max(0, operators.indexOf(value)));
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
setActiveIndex(Math.max(0, operators.indexOf(value)));
|
|
60
|
-
}, [operators, value]);
|
|
61
57
|
const handleSelect = (op) => {
|
|
62
58
|
var _a;
|
|
63
59
|
onChange(op);
|
|
64
|
-
setActiveIndex(operators.indexOf(op));
|
|
65
60
|
(_a = popRef.current) == null ? void 0 : _a.close();
|
|
66
61
|
};
|
|
67
62
|
return /* @__PURE__ */ jsx(
|
|
@@ -68,7 +68,7 @@ function ModalProvider({ children }) {
|
|
|
68
68
|
setIsOpen(true);
|
|
69
69
|
});
|
|
70
70
|
},
|
|
71
|
-
[resolvePending]
|
|
71
|
+
[resolvePending, closeModal]
|
|
72
72
|
);
|
|
73
73
|
const modalNode = /* @__PURE__ */ jsxRuntime.jsxs(ModalContext.Provider, { value: { openModal, closeModal, confirm, markAsLoading }, children: [
|
|
74
74
|
children,
|
|
@@ -66,7 +66,7 @@ function ModalProvider({ children }) {
|
|
|
66
66
|
setIsOpen(true);
|
|
67
67
|
});
|
|
68
68
|
},
|
|
69
|
-
[resolvePending]
|
|
69
|
+
[resolvePending, closeModal]
|
|
70
70
|
);
|
|
71
71
|
const modalNode = /* @__PURE__ */ jsxs(ModalContext.Provider, { value: { openModal, closeModal, confirm, markAsLoading }, children: [
|
|
72
72
|
children,
|
|
@@ -221,6 +221,7 @@
|
|
|
221
221
|
|
|
222
222
|
.horizontal .content {
|
|
223
223
|
padding-top: var(--spacing-lg);
|
|
224
|
+
padding-inline: var(--spacing-lg);
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
.footer {
|
|
@@ -228,6 +229,7 @@
|
|
|
228
229
|
background: var(--color-bg-surface-subtle);
|
|
229
230
|
display: flex;
|
|
230
231
|
justify-content: center;
|
|
232
|
+
padding-inline: var(--spacing-md);
|
|
231
233
|
|
|
232
234
|
/* When there is extra space (content is short), this pushes footer to the bottom.
|
|
233
235
|
When content is long, footer follows content normally and is reached by scrolling.
|
|
@@ -236,6 +238,10 @@
|
|
|
236
238
|
flex: 0 0 auto;
|
|
237
239
|
}
|
|
238
240
|
|
|
241
|
+
.horizontal .footer {
|
|
242
|
+
padding-inline: var(--spacing-lg);
|
|
243
|
+
}
|
|
244
|
+
|
|
239
245
|
/* Header slot wrappers */
|
|
240
246
|
.headerContainer {
|
|
241
247
|
display: flex;
|
|
@@ -244,6 +250,10 @@
|
|
|
244
250
|
padding-inline: var(--spacing-md);
|
|
245
251
|
}
|
|
246
252
|
|
|
253
|
+
.horizontal .headerContainer {
|
|
254
|
+
padding-inline: var(--spacing-lg);
|
|
255
|
+
}
|
|
256
|
+
|
|
247
257
|
.headerContent {
|
|
248
258
|
width: 100%;
|
|
249
259
|
box-sizing: border-box;
|
|
@@ -43,7 +43,6 @@ const SearchBox = react.forwardRef(function SearchBoxInner({
|
|
|
43
43
|
var _a;
|
|
44
44
|
const isControlled = value !== void 0;
|
|
45
45
|
const [draft, setDraft] = react.useState(() => isControlled ? String(value != null ? value : "") : "");
|
|
46
|
-
const [searchQuery, setSearchQuery] = react.useState("");
|
|
47
46
|
const [activeIndex, setActiveIndex] = react.useState(null);
|
|
48
47
|
const [popoverOpen, setPopoverOpen] = react.useState(false);
|
|
49
48
|
const listboxId = react.useId();
|
|
@@ -68,13 +67,11 @@ const SearchBox = react.forwardRef(function SearchBoxInner({
|
|
|
68
67
|
react.useEffect(() => {
|
|
69
68
|
if (!onSearchRef.current) return;
|
|
70
69
|
if (!debounce) {
|
|
71
|
-
setSearchQuery(draft);
|
|
72
70
|
onSearchRef.current(draft);
|
|
73
71
|
return;
|
|
74
72
|
}
|
|
75
73
|
const handler = setTimeout(() => {
|
|
76
74
|
var _a2;
|
|
77
|
-
setSearchQuery(draft);
|
|
78
75
|
(_a2 = onSearchRef.current) == null ? void 0 : _a2.call(onSearchRef, draft);
|
|
79
76
|
}, debounceMs);
|
|
80
77
|
return () => clearTimeout(handler);
|
|
@@ -120,7 +117,6 @@ const SearchBox = react.forwardRef(function SearchBoxInner({
|
|
|
120
117
|
function reset() {
|
|
121
118
|
var _a2;
|
|
122
119
|
setDraft("");
|
|
123
|
-
setSearchQuery("");
|
|
124
120
|
setActiveIndex(null);
|
|
125
121
|
(_a2 = popoverRef.current) == null ? void 0 : _a2.close();
|
|
126
122
|
}
|
|
@@ -37,7 +37,6 @@ const SearchBox = forwardRef(function SearchBoxInner({
|
|
|
37
37
|
var _a;
|
|
38
38
|
const isControlled = value !== void 0;
|
|
39
39
|
const [draft, setDraft] = useState(() => isControlled ? String(value != null ? value : "") : "");
|
|
40
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
41
40
|
const [activeIndex, setActiveIndex] = useState(null);
|
|
42
41
|
const [popoverOpen, setPopoverOpen] = useState(false);
|
|
43
42
|
const listboxId = useId();
|
|
@@ -62,13 +61,11 @@ const SearchBox = forwardRef(function SearchBoxInner({
|
|
|
62
61
|
useEffect(() => {
|
|
63
62
|
if (!onSearchRef.current) return;
|
|
64
63
|
if (!debounce) {
|
|
65
|
-
setSearchQuery(draft);
|
|
66
64
|
onSearchRef.current(draft);
|
|
67
65
|
return;
|
|
68
66
|
}
|
|
69
67
|
const handler = setTimeout(() => {
|
|
70
68
|
var _a2;
|
|
71
|
-
setSearchQuery(draft);
|
|
72
69
|
(_a2 = onSearchRef.current) == null ? void 0 : _a2.call(onSearchRef, draft);
|
|
73
70
|
}, debounceMs);
|
|
74
71
|
return () => clearTimeout(handler);
|
|
@@ -114,7 +111,6 @@ const SearchBox = forwardRef(function SearchBoxInner({
|
|
|
114
111
|
function reset() {
|
|
115
112
|
var _a2;
|
|
116
113
|
setDraft("");
|
|
117
|
-
setSearchQuery("");
|
|
118
114
|
setActiveIndex(null);
|
|
119
115
|
(_a2 = popoverRef.current) == null ? void 0 : _a2.close();
|
|
120
116
|
}
|
|
@@ -21,7 +21,7 @@ function SkeletonLoader({
|
|
|
21
21
|
variant,
|
|
22
22
|
speedSec
|
|
23
23
|
},
|
|
24
|
-
`${String(width)}-${height}-${String(radius)}
|
|
24
|
+
`${String(width)}-${height}-${String(radius)}`
|
|
25
25
|
);
|
|
26
26
|
const pills = (count) => Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
27
|
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
@@ -19,7 +19,7 @@ function SkeletonLoader({
|
|
|
19
19
|
variant,
|
|
20
20
|
speedSec
|
|
21
21
|
},
|
|
22
|
-
`${String(width)}-${height}-${String(radius)}
|
|
22
|
+
`${String(width)}-${height}-${String(radius)}`
|
|
23
23
|
);
|
|
24
24
|
const pills = (count) => Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsx(
|
|
25
25
|
SkeletonLoaderItem,
|
|
@@ -161,7 +161,10 @@ function SplitPaneGutter() {
|
|
|
161
161
|
[computeClamp, direction, minPrimarySize, primarySize, setPrimarySize]
|
|
162
162
|
);
|
|
163
163
|
const ariaOrientation = direction === "horizontal" ? "vertical" : "horizontal";
|
|
164
|
-
const
|
|
164
|
+
const [maxPrimary, setMaxPrimary] = react.useState(Infinity);
|
|
165
|
+
react.useEffect(() => {
|
|
166
|
+
setMaxPrimary(computeClamp().maxPrimary);
|
|
167
|
+
}, [computeClamp]);
|
|
165
168
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.gutter, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
166
169
|
"div",
|
|
167
170
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useMemo, useRef, useCallback } from 'react';
|
|
3
|
+
import { useMemo, useRef, useCallback, useState, useEffect } from 'react';
|
|
4
4
|
import { SplitPaneProvider, useSplitPaneContext } from './provider/SplitPaneContext';
|
|
5
5
|
import styles from './SplitPane.module.css';
|
|
6
6
|
|
|
@@ -155,7 +155,10 @@ function SplitPaneGutter() {
|
|
|
155
155
|
[computeClamp, direction, minPrimarySize, primarySize, setPrimarySize]
|
|
156
156
|
);
|
|
157
157
|
const ariaOrientation = direction === "horizontal" ? "vertical" : "horizontal";
|
|
158
|
-
const
|
|
158
|
+
const [maxPrimary, setMaxPrimary] = useState(Infinity);
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
setMaxPrimary(computeClamp().maxPrimary);
|
|
161
|
+
}, [computeClamp]);
|
|
159
162
|
return /* @__PURE__ */ jsx("div", { className: styles.gutter, children: /* @__PURE__ */ jsx(
|
|
160
163
|
"div",
|
|
161
164
|
{
|
|
@@ -78,7 +78,7 @@ function SplitPaneProvider({
|
|
|
78
78
|
const ro = new ResizeObserver(clampToContainer);
|
|
79
79
|
ro.observe(el);
|
|
80
80
|
return () => ro.disconnect();
|
|
81
|
-
}, [getMaxPrimary, initialPrimarySize, manualPrimarySize]);
|
|
81
|
+
}, [getMaxPrimary, initialPrimarySize, manualPrimarySize, minPrimarySize]);
|
|
82
82
|
React.useEffect(() => {
|
|
83
83
|
if (!storageKey) return;
|
|
84
84
|
if (manualPrimarySize === null) {
|
|
@@ -72,7 +72,7 @@ function SplitPaneProvider({
|
|
|
72
72
|
const ro = new ResizeObserver(clampToContainer);
|
|
73
73
|
ro.observe(el);
|
|
74
74
|
return () => ro.disconnect();
|
|
75
|
-
}, [getMaxPrimary, initialPrimarySize, manualPrimarySize]);
|
|
75
|
+
}, [getMaxPrimary, initialPrimarySize, manualPrimarySize, minPrimarySize]);
|
|
76
76
|
useEffect(() => {
|
|
77
77
|
if (!storageKey) return;
|
|
78
78
|
if (manualPrimarySize === null) {
|
|
@@ -48,7 +48,9 @@
|
|
|
48
48
|
.tableRoot {
|
|
49
49
|
--table-component-header-bg: var(--table-header-bg);
|
|
50
50
|
--table-component-header-fg: var(--table-header-fg);
|
|
51
|
-
--table-component-header-font-
|
|
51
|
+
--table-component-header-font-size: var(--font-size-table-header);
|
|
52
|
+
--table-component-header-line-height: var(--line-height-table-header);
|
|
53
|
+
--table-component-header-font-weight: var(--font-weight-table-header);
|
|
52
54
|
--table-component-row-bg: var(--table-row-bg);
|
|
53
55
|
--table-component-row-bg-hover: var(--color-bg-hover-subtle);
|
|
54
56
|
--table-component-row-bg-selected: var(--table-row-bg-selected);
|
|
@@ -156,7 +158,8 @@
|
|
|
156
158
|
background-color: var(--table-component-header-bg);
|
|
157
159
|
padding-block: var(--spacing-xxs);
|
|
158
160
|
padding-inline: var(--spacing-sm);
|
|
159
|
-
font-size: var(--font-size
|
|
161
|
+
font-size: var(--table-component-header-font-size);
|
|
162
|
+
line-height: var(--table-component-header-line-height);
|
|
160
163
|
font-weight: var(--table-component-header-font-weight);
|
|
161
164
|
color: var(--table-component-header-fg);
|
|
162
165
|
white-space: nowrap;
|
|
@@ -231,7 +234,7 @@
|
|
|
231
234
|
|
|
232
235
|
.headerCell.selectionCell,
|
|
233
236
|
.cell.selectionCell {
|
|
234
|
-
padding-inline: calc(var(--spacing-xxs) +
|
|
237
|
+
padding-inline: calc(var(--spacing-xxs) + 2px);
|
|
235
238
|
cursor: pointer;
|
|
236
239
|
overflow: visible;
|
|
237
240
|
line-height: 0;
|
|
@@ -442,8 +445,8 @@
|
|
|
442
445
|
display: inline-flex;
|
|
443
446
|
flex: 0 0 auto;
|
|
444
447
|
align-items: center;
|
|
445
|
-
color: var(--color-fg
|
|
446
|
-
opacity:
|
|
448
|
+
color: var(--color-disabled-fg);
|
|
449
|
+
opacity: 1;
|
|
447
450
|
}
|
|
448
451
|
|
|
449
452
|
.sortIndicator svg {
|
|
@@ -456,11 +459,11 @@
|
|
|
456
459
|
}
|
|
457
460
|
|
|
458
461
|
.inActiveSort {
|
|
459
|
-
opacity: 0.
|
|
462
|
+
opacity: 0.8;
|
|
460
463
|
}
|
|
461
464
|
|
|
462
465
|
.activeSort {
|
|
463
|
-
color: var(--color-fg
|
|
466
|
+
color: var(--color-disabled-fg);
|
|
464
467
|
}
|
|
465
468
|
|
|
466
469
|
.cellContent {
|
|
@@ -177,7 +177,7 @@ function TanstackTable(props) {
|
|
|
177
177
|
dataKey,
|
|
178
178
|
data: visibleData,
|
|
179
179
|
columns: columnItems,
|
|
180
|
-
tableWidth:
|
|
180
|
+
tableWidth: distributedLayout == null ? void 0 : distributedLayout.totalWidth,
|
|
181
181
|
measuringLayout: !initialLayoutReady,
|
|
182
182
|
sortById,
|
|
183
183
|
sortDirection,
|
|
@@ -152,7 +152,7 @@ function TanstackTable(props) {
|
|
|
152
152
|
dataKey,
|
|
153
153
|
data: visibleData,
|
|
154
154
|
columns: columnItems,
|
|
155
|
-
tableWidth:
|
|
155
|
+
tableWidth: distributedLayout == null ? void 0 : distributedLayout.totalWidth,
|
|
156
156
|
measuringLayout: !initialLayoutReady,
|
|
157
157
|
sortById,
|
|
158
158
|
sortDirection,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ColumnItem } from './Table.types';
|
|
3
|
-
export declare const SELECTION_COLUMN_PX:
|
|
3
|
+
export declare const SELECTION_COLUMN_PX: 32;
|
|
4
4
|
export declare const ACTIONS_COLUMN_PX: 0;
|
|
5
5
|
export declare const DEFAULT_COLUMN_PX: 150;
|
|
6
6
|
export type SortDirection = 'asc' | 'desc' | null;
|
|
@@ -31,8 +31,7 @@ function usePersistentState({
|
|
|
31
31
|
const [value, setValue] = react.useState(() => {
|
|
32
32
|
if (!shouldHydrate || !sync) return initialValue;
|
|
33
33
|
const stored = readStorage(storage, storageKey);
|
|
34
|
-
|
|
35
|
-
return currentValidate == null || currentValidate(stored) ? stored : initialValue;
|
|
34
|
+
return validate == null || validate(stored) ? stored : initialValue;
|
|
36
35
|
});
|
|
37
36
|
const hydrated = !shouldHydrate || didHydrate;
|
|
38
37
|
react.useEffect(() => {
|
|
@@ -29,8 +29,7 @@ function usePersistentState({
|
|
|
29
29
|
const [value, setValue] = useState(() => {
|
|
30
30
|
if (!shouldHydrate || !sync) return initialValue;
|
|
31
31
|
const stored = readStorage(storage, storageKey);
|
|
32
|
-
|
|
33
|
-
return currentValidate == null || currentValidate(stored) ? stored : initialValue;
|
|
32
|
+
return validate == null || validate(stored) ? stored : initialValue;
|
|
34
33
|
});
|
|
35
34
|
const hydrated = !shouldHydrate || didHydrate;
|
|
36
35
|
useEffect(() => {
|
|
@@ -32,16 +32,20 @@ function useTimeDuration({
|
|
|
32
32
|
formatDuration = defaultDuration
|
|
33
33
|
}) {
|
|
34
34
|
const [hydrated, setHydrated] = react.useState(false);
|
|
35
|
-
const [
|
|
36
|
-
react.useEffect(() =>
|
|
35
|
+
const [now, setNow] = react.useState(0);
|
|
36
|
+
react.useEffect(() => {
|
|
37
|
+
setHydrated(true);
|
|
38
|
+
setNow(Date.now());
|
|
39
|
+
}, []);
|
|
37
40
|
react.useEffect(() => {
|
|
38
41
|
if (!liveUpdate) return;
|
|
39
42
|
if (end && end.getTime() <= Date.now()) return;
|
|
40
43
|
const timer = setInterval(() => {
|
|
41
|
-
|
|
44
|
+
const next = Date.now();
|
|
45
|
+
setNow(next);
|
|
46
|
+
if (end && end.getTime() <= next) {
|
|
42
47
|
clearInterval(timer);
|
|
43
48
|
}
|
|
44
|
-
setTick((tick2) => tick2 + 1);
|
|
45
49
|
}, 1e3);
|
|
46
50
|
return () => clearInterval(timer);
|
|
47
51
|
}, [liveUpdate, end]);
|
|
@@ -57,7 +61,6 @@ function useTimeDuration({
|
|
|
57
61
|
}, [end, hydrated, fallback, dateFormat]);
|
|
58
62
|
const duration = react.useMemo(() => {
|
|
59
63
|
if (!start || !hydrated) return fallback;
|
|
60
|
-
const now = Date.now();
|
|
61
64
|
if (!end) {
|
|
62
65
|
return formatDuration(now - start.getTime());
|
|
63
66
|
}
|
|
@@ -65,7 +68,7 @@ function useTimeDuration({
|
|
|
65
68
|
return formatDuration(end.getTime() - now);
|
|
66
69
|
}
|
|
67
70
|
return formatDuration(end.getTime() - start.getTime());
|
|
68
|
-
}, [start, end, fallback, hydrated, formatDuration,
|
|
71
|
+
}, [start, end, fallback, hydrated, formatDuration, now]);
|
|
69
72
|
return { started, ended, isFinished: !!start && !!end, duration, hydrated };
|
|
70
73
|
}
|
|
71
74
|
|
|
@@ -30,16 +30,20 @@ function useTimeDuration({
|
|
|
30
30
|
formatDuration = defaultDuration
|
|
31
31
|
}) {
|
|
32
32
|
const [hydrated, setHydrated] = useState(false);
|
|
33
|
-
const [
|
|
34
|
-
useEffect(() =>
|
|
33
|
+
const [now, setNow] = useState(0);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
setHydrated(true);
|
|
36
|
+
setNow(Date.now());
|
|
37
|
+
}, []);
|
|
35
38
|
useEffect(() => {
|
|
36
39
|
if (!liveUpdate) return;
|
|
37
40
|
if (end && end.getTime() <= Date.now()) return;
|
|
38
41
|
const timer = setInterval(() => {
|
|
39
|
-
|
|
42
|
+
const next = Date.now();
|
|
43
|
+
setNow(next);
|
|
44
|
+
if (end && end.getTime() <= next) {
|
|
40
45
|
clearInterval(timer);
|
|
41
46
|
}
|
|
42
|
-
setTick((tick2) => tick2 + 1);
|
|
43
47
|
}, 1e3);
|
|
44
48
|
return () => clearInterval(timer);
|
|
45
49
|
}, [liveUpdate, end]);
|
|
@@ -55,7 +59,6 @@ function useTimeDuration({
|
|
|
55
59
|
}, [end, hydrated, fallback, dateFormat]);
|
|
56
60
|
const duration = useMemo(() => {
|
|
57
61
|
if (!start || !hydrated) return fallback;
|
|
58
|
-
const now = Date.now();
|
|
59
62
|
if (!end) {
|
|
60
63
|
return formatDuration(now - start.getTime());
|
|
61
64
|
}
|
|
@@ -63,7 +66,7 @@ function useTimeDuration({
|
|
|
63
66
|
return formatDuration(end.getTime() - now);
|
|
64
67
|
}
|
|
65
68
|
return formatDuration(end.getTime() - start.getTime());
|
|
66
|
-
}, [start, end, fallback, hydrated, formatDuration,
|
|
69
|
+
}, [start, end, fallback, hydrated, formatDuration, now]);
|
|
67
70
|
return { started, ended, isFinished: !!start && !!end, duration, hydrated };
|
|
68
71
|
}
|
|
69
72
|
|
package/dist/index.cjs
CHANGED
|
@@ -36,6 +36,11 @@ var Alert = require('./components/alert/Alert');
|
|
|
36
36
|
var InlineStatus = require('./components/inline-status/InlineStatus');
|
|
37
37
|
var MediaCard = require('./components/media-card/MediaCard');
|
|
38
38
|
var HighlightedText = require('./components/highlighted-text/HighlightedText');
|
|
39
|
+
var ButtonSelect = require('./components/button-select/ButtonSelect');
|
|
40
|
+
var Sidebar = require('./components/sidebar/Sidebar');
|
|
41
|
+
var SplitButton = require('./components/split-button/SplitButton');
|
|
42
|
+
var ChipMultiToggle = require('./components/filtering/chip-multi-toggle/ChipMultiToggle');
|
|
43
|
+
var CheckboxGroup = require('./components/forms/checkbox-group/CheckboxGroup');
|
|
39
44
|
|
|
40
45
|
|
|
41
46
|
|
|
@@ -255,3 +260,33 @@ Object.keys(HighlightedText).forEach(function (k) {
|
|
|
255
260
|
get: function () { return HighlightedText[k]; }
|
|
256
261
|
});
|
|
257
262
|
});
|
|
263
|
+
Object.keys(ButtonSelect).forEach(function (k) {
|
|
264
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
265
|
+
enumerable: true,
|
|
266
|
+
get: function () { return ButtonSelect[k]; }
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
Object.keys(Sidebar).forEach(function (k) {
|
|
270
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
271
|
+
enumerable: true,
|
|
272
|
+
get: function () { return Sidebar[k]; }
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
Object.keys(SplitButton).forEach(function (k) {
|
|
276
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
277
|
+
enumerable: true,
|
|
278
|
+
get: function () { return SplitButton[k]; }
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
Object.keys(ChipMultiToggle).forEach(function (k) {
|
|
282
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
283
|
+
enumerable: true,
|
|
284
|
+
get: function () { return ChipMultiToggle[k]; }
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
Object.keys(CheckboxGroup).forEach(function (k) {
|
|
288
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
289
|
+
enumerable: true,
|
|
290
|
+
get: function () { return CheckboxGroup[k]; }
|
|
291
|
+
});
|
|
292
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -35,3 +35,8 @@ export * from './components/alert/Alert';
|
|
|
35
35
|
export * from './components/inline-status/InlineStatus';
|
|
36
36
|
export * from './components/media-card/MediaCard';
|
|
37
37
|
export * from './components/highlighted-text/HighlightedText';
|
|
38
|
+
export * from './components/button-select/ButtonSelect';
|
|
39
|
+
export * from './components/sidebar/Sidebar';
|
|
40
|
+
export * from './components/split-button/SplitButton';
|
|
41
|
+
export * from './components/filtering/chip-multi-toggle/ChipMultiToggle';
|
|
42
|
+
export * from './components/forms/checkbox-group/CheckboxGroup';
|
package/dist/index.js
CHANGED
|
@@ -34,3 +34,8 @@ export * from './components/alert/Alert';
|
|
|
34
34
|
export * from './components/inline-status/InlineStatus';
|
|
35
35
|
export * from './components/media-card/MediaCard';
|
|
36
36
|
export * from './components/highlighted-text/HighlightedText';
|
|
37
|
+
export * from './components/button-select/ButtonSelect';
|
|
38
|
+
export * from './components/sidebar/Sidebar';
|
|
39
|
+
export * from './components/split-button/SplitButton';
|
|
40
|
+
export * from './components/filtering/chip-multi-toggle/ChipMultiToggle';
|
|
41
|
+
export * from './components/forms/checkbox-group/CheckboxGroup';
|
package/dist/styles/styles.css
CHANGED
|
@@ -99,10 +99,11 @@ body.dbc-app {
|
|
|
99
99
|
max-width: var(--card-label-width);
|
|
100
100
|
overflow: hidden;
|
|
101
101
|
text-overflow: ellipsis;
|
|
102
|
-
font-size: var(--font-size-
|
|
103
|
-
|
|
102
|
+
font-size: var(--font-size-table-header);
|
|
103
|
+
line-height: var(--line-height-table-header);
|
|
104
|
+
color: var(--table-header-fg);
|
|
104
105
|
letter-spacing: var(--letter-spacing-wide);
|
|
105
|
-
font-weight: var(--font-weight-
|
|
106
|
+
font-weight: var(--font-weight-table-header);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
.dbc-table td {
|
|
@@ -74,6 +74,11 @@
|
|
|
74
74
|
--font-size-xl: 24px;
|
|
75
75
|
--font-size-2xl: 30px;
|
|
76
76
|
|
|
77
|
+
/* Semantic typography */
|
|
78
|
+
--font-size-table-header: 13px;
|
|
79
|
+
--line-height-table-header: 16px;
|
|
80
|
+
--font-weight-table-header: var(--font-weight-semibold);
|
|
81
|
+
|
|
77
82
|
--font-weight-default: 400;
|
|
78
83
|
--font-weight-medium: 500;
|
|
79
84
|
--font-weight-semibold: 600;
|
|
@@ -246,7 +246,7 @@ html {
|
|
|
246
246
|
--color-logo-fg: var(--color-fg-default);
|
|
247
247
|
|
|
248
248
|
/* Tables */
|
|
249
|
-
--table-header-bg: light-dark(#
|
|
249
|
+
--table-header-bg: light-dark(#f3f4f6, #1b2533);
|
|
250
250
|
--table-row-bg: light-dark(#ffffff, #111827);
|
|
251
251
|
--table-row-bg-alt: light-dark(#f7f9fc, #141d2a);
|
|
252
252
|
--table-row-bg-hover: light-dark(#eef2f7, #172131);
|
package/dist/styles.css
CHANGED
|
@@ -99,10 +99,11 @@ body.dbc-app {
|
|
|
99
99
|
max-width: var(--card-label-width);
|
|
100
100
|
overflow: hidden;
|
|
101
101
|
text-overflow: ellipsis;
|
|
102
|
-
font-size: var(--font-size-
|
|
103
|
-
|
|
102
|
+
font-size: var(--font-size-table-header);
|
|
103
|
+
line-height: var(--line-height-table-header);
|
|
104
|
+
color: var(--table-header-fg);
|
|
104
105
|
letter-spacing: var(--letter-spacing-wide);
|
|
105
|
-
font-weight: var(--font-weight-
|
|
106
|
+
font-weight: var(--font-weight-table-header);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
.dbc-table td {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbcdk/react-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.166",
|
|
4
4
|
"description": "Reusable React components for DBC projects",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"./themes/*": "./dist/themes/*",
|
|
34
34
|
"./styles/themes/*": "./dist/styles/themes/*",
|
|
35
|
-
"./styles.css": "./dist/styles
|
|
35
|
+
"./styles.css": "./dist/styles.css",
|
|
36
36
|
"./assets/*": "./dist/assets/*",
|
|
37
37
|
"./tanstack": {
|
|
38
38
|
"types": "./dist/tanstack.d.ts",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@storybook/addon-docs": "^10.3.5",
|
|
84
84
|
"@storybook/react-vite": "^10.3.5",
|
|
85
85
|
"@swc/core": "^1.15.11",
|
|
86
|
-
"@tanstack/react-table": "^8.
|
|
86
|
+
"@tanstack/react-table": "^8.21.3",
|
|
87
87
|
"@testing-library/jest-dom": "^6.9.1",
|
|
88
88
|
"@testing-library/react": "^16.3.2",
|
|
89
89
|
"@types/react": "^19.2.14",
|