@dbcdk/react-components 0.0.97 → 0.0.101
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/page/Page.d.ts +2 -1
- package/dist/components/page-layout/PageLayout.d.ts +0 -2
- package/dist/components/page-layout/components/{layout-footer/LayoutFooter.d.ts → footer/Footer.d.ts} +5 -4
- package/dist/components/skeleton-loader/SkeletonLoader.d.ts +1 -1
- package/dist/components/tabs/Tabs.d.ts +2 -1
- package/dist/constants/chart-colors.d.ts +2 -0
- package/dist/constants/chart-colors.types.d.ts +3 -0
- package/dist/index.cjs +2086 -1999
- package/dist/index.css +26 -89
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1664 -1578
- package/dist/styles/styles.css +6 -1
- package/dist/styles/themes/dbc/colors.css +14 -6
- package/dist/styles/themes/forfatterweb/light.css +17 -0
- package/dist/styles.css +6 -1
- package/dist/tanstack.cjs +112 -126
- package/dist/tanstack.js +32 -46
- package/package.json +1 -1
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.d.ts +0 -12
package/dist/tanstack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useReactTable, getSortedRowModel, getCoreRowModel } from '@tanstack/react-table';
|
|
2
|
-
import * as
|
|
2
|
+
import * as React8 from 'react';
|
|
3
3
|
import { createContext, forwardRef, useId, useState, useRef, useEffect, useCallback, useImperativeHandle, useLayoutEffect, useContext, useMemo } from 'react';
|
|
4
4
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
5
5
|
import { LoaderCircle, ChevronUp, ChevronDown, Check, ListChevronsDownUp, Settings, ChevronsLeft, ArrowLeft, ArrowRight, ChevronsRight, ArrowUp, ArrowDown } from 'lucide-react';
|
|
@@ -175,7 +175,7 @@ function mergeRefs(...refs) {
|
|
|
175
175
|
}
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
|
-
var Button =
|
|
178
|
+
var Button = React8.forwardRef(function Button2({
|
|
179
179
|
variant = "outlined",
|
|
180
180
|
shape = "default",
|
|
181
181
|
size = "md",
|
|
@@ -204,8 +204,8 @@ var Button = React9.forwardRef(function Button2({
|
|
|
204
204
|
userClassName
|
|
205
205
|
);
|
|
206
206
|
const tooltipEnabled = Boolean(tooltip);
|
|
207
|
-
const childRef = isLink &&
|
|
208
|
-
const mergedRef =
|
|
207
|
+
const childRef = isLink && React8.isValidElement(children) ? (_a = children.ref) != null ? _a : null : null;
|
|
208
|
+
const mergedRef = React8.useMemo(() => mergeRefs(childRef, ref), [childRef, ref]);
|
|
209
209
|
const { triggerProps, id: tooltipId } = useTooltipTrigger({
|
|
210
210
|
content: tooltipEnabled ? tooltip : null,
|
|
211
211
|
placement: tooltipPlacement,
|
|
@@ -222,7 +222,7 @@ var Button = React9.forwardRef(function Button2({
|
|
|
222
222
|
loading && /* @__PURE__ */ jsx("span", { style: { display: "flex", opacity: 0.5 }, className: "spin", children: /* @__PURE__ */ jsx(LoaderCircle, {}) })
|
|
223
223
|
] });
|
|
224
224
|
let buttonEl;
|
|
225
|
-
if (isLink &&
|
|
225
|
+
if (isLink && React8.isValidElement(children)) {
|
|
226
226
|
const childClassName = typeof children.props.className === "string" ? children.props.className : "";
|
|
227
227
|
const { disabled, onClick, ...linkButtonProps } = buttonProps;
|
|
228
228
|
const handleClick = (e) => {
|
|
@@ -232,7 +232,7 @@ var Button = React9.forwardRef(function Button2({
|
|
|
232
232
|
}
|
|
233
233
|
onClick == null ? void 0 : onClick(e);
|
|
234
234
|
};
|
|
235
|
-
buttonEl =
|
|
235
|
+
buttonEl = React8.cloneElement(children, {
|
|
236
236
|
...linkButtonProps,
|
|
237
237
|
ref: mergedRef,
|
|
238
238
|
className: cx(childClassName, computedClassName, Button_default.buttonLink),
|
|
@@ -554,9 +554,9 @@ var INTERACTIVE_SELECTOR = 'a:not([disabled]), button:not([disabled]), [tabindex
|
|
|
554
554
|
function getMenuItems(el) {
|
|
555
555
|
return Array.from(el.querySelectorAll(INTERACTIVE_SELECTOR));
|
|
556
556
|
}
|
|
557
|
-
var MenuBase =
|
|
557
|
+
var MenuBase = React8.forwardRef(
|
|
558
558
|
({ children, className, itemRole = "menuitem", gap, onKeyDown, ...props }, ref) => {
|
|
559
|
-
const internalRef =
|
|
559
|
+
const internalRef = React8.useRef(null);
|
|
560
560
|
const handleKeyDown = (e) => {
|
|
561
561
|
const ul = internalRef.current;
|
|
562
562
|
if (!ul) return;
|
|
@@ -599,16 +599,16 @@ var MenuBase = React9.forwardRef(
|
|
|
599
599
|
}
|
|
600
600
|
);
|
|
601
601
|
MenuBase.displayName = "Menu";
|
|
602
|
-
var isInteractiveEl = (el) =>
|
|
602
|
+
var isInteractiveEl = (el) => React8.isValidElement(el) && (typeof el.type === "string" ? el.type === "a" || el.type === "button" : true);
|
|
603
603
|
function applyMenuItemPropsToElement(child, opts) {
|
|
604
604
|
var _a, _b, _c, _d;
|
|
605
605
|
const { active, selected, disabled, role, tabIndex = 0, className } = opts;
|
|
606
606
|
const childClass = [Menu_default.item, active ? Menu_default.active : "", selected ? Menu_default.selected : ""].filter(Boolean).join(" ");
|
|
607
|
-
const nextImmediate =
|
|
607
|
+
const nextImmediate = React8.cloneElement(child, {
|
|
608
608
|
className: [child.props.className, Menu_default.interactiveChild, className].filter(Boolean).join(" ")
|
|
609
609
|
});
|
|
610
610
|
if (typeof child.type === "string" && (child.type === "a" || child.type === "button")) {
|
|
611
|
-
return
|
|
611
|
+
return React8.cloneElement(child, {
|
|
612
612
|
role: (_a = child.props.role) != null ? _a : role,
|
|
613
613
|
tabIndex: (_b = child.props.tabIndex) != null ? _b : tabIndex,
|
|
614
614
|
"aria-selected": selected || void 0,
|
|
@@ -617,7 +617,7 @@ function applyMenuItemPropsToElement(child, opts) {
|
|
|
617
617
|
...child.type === "button" ? { disabled } : {}
|
|
618
618
|
});
|
|
619
619
|
}
|
|
620
|
-
return
|
|
620
|
+
return React8.cloneElement(nextImmediate, {
|
|
621
621
|
role: (_c = nextImmediate.props.role) != null ? _c : role,
|
|
622
622
|
tabIndex: (_d = nextImmediate.props.tabIndex) != null ? _d : tabIndex,
|
|
623
623
|
"aria-selected": selected || void 0,
|
|
@@ -626,7 +626,7 @@ function applyMenuItemPropsToElement(child, opts) {
|
|
|
626
626
|
disabled
|
|
627
627
|
});
|
|
628
628
|
}
|
|
629
|
-
var MenuItem =
|
|
629
|
+
var MenuItem = React8.forwardRef(
|
|
630
630
|
({ children, active, selected, disabled, className, itemRole, variant, ...liProps }, ref) => {
|
|
631
631
|
const resolvedRole = itemRole != null ? itemRole : "menuitem";
|
|
632
632
|
const isBordered = variant === "bordered";
|
|
@@ -664,7 +664,7 @@ var MenuItem = React9.forwardRef(
|
|
|
664
664
|
}
|
|
665
665
|
);
|
|
666
666
|
MenuItem.displayName = "Menu.Item";
|
|
667
|
-
var MenuCheckItem =
|
|
667
|
+
var MenuCheckItem = React8.forwardRef(
|
|
668
668
|
({
|
|
669
669
|
label,
|
|
670
670
|
checked,
|
|
@@ -730,7 +730,7 @@ var MenuCheckItem = React9.forwardRef(
|
|
|
730
730
|
}
|
|
731
731
|
);
|
|
732
732
|
MenuCheckItem.displayName = "Menu.CheckItem";
|
|
733
|
-
var MenuRadioItem =
|
|
733
|
+
var MenuRadioItem = React8.forwardRef(
|
|
734
734
|
({ name, value, checked, disabled, label, onValueChange, className, ...liProps }, ref) => {
|
|
735
735
|
return /* @__PURE__ */ jsx(
|
|
736
736
|
"li",
|
|
@@ -770,7 +770,7 @@ var MenuRadioItem = React9.forwardRef(
|
|
|
770
770
|
}
|
|
771
771
|
);
|
|
772
772
|
MenuRadioItem.displayName = "Menu.RadioItem";
|
|
773
|
-
var MenuSeparator =
|
|
773
|
+
var MenuSeparator = React8.forwardRef(
|
|
774
774
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
775
775
|
"li",
|
|
776
776
|
{
|
|
@@ -782,7 +782,7 @@ var MenuSeparator = React9.forwardRef(
|
|
|
782
782
|
)
|
|
783
783
|
);
|
|
784
784
|
MenuSeparator.displayName = "Menu.Separator";
|
|
785
|
-
var MenuHeader =
|
|
785
|
+
var MenuHeader = React8.forwardRef(
|
|
786
786
|
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
787
787
|
"li",
|
|
788
788
|
{
|
|
@@ -1042,7 +1042,7 @@ var Popover = forwardRef(function Popover2({
|
|
|
1042
1042
|
(_b = (_a = triggerElRef.current) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
|
|
1043
1043
|
}, [isOpen, returnFocus]);
|
|
1044
1044
|
const icon = isOpen ? /* @__PURE__ */ jsx(ChevronUp, { className: "dbc-muted-text", size: 20 }) : /* @__PURE__ */ jsx(ChevronDown, { className: "dbc-muted-text", size: 20 });
|
|
1045
|
-
const setOverlayRef =
|
|
1045
|
+
const setOverlayRef = React8.useCallback(
|
|
1046
1046
|
(node) => {
|
|
1047
1047
|
assignRef(overlayRef, node);
|
|
1048
1048
|
},
|
|
@@ -1870,24 +1870,10 @@ function SkeletonLoaderItem({
|
|
|
1870
1870
|
}
|
|
1871
1871
|
);
|
|
1872
1872
|
}
|
|
1873
|
-
function getColumnWidth(column) {
|
|
1874
|
-
if (typeof column.width === "number" && column.width < 150) {
|
|
1875
|
-
return "100%";
|
|
1876
|
-
}
|
|
1877
|
-
if (typeof column.width === "string" && column.width.endsWith("px")) {
|
|
1878
|
-
const px = parseInt(column.width, 10);
|
|
1879
|
-
if (!isNaN(px) && px < 150) {
|
|
1880
|
-
return "100%";
|
|
1881
|
-
}
|
|
1882
|
-
}
|
|
1883
|
-
const percent = Math.floor(Math.random() * (90 - 50 + 1)) + 50;
|
|
1884
|
-
return `${percent}%`;
|
|
1885
|
-
}
|
|
1886
1873
|
function TableLoadingBody({ rows, columns, hasSelection }) {
|
|
1887
|
-
const widths = Array.from({ length: rows }, () => columns.map(getColumnWidth));
|
|
1888
1874
|
return /* @__PURE__ */ jsx("tbody", { className: Table_default.body, children: Array.from({ length: rows }).map((_, rowIndex) => /* @__PURE__ */ jsxs("tr", { className: Table_default.row, children: [
|
|
1889
1875
|
hasSelection ? /* @__PURE__ */ jsx("td", { className: cx2(Table_default.cell, Table_default.selectionCell), children: /* @__PURE__ */ jsx("div", { className: Table_default.cellContent, children: /* @__PURE__ */ jsx(SkeletonLoaderItem, { height: 20, width: 20 }) }) }) : null,
|
|
1890
|
-
columns.map((column
|
|
1876
|
+
columns.map((column) => {
|
|
1891
1877
|
var _a;
|
|
1892
1878
|
return /* @__PURE__ */ jsx(
|
|
1893
1879
|
"td",
|
|
@@ -1899,7 +1885,7 @@ function TableLoadingBody({ rows, columns, hasSelection }) {
|
|
|
1899
1885
|
),
|
|
1900
1886
|
"data-align": (_a = column.align) != null ? _a : "left",
|
|
1901
1887
|
"data-divider": column.divider,
|
|
1902
|
-
children: /* @__PURE__ */ jsx("div", { className: Table_default.cellContent, children: /* @__PURE__ */ jsx("div", { className: Table_default.cellValueEllipsis, children: /* @__PURE__ */ jsx(SkeletonLoaderItem, { height:
|
|
1888
|
+
children: /* @__PURE__ */ jsx("div", { className: Table_default.cellContent, children: /* @__PURE__ */ jsx("div", { className: Table_default.cellValueEllipsis, children: /* @__PURE__ */ jsx(SkeletonLoaderItem, { height: 20, width: "100%" }) }) })
|
|
1903
1889
|
},
|
|
1904
1890
|
column.id
|
|
1905
1891
|
);
|
|
@@ -2273,19 +2259,19 @@ function TanstackTable(props) {
|
|
|
2273
2259
|
...tableProps
|
|
2274
2260
|
} = props;
|
|
2275
2261
|
const isControlledSorting = controlledSorting != null;
|
|
2276
|
-
const [uiSorting, setUiSorting] =
|
|
2277
|
-
|
|
2262
|
+
const [uiSorting, setUiSorting] = React8.useState(controlledSorting != null ? controlledSorting : []);
|
|
2263
|
+
React8.useEffect(() => {
|
|
2278
2264
|
if (!isControlledSorting) return;
|
|
2279
2265
|
if (sortingEqual(uiSorting, controlledSorting)) return;
|
|
2280
2266
|
setUiSorting(controlledSorting);
|
|
2281
2267
|
}, [isControlledSorting, controlledSorting, uiSorting]);
|
|
2282
|
-
const columnVisibility =
|
|
2268
|
+
const columnVisibility = React8.useMemo(
|
|
2283
2269
|
() => buildColumnVisibilityFromVisibleIds(columns, visibleColumnIds),
|
|
2284
2270
|
[columns, visibleColumnIds]
|
|
2285
2271
|
);
|
|
2286
|
-
const [columnSizing, setColumnSizing] =
|
|
2287
|
-
const containerRef =
|
|
2288
|
-
const [availableWidth, setAvailableWidth] =
|
|
2272
|
+
const [columnSizing, setColumnSizing] = React8.useState({});
|
|
2273
|
+
const containerRef = React8.useRef(null);
|
|
2274
|
+
const [availableWidth, setAvailableWidth] = React8.useState(void 0);
|
|
2289
2275
|
const table = useReactTable({
|
|
2290
2276
|
data,
|
|
2291
2277
|
columns,
|
|
@@ -2311,7 +2297,7 @@ function TanstackTable(props) {
|
|
|
2311
2297
|
size: DEFAULT_COLUMN_PX
|
|
2312
2298
|
}
|
|
2313
2299
|
});
|
|
2314
|
-
|
|
2300
|
+
React8.useLayoutEffect(() => {
|
|
2315
2301
|
const el = containerRef.current;
|
|
2316
2302
|
if (!el) return;
|
|
2317
2303
|
const updateWidth = () => {
|
|
@@ -2327,7 +2313,7 @@ function TanstackTable(props) {
|
|
|
2327
2313
|
observer.observe(el);
|
|
2328
2314
|
return () => observer.disconnect();
|
|
2329
2315
|
}, []);
|
|
2330
|
-
const distributedLayout =
|
|
2316
|
+
const distributedLayout = React8.useMemo(() => {
|
|
2331
2317
|
if (availableWidth == null) return null;
|
|
2332
2318
|
return buildDistributedColumnWidths({
|
|
2333
2319
|
table,
|
|
@@ -2338,7 +2324,7 @@ function TanstackTable(props) {
|
|
|
2338
2324
|
});
|
|
2339
2325
|
}, [table, selectedRows, onRowSelect, dataKey, columnSizing, availableWidth]);
|
|
2340
2326
|
const initialLayoutReady = availableWidth != null;
|
|
2341
|
-
const resolvedLayout =
|
|
2327
|
+
const resolvedLayout = React8.useMemo(() => {
|
|
2342
2328
|
const next = {};
|
|
2343
2329
|
table.getVisibleLeafColumns().forEach((column) => {
|
|
2344
2330
|
next[column.id] = {
|
|
@@ -2347,13 +2333,13 @@ function TanstackTable(props) {
|
|
|
2347
2333
|
});
|
|
2348
2334
|
return next;
|
|
2349
2335
|
}, [table, distributedLayout]);
|
|
2350
|
-
const columnItems =
|
|
2336
|
+
const columnItems = React8.useMemo(
|
|
2351
2337
|
() => mapDefsToColumnItems(columns, columnVisibility, resolvedLayout),
|
|
2352
2338
|
[columns, columnVisibility, resolvedLayout]
|
|
2353
2339
|
);
|
|
2354
2340
|
const visibleData = table.getRowModel().rows.map((r) => r.original);
|
|
2355
2341
|
const { sortById, sortDirection } = getSortPropsFromSorting(uiSorting);
|
|
2356
|
-
const handleSortChange =
|
|
2342
|
+
const handleSortChange = React8.useCallback(
|
|
2357
2343
|
(column, direction) => {
|
|
2358
2344
|
const next = direction == null ? [] : [{ id: column.id, desc: direction === "desc" }];
|
|
2359
2345
|
if (optimisticSortingUi) setUiSorting(next);
|
|
@@ -2361,7 +2347,7 @@ function TanstackTable(props) {
|
|
|
2361
2347
|
},
|
|
2362
2348
|
[optimisticSortingUi, onSortingChange]
|
|
2363
2349
|
);
|
|
2364
|
-
const headerExtras =
|
|
2350
|
+
const headerExtras = React8.useCallback(
|
|
2365
2351
|
({ index }) => {
|
|
2366
2352
|
var _a, _b, _c, _d;
|
|
2367
2353
|
const headerGroups = table.getHeaderGroups();
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { PageLayoutMaxWidth } from '../../PageLayout';
|
|
3
|
-
export interface PageLayoutHeroProps {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
link?: (children: React.ReactNode) => React.ReactNode;
|
|
6
|
-
image?: React.ReactNode;
|
|
7
|
-
headline?: string | React.ReactNode;
|
|
8
|
-
metaHeadline?: string | React.ReactNode;
|
|
9
|
-
maxWidth?: PageLayoutMaxWidth;
|
|
10
|
-
textBgColor?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare const PageLayoutHero: React.FC<PageLayoutHeroProps>;
|