@trackunit/react-components 1.17.6 → 1.17.8

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
@@ -1289,15 +1289,15 @@ const useViewportBreakpoints = (options = {}) => {
1289
1289
 
1290
1290
  const cvaBreadcrumb = cssClassVarianceUtilities.cvaMerge(["my-4", "flex", "place-items-center"]);
1291
1291
  const cvaBreadcrumbItem = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
1292
- const cvaBreadcrumbForLargeScreen = cssClassVarianceUtilities.cvaMerge(["flex", "flex-nowrap"]);
1293
- const cvaBreadcrumbForMediumScreen = cssClassVarianceUtilities.cvaMerge(["flex"], {
1292
+ const cvaBreadcrumbForLargeScreen = cssClassVarianceUtilities.cvaMerge(["flex", "flex-nowrap", "items-center"]);
1293
+ const cvaBreadcrumbForMediumScreen = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"], {
1294
1294
  variants: {
1295
1295
  expanded: {
1296
1296
  true: "flex-wrap",
1297
1297
  false: "flex-nowrap",
1298
1298
  },
1299
- defaultVariants: { expanded: false },
1300
1299
  },
1300
+ defaultVariants: { expanded: false },
1301
1301
  });
1302
1302
 
1303
1303
  /**
@@ -1322,7 +1322,7 @@ const BreadcrumbForMediumScreen = ({ "data-testid": dataTestId, breadcrumbItems,
1322
1322
  const [expanded, setExpanded] = react.useState(false);
1323
1323
  const getReducedArray = react.useCallback(() => {
1324
1324
  let reducedArrayElements = [];
1325
- const collapsibleButton = (jsxRuntime.jsxs("div", { className: cvaBreadcrumbItem(), children: [jsxRuntime.jsx(IconButton, { "data-testid": `collapsibleButton-${dataTestId}`, icon: jsxRuntime.jsx(Icon, { name: "EllipsisHorizontal", size: "small" }), onClick: () => setExpanded(true), size: "small", variant: "ghost-neutral" }), jsxRuntime.jsx(Icon, { color: "neutral", name: "Slash", size: "small" })] }));
1325
+ const collapsibleButton = (jsxRuntime.jsxs("div", { className: cvaBreadcrumbItem(), children: [jsxRuntime.jsx(IconButton, { "data-testid": `collapsibleButton-${dataTestId}`, icon: jsxRuntime.jsx(Icon, { name: "EllipsisHorizontal" }), onClick: () => setExpanded(true), size: "small", variant: "ghost-neutral" }), jsxRuntime.jsx(Icon, { className: "text-neutral-300", name: "Slash", size: "small" })] }));
1326
1326
  const firstBreadcrumbItem = breadcrumbItems[0];
1327
1327
  if (firstBreadcrumbItem && breadcrumbItems.length > 3) {
1328
1328
  const lastTwoBreadcrumbItem = breadcrumbItems.slice(-2);
@@ -1349,9 +1349,9 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
1349
1349
  const breadCrumbItemsToJSX = breadcrumbItems.map((item, index, array) => {
1350
1350
  const isLast = index === array.length - 1;
1351
1351
  if (!isLast) {
1352
- return (jsxRuntime.jsxs("div", { 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));
1352
+ 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));
1353
1353
  }
1354
- return (jsxRuntime.jsx(Text, { className: "text-nowrap", size: "small", children: item.label }, index));
1354
+ return (jsxRuntime.jsx(Text, { className: "text-nowrap pl-2 font-medium", size: "small", children: item.label }, index));
1355
1355
  });
1356
1356
  return breadCrumbItemsToJSX;
1357
1357
  };
@@ -1359,6 +1359,9 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
1359
1359
  /**
1360
1360
  * The breadcrumb component shows a user's location in a website or application. Breadcrumbs are particularly useful when a large amount of content is organized in a hierarchical manner. They streamline navigation, minimize the steps required to revisit previous pages, and offer contextual insights to the users.
1361
1361
  *
1362
+ * All items except the last are rendered as clickable links. The last item is rendered as plain text representing the current page.
1363
+ * The component automatically adapts to the screen size: on large screens all items are visible, on medium screens middle items collapse behind an ellipsis button, and on small screens only the current page is shown.
1364
+ *
1362
1365
  * ### When to use
1363
1366
  * Use breadcrumbs when deep navigation is available, on apps or pages where users might dive into content and could benefit from a quick way to return to higher levels. Breadcrumbs display the current screen as the final item in the list to make it clear where the user is.
1364
1367
  *
@@ -1381,7 +1384,7 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
1381
1384
  * { label: "Assets", to: "/fleet/assets" },
1382
1385
  * { label: "Excavator 001", to: "/fleet/assets/123" },
1383
1386
  * ]}
1384
- * back={() => navigate({ to: "/fleet/assets" })}
1387
+ * onClickBack={() => navigate({ to: "/fleet/assets" })}
1385
1388
  * />
1386
1389
  * );
1387
1390
  * };
package/index.esm.js CHANGED
@@ -1287,15 +1287,15 @@ const useViewportBreakpoints = (options = {}) => {
1287
1287
 
1288
1288
  const cvaBreadcrumb = cvaMerge(["my-4", "flex", "place-items-center"]);
1289
1289
  const cvaBreadcrumbItem = cvaMerge(["flex", "items-center"]);
1290
- const cvaBreadcrumbForLargeScreen = cvaMerge(["flex", "flex-nowrap"]);
1291
- const cvaBreadcrumbForMediumScreen = cvaMerge(["flex"], {
1290
+ const cvaBreadcrumbForLargeScreen = cvaMerge(["flex", "flex-nowrap", "items-center"]);
1291
+ const cvaBreadcrumbForMediumScreen = cvaMerge(["flex", "items-center"], {
1292
1292
  variants: {
1293
1293
  expanded: {
1294
1294
  true: "flex-wrap",
1295
1295
  false: "flex-nowrap",
1296
1296
  },
1297
- defaultVariants: { expanded: false },
1298
1297
  },
1298
+ defaultVariants: { expanded: false },
1299
1299
  });
1300
1300
 
1301
1301
  /**
@@ -1320,7 +1320,7 @@ const BreadcrumbForMediumScreen = ({ "data-testid": dataTestId, breadcrumbItems,
1320
1320
  const [expanded, setExpanded] = useState(false);
1321
1321
  const getReducedArray = useCallback(() => {
1322
1322
  let reducedArrayElements = [];
1323
- const collapsibleButton = (jsxs("div", { className: cvaBreadcrumbItem(), children: [jsx(IconButton, { "data-testid": `collapsibleButton-${dataTestId}`, icon: jsx(Icon, { name: "EllipsisHorizontal", size: "small" }), onClick: () => setExpanded(true), size: "small", variant: "ghost-neutral" }), jsx(Icon, { color: "neutral", name: "Slash", size: "small" })] }));
1323
+ const collapsibleButton = (jsxs("div", { className: cvaBreadcrumbItem(), children: [jsx(IconButton, { "data-testid": `collapsibleButton-${dataTestId}`, icon: jsx(Icon, { name: "EllipsisHorizontal" }), onClick: () => setExpanded(true), size: "small", variant: "ghost-neutral" }), jsx(Icon, { className: "text-neutral-300", name: "Slash", size: "small" })] }));
1324
1324
  const firstBreadcrumbItem = breadcrumbItems[0];
1325
1325
  if (firstBreadcrumbItem && breadcrumbItems.length > 3) {
1326
1326
  const lastTwoBreadcrumbItem = breadcrumbItems.slice(-2);
@@ -1347,9 +1347,9 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
1347
1347
  const breadCrumbItemsToJSX = breadcrumbItems.map((item, index, array) => {
1348
1348
  const isLast = index === array.length - 1;
1349
1349
  if (!isLast) {
1350
- return (jsxs("div", { 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));
1350
+ 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));
1351
1351
  }
1352
- return (jsx(Text, { className: "text-nowrap", size: "small", children: item.label }, index));
1352
+ return (jsx(Text, { className: "text-nowrap pl-2 font-medium", size: "small", children: item.label }, index));
1353
1353
  });
1354
1354
  return breadCrumbItemsToJSX;
1355
1355
  };
@@ -1357,6 +1357,9 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
1357
1357
  /**
1358
1358
  * The breadcrumb component shows a user's location in a website or application. Breadcrumbs are particularly useful when a large amount of content is organized in a hierarchical manner. They streamline navigation, minimize the steps required to revisit previous pages, and offer contextual insights to the users.
1359
1359
  *
1360
+ * All items except the last are rendered as clickable links. The last item is rendered as plain text representing the current page.
1361
+ * The component automatically adapts to the screen size: on large screens all items are visible, on medium screens middle items collapse behind an ellipsis button, and on small screens only the current page is shown.
1362
+ *
1360
1363
  * ### When to use
1361
1364
  * Use breadcrumbs when deep navigation is available, on apps or pages where users might dive into content and could benefit from a quick way to return to higher levels. Breadcrumbs display the current screen as the final item in the list to make it clear where the user is.
1362
1365
  *
@@ -1379,7 +1382,7 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
1379
1382
  * { label: "Assets", to: "/fleet/assets" },
1380
1383
  * { label: "Excavator 001", to: "/fleet/assets/123" },
1381
1384
  * ]}
1382
- * back={() => navigate({ to: "/fleet/assets" })}
1385
+ * onClickBack={() => navigate({ to: "/fleet/assets" })}
1383
1386
  * />
1384
1387
  * );
1385
1388
  * };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.17.6",
3
+ "version": "1.17.8",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -14,10 +14,10 @@
14
14
  "@floating-ui/react": "^0.26.25",
15
15
  "string-ts": "^2.0.0",
16
16
  "tailwind-merge": "^2.0.0",
17
- "@trackunit/ui-design-tokens": "1.11.35",
18
- "@trackunit/css-class-variance-utilities": "1.11.35",
19
- "@trackunit/shared-utils": "1.13.35",
20
- "@trackunit/ui-icons": "1.11.34",
17
+ "@trackunit/ui-design-tokens": "1.11.37",
18
+ "@trackunit/css-class-variance-utilities": "1.11.37",
19
+ "@trackunit/shared-utils": "1.13.37",
20
+ "@trackunit/ui-icons": "1.11.36",
21
21
  "@tanstack/react-router": "1.114.29",
22
22
  "es-toolkit": "^1.39.10",
23
23
  "@tanstack/react-virtual": "3.13.12",
@@ -3,6 +3,9 @@ import { BreadcrumbContainerProps, BreadcrumbProps } from "./utils/types";
3
3
  /**
4
4
  * The breadcrumb component shows a user's location in a website or application. Breadcrumbs are particularly useful when a large amount of content is organized in a hierarchical manner. They streamline navigation, minimize the steps required to revisit previous pages, and offer contextual insights to the users.
5
5
  *
6
+ * All items except the last are rendered as clickable links. The last item is rendered as plain text representing the current page.
7
+ * The component automatically adapts to the screen size: on large screens all items are visible, on medium screens middle items collapse behind an ellipsis button, and on small screens only the current page is shown.
8
+ *
6
9
  * ### When to use
7
10
  * Use breadcrumbs when deep navigation is available, on apps or pages where users might dive into content and could benefit from a quick way to return to higher levels. Breadcrumbs display the current screen as the final item in the list to make it clear where the user is.
8
11
  *
@@ -25,7 +28,7 @@ import { BreadcrumbContainerProps, BreadcrumbProps } from "./utils/types";
25
28
  * { label: "Assets", to: "/fleet/assets" },
26
29
  * { label: "Excavator 001", to: "/fleet/assets/123" },
27
30
  * ]}
28
- * back={() => navigate({ to: "/fleet/assets" })}
31
+ * onClickBack={() => navigate({ to: "/fleet/assets" })}
29
32
  * />
30
33
  * );
31
34
  * };
@@ -3,5 +3,4 @@ export declare const cvaBreadcrumbItem: (props?: import("class-variance-authorit
3
3
  export declare const cvaBreadcrumbForLargeScreen: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
4
4
  export declare const cvaBreadcrumbForMediumScreen: (props?: ({
5
5
  expanded?: boolean | null | undefined;
6
- defaultVariants?: "expanded" | null | undefined;
7
6
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -1,11 +1,20 @@
1
1
  import { MouseEventHandler, ReactElement } from "react";
2
2
  import { CommonProps } from "../../../common/CommonProps";
3
3
  export interface BreadcrumbItemProps {
4
+ /** The display text for this breadcrumb item. */
4
5
  label: string;
6
+ /** The route path this breadcrumb item links to. */
5
7
  to: string;
6
8
  }
7
9
  export interface BreadcrumbProps extends CommonProps {
10
+ /**
11
+ * The ordered list of breadcrumb items representing the navigation hierarchy.
12
+ * The last item is rendered as plain text (the current page), all preceding items are rendered as clickable links.
13
+ */
8
14
  breadcrumbItems: Array<BreadcrumbItemProps>;
15
+ /**
16
+ * Click handler for the back arrow button. Typically navigates to the previous breadcrumb item (second-to-last in the list).
17
+ */
9
18
  onClickBack: MouseEventHandler<HTMLButtonElement>;
10
19
  }
11
20
  export interface BreadcrumbContainerProps extends CommonProps {