@trackunit/react-components 1.20.20 → 1.21.4

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/index.cjs.js CHANGED
@@ -1462,14 +1462,13 @@ const BreadcrumbForSmallScreen = ({ "data-testid": dataTestId, breadcrumbItems,
1462
1462
  * useBreadcrumbItemsToRender is a custom hook that takes an array of BreadcrumbItemProps and returns an array of React.ReactElement
1463
1463
  */
1464
1464
  const useBreadcrumbItemsToRender = (breadcrumbItems) => {
1465
- const breadCrumbItemsToJSX = breadcrumbItems.map((item, index, array) => {
1465
+ return react.useMemo(() => breadcrumbItems.map((item, index, array) => {
1466
1466
  const isLast = index === array.length - 1;
1467
1467
  if (!isLast) {
1468
1468
  return (jsxRuntime.jsxs("div", { className: "flex items-center", children: [jsxRuntime.jsx(Button, { asChild: true, size: "small", variant: "ghost-neutral", children: jsxRuntime.jsx(reactRouter.Link, { to: item.to, children: item.label }) }), jsxRuntime.jsx(Icon, { className: "text-neutral-300", name: "Slash", size: "small" })] }, index));
1469
1469
  }
1470
1470
  return (jsxRuntime.jsx(Text, { className: "text-nowrap pl-2 font-medium", size: "small", children: item.label }, index));
1471
- });
1472
- return breadCrumbItemsToJSX;
1471
+ }), [breadcrumbItems]);
1473
1472
  };
1474
1473
 
1475
1474
  /**
@@ -2315,7 +2314,7 @@ const useCopyToClipboard = () => {
2315
2314
  throw new Error(`Copy failed: ${errorMessage}`);
2316
2315
  }
2317
2316
  }, []);
2318
- return [isCopied, copyToClipboard];
2317
+ return react.useMemo(() => [isCopied, copyToClipboard], [isCopied, copyToClipboard]);
2319
2318
  };
2320
2319
 
2321
2320
  /**
@@ -2474,7 +2473,7 @@ const DEFAULT_SIZING = {
2474
2473
  * @param {PopoverProps} options The options for the popover
2475
2474
  * @returns {UsePopoverType} The data for the popover
2476
2475
  */
2477
- const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = DEFAULT_ACTIVATION, dismissal = DEFAULT_DISMISSAL, sizing = DEFAULT_SIZING, onOpenStateChange, ...restOptions }) => {
2476
+ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = DEFAULT_ACTIVATION, dismissal = DEFAULT_DISMISSAL, sizing = DEFAULT_SIZING, onOpenStateChange, id, className, "data-testid": dataTestId, }) => {
2478
2477
  const [uncontrolledIsOpen, setUncontrolledIsOpen] = react.useState(initialOpen);
2479
2478
  const [labelId, setLabelId] = react.useState();
2480
2479
  const [descriptionId, setDescriptionId] = react.useState();
@@ -2558,8 +2557,12 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
2558
2557
  descriptionId,
2559
2558
  setLabelId,
2560
2559
  setDescriptionId,
2561
- customProps: restOptions,
2562
- }), [isOpen, setUncontrolledIsOpen, combinedInteractions, popoverData, isModal, labelId, descriptionId, restOptions]);
2560
+ customProps: {
2561
+ id,
2562
+ className,
2563
+ "data-testid": dataTestId
2564
+ },
2565
+ }), [isOpen, setUncontrolledIsOpen, combinedInteractions, popoverData, isModal, labelId, descriptionId, id, className, dataTestId]);
2563
2566
  };
2564
2567
 
2565
2568
  const PopoverContext = react.createContext(null);
@@ -5916,7 +5919,7 @@ const useList = ({ count, pagination, header, getItem, loadingIndicator = DEFAUL
5916
5919
  // eslint-disable-next-line react-hooks/refs
5917
5920
  return containerRef.current ? totalSize >= containerRef.current.clientHeight : false;
5918
5921
  }, [totalSize]);
5919
- return {
5922
+ return react.useMemo(() => ({
5920
5923
  ...virtualizer,
5921
5924
  containerRef,
5922
5925
  listRef,
@@ -5930,7 +5933,21 @@ const useList = ({ count, pagination, header, getItem, loadingIndicator = DEFAUL
5930
5933
  topSeparatorOnScroll,
5931
5934
  isAtTop,
5932
5935
  contentFillsContainer,
5933
- };
5936
+ }), [
5937
+ virtualizer,
5938
+ containerRef,
5939
+ listRef,
5940
+ rows,
5941
+ getListItemProps,
5942
+ header,
5943
+ resolvedLoadingIndicator,
5944
+ shouldShowLoaderAtIndex,
5945
+ count,
5946
+ separator,
5947
+ topSeparatorOnScroll,
5948
+ isAtTop,
5949
+ contentFillsContainer,
5950
+ ]);
5934
5951
  };
5935
5952
  const getResolvedLoadingIndicator = (loadingIndicator) => {
5936
5953
  if (typeof loadingIndicator === "function") {
@@ -6024,9 +6041,7 @@ const useListItemHeight = () => {
6024
6041
  // Return the larger of calculated height or minimum height
6025
6042
  return Math.max(totalHeight, MIN_ITEM_HEIGHT);
6026
6043
  }, []);
6027
- return {
6028
- getListItemHeight,
6029
- };
6044
+ return react.useMemo(() => ({ getListItemHeight }), [getListItemHeight]);
6030
6045
  };
6031
6046
 
6032
6047
  // These must be two separate divs (menu and menulist) so that the overflow-clip can be applied to the parent and the overflow-y-auto can be applied to the child.
@@ -7600,7 +7615,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
7600
7615
  unobserve();
7601
7616
  };
7602
7617
  }, [initializeObserver, unobserve, children]);
7603
- return { overflowContainerRef, itemOverflowMap };
7618
+ return react.useMemo(() => ({ overflowContainerRef, itemOverflowMap }), [overflowContainerRef, itemOverflowMap]);
7604
7619
  };
7605
7620
 
7606
7621
  /**
package/index.esm.js CHANGED
@@ -1460,14 +1460,13 @@ const BreadcrumbForSmallScreen = ({ "data-testid": dataTestId, breadcrumbItems,
1460
1460
  * useBreadcrumbItemsToRender is a custom hook that takes an array of BreadcrumbItemProps and returns an array of React.ReactElement
1461
1461
  */
1462
1462
  const useBreadcrumbItemsToRender = (breadcrumbItems) => {
1463
- const breadCrumbItemsToJSX = breadcrumbItems.map((item, index, array) => {
1463
+ return useMemo(() => breadcrumbItems.map((item, index, array) => {
1464
1464
  const isLast = index === array.length - 1;
1465
1465
  if (!isLast) {
1466
1466
  return (jsxs("div", { className: "flex items-center", children: [jsx(Button, { asChild: true, size: "small", variant: "ghost-neutral", children: jsx(Link, { to: item.to, children: item.label }) }), jsx(Icon, { className: "text-neutral-300", name: "Slash", size: "small" })] }, index));
1467
1467
  }
1468
1468
  return (jsx(Text, { className: "text-nowrap pl-2 font-medium", size: "small", children: item.label }, index));
1469
- });
1470
- return breadCrumbItemsToJSX;
1469
+ }), [breadcrumbItems]);
1471
1470
  };
1472
1471
 
1473
1472
  /**
@@ -2313,7 +2312,7 @@ const useCopyToClipboard = () => {
2313
2312
  throw new Error(`Copy failed: ${errorMessage}`);
2314
2313
  }
2315
2314
  }, []);
2316
- return [isCopied, copyToClipboard];
2315
+ return useMemo(() => [isCopied, copyToClipboard], [isCopied, copyToClipboard]);
2317
2316
  };
2318
2317
 
2319
2318
  /**
@@ -2472,7 +2471,7 @@ const DEFAULT_SIZING = {
2472
2471
  * @param {PopoverProps} options The options for the popover
2473
2472
  * @returns {UsePopoverType} The data for the popover
2474
2473
  */
2475
- const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = DEFAULT_ACTIVATION, dismissal = DEFAULT_DISMISSAL, sizing = DEFAULT_SIZING, onOpenStateChange, ...restOptions }) => {
2474
+ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = DEFAULT_ACTIVATION, dismissal = DEFAULT_DISMISSAL, sizing = DEFAULT_SIZING, onOpenStateChange, id, className, "data-testid": dataTestId, }) => {
2476
2475
  const [uncontrolledIsOpen, setUncontrolledIsOpen] = useState(initialOpen);
2477
2476
  const [labelId, setLabelId] = useState();
2478
2477
  const [descriptionId, setDescriptionId] = useState();
@@ -2556,8 +2555,12 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
2556
2555
  descriptionId,
2557
2556
  setLabelId,
2558
2557
  setDescriptionId,
2559
- customProps: restOptions,
2560
- }), [isOpen, setUncontrolledIsOpen, combinedInteractions, popoverData, isModal, labelId, descriptionId, restOptions]);
2558
+ customProps: {
2559
+ id,
2560
+ className,
2561
+ "data-testid": dataTestId
2562
+ },
2563
+ }), [isOpen, setUncontrolledIsOpen, combinedInteractions, popoverData, isModal, labelId, descriptionId, id, className, dataTestId]);
2561
2564
  };
2562
2565
 
2563
2566
  const PopoverContext = createContext(null);
@@ -5914,7 +5917,7 @@ const useList = ({ count, pagination, header, getItem, loadingIndicator = DEFAUL
5914
5917
  // eslint-disable-next-line react-hooks/refs
5915
5918
  return containerRef.current ? totalSize >= containerRef.current.clientHeight : false;
5916
5919
  }, [totalSize]);
5917
- return {
5920
+ return useMemo(() => ({
5918
5921
  ...virtualizer,
5919
5922
  containerRef,
5920
5923
  listRef,
@@ -5928,7 +5931,21 @@ const useList = ({ count, pagination, header, getItem, loadingIndicator = DEFAUL
5928
5931
  topSeparatorOnScroll,
5929
5932
  isAtTop,
5930
5933
  contentFillsContainer,
5931
- };
5934
+ }), [
5935
+ virtualizer,
5936
+ containerRef,
5937
+ listRef,
5938
+ rows,
5939
+ getListItemProps,
5940
+ header,
5941
+ resolvedLoadingIndicator,
5942
+ shouldShowLoaderAtIndex,
5943
+ count,
5944
+ separator,
5945
+ topSeparatorOnScroll,
5946
+ isAtTop,
5947
+ contentFillsContainer,
5948
+ ]);
5932
5949
  };
5933
5950
  const getResolvedLoadingIndicator = (loadingIndicator) => {
5934
5951
  if (typeof loadingIndicator === "function") {
@@ -6022,9 +6039,7 @@ const useListItemHeight = () => {
6022
6039
  // Return the larger of calculated height or minimum height
6023
6040
  return Math.max(totalHeight, MIN_ITEM_HEIGHT);
6024
6041
  }, []);
6025
- return {
6026
- getListItemHeight,
6027
- };
6042
+ return useMemo(() => ({ getListItemHeight }), [getListItemHeight]);
6028
6043
  };
6029
6044
 
6030
6045
  // These must be two separate divs (menu and menulist) so that the overflow-clip can be applied to the parent and the overflow-y-auto can be applied to the child.
@@ -7598,7 +7613,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
7598
7613
  unobserve();
7599
7614
  };
7600
7615
  }, [initializeObserver, unobserve, children]);
7601
- return { overflowContainerRef, itemOverflowMap };
7616
+ return useMemo(() => ({ overflowContainerRef, itemOverflowMap }), [overflowContainerRef, itemOverflowMap]);
7602
7617
  };
7603
7618
 
7604
7619
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.20.20",
3
+ "version": "1.21.4",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -13,10 +13,10 @@
13
13
  "@floating-ui/react": "^0.26.25",
14
14
  "string-ts": "^2.0.0",
15
15
  "tailwind-merge": "^2.0.0",
16
- "@trackunit/ui-design-tokens": "1.11.86",
17
- "@trackunit/css-class-variance-utilities": "1.11.89",
18
- "@trackunit/shared-utils": "1.13.89",
19
- "@trackunit/ui-icons": "1.11.85",
16
+ "@trackunit/ui-design-tokens": "1.11.88",
17
+ "@trackunit/css-class-variance-utilities": "1.11.91",
18
+ "@trackunit/shared-utils": "1.13.91",
19
+ "@trackunit/ui-icons": "1.11.87",
20
20
  "es-toolkit": "^1.39.10",
21
21
  "@tanstack/react-virtual": "3.13.12",
22
22
  "fflate": "^0.8.2",
@@ -6,4 +6,4 @@ import { PopoverProps, UsePopoverType } from "./PopoverTypes";
6
6
  * @param {PopoverProps} options The options for the popover
7
7
  * @returns {UsePopoverType} The data for the popover
8
8
  */
9
- export declare const usePopover: ({ initialOpen, placement, isModal, isOpen: controlledIsOpen, activation, dismissal, sizing, onOpenStateChange, ...restOptions }: PopoverProps) => UsePopoverType;
9
+ export declare const usePopover: ({ initialOpen, placement, isModal, isOpen: controlledIsOpen, activation, dismissal, sizing, onOpenStateChange, id, className, "data-testid": dataTestId, }: PopoverProps) => UsePopoverType;