@dbcdk/react-components 0.0.98 → 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/tanstack.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useReactTable, getSortedRowModel, getCoreRowModel } from '@tanstack/react-table';
2
- import * as React9 from 'react';
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 = React9.forwardRef(function Button2({
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 && React9.isValidElement(children) ? (_a = children.ref) != null ? _a : null : null;
208
- const mergedRef = React9.useMemo(() => mergeRefs(childRef, ref), [childRef, ref]);
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 && React9.isValidElement(children)) {
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 = React9.cloneElement(children, {
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 = React9.forwardRef(
557
+ var MenuBase = React8.forwardRef(
558
558
  ({ children, className, itemRole = "menuitem", gap, onKeyDown, ...props }, ref) => {
559
- const internalRef = React9.useRef(null);
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) => React9.isValidElement(el) && (typeof el.type === "string" ? el.type === "a" || el.type === "button" : true);
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 = React9.cloneElement(child, {
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 React9.cloneElement(child, {
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 React9.cloneElement(nextImmediate, {
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 = React9.forwardRef(
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 = React9.forwardRef(
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 = React9.forwardRef(
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 = React9.forwardRef(
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 = React9.forwardRef(
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 = React9.useCallback(
1045
+ const setOverlayRef = React8.useCallback(
1046
1046
  (node) => {
1047
1047
  assignRef(overlayRef, node);
1048
1048
  },
@@ -2259,19 +2259,19 @@ function TanstackTable(props) {
2259
2259
  ...tableProps
2260
2260
  } = props;
2261
2261
  const isControlledSorting = controlledSorting != null;
2262
- const [uiSorting, setUiSorting] = React9.useState(controlledSorting != null ? controlledSorting : []);
2263
- React9.useEffect(() => {
2262
+ const [uiSorting, setUiSorting] = React8.useState(controlledSorting != null ? controlledSorting : []);
2263
+ React8.useEffect(() => {
2264
2264
  if (!isControlledSorting) return;
2265
2265
  if (sortingEqual(uiSorting, controlledSorting)) return;
2266
2266
  setUiSorting(controlledSorting);
2267
2267
  }, [isControlledSorting, controlledSorting, uiSorting]);
2268
- const columnVisibility = React9.useMemo(
2268
+ const columnVisibility = React8.useMemo(
2269
2269
  () => buildColumnVisibilityFromVisibleIds(columns, visibleColumnIds),
2270
2270
  [columns, visibleColumnIds]
2271
2271
  );
2272
- const [columnSizing, setColumnSizing] = React9.useState({});
2273
- const containerRef = React9.useRef(null);
2274
- const [availableWidth, setAvailableWidth] = React9.useState(void 0);
2272
+ const [columnSizing, setColumnSizing] = React8.useState({});
2273
+ const containerRef = React8.useRef(null);
2274
+ const [availableWidth, setAvailableWidth] = React8.useState(void 0);
2275
2275
  const table = useReactTable({
2276
2276
  data,
2277
2277
  columns,
@@ -2297,7 +2297,7 @@ function TanstackTable(props) {
2297
2297
  size: DEFAULT_COLUMN_PX
2298
2298
  }
2299
2299
  });
2300
- React9.useLayoutEffect(() => {
2300
+ React8.useLayoutEffect(() => {
2301
2301
  const el = containerRef.current;
2302
2302
  if (!el) return;
2303
2303
  const updateWidth = () => {
@@ -2313,7 +2313,7 @@ function TanstackTable(props) {
2313
2313
  observer.observe(el);
2314
2314
  return () => observer.disconnect();
2315
2315
  }, []);
2316
- const distributedLayout = React9.useMemo(() => {
2316
+ const distributedLayout = React8.useMemo(() => {
2317
2317
  if (availableWidth == null) return null;
2318
2318
  return buildDistributedColumnWidths({
2319
2319
  table,
@@ -2324,7 +2324,7 @@ function TanstackTable(props) {
2324
2324
  });
2325
2325
  }, [table, selectedRows, onRowSelect, dataKey, columnSizing, availableWidth]);
2326
2326
  const initialLayoutReady = availableWidth != null;
2327
- const resolvedLayout = React9.useMemo(() => {
2327
+ const resolvedLayout = React8.useMemo(() => {
2328
2328
  const next = {};
2329
2329
  table.getVisibleLeafColumns().forEach((column) => {
2330
2330
  next[column.id] = {
@@ -2333,13 +2333,13 @@ function TanstackTable(props) {
2333
2333
  });
2334
2334
  return next;
2335
2335
  }, [table, distributedLayout]);
2336
- const columnItems = React9.useMemo(
2336
+ const columnItems = React8.useMemo(
2337
2337
  () => mapDefsToColumnItems(columns, columnVisibility, resolvedLayout),
2338
2338
  [columns, columnVisibility, resolvedLayout]
2339
2339
  );
2340
2340
  const visibleData = table.getRowModel().rows.map((r) => r.original);
2341
2341
  const { sortById, sortDirection } = getSortPropsFromSorting(uiSorting);
2342
- const handleSortChange = React9.useCallback(
2342
+ const handleSortChange = React8.useCallback(
2343
2343
  (column, direction) => {
2344
2344
  const next = direction == null ? [] : [{ id: column.id, desc: direction === "desc" }];
2345
2345
  if (optimisticSortingUi) setUiSorting(next);
@@ -2347,7 +2347,7 @@ function TanstackTable(props) {
2347
2347
  },
2348
2348
  [optimisticSortingUi, onSortingChange]
2349
2349
  );
2350
- const headerExtras = React9.useCallback(
2350
+ const headerExtras = React8.useCallback(
2351
2351
  ({ index }) => {
2352
2352
  var _a, _b, _c, _d;
2353
2353
  const headerGroups = table.getHeaderGroups();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.98",
3
+ "version": "0.0.101",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",