@trackunit/react-components 1.14.18 → 1.14.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.14.18",
3
+ "version": "1.14.19",
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.10.15",
18
- "@trackunit/css-class-variance-utilities": "1.10.15",
19
- "@trackunit/shared-utils": "1.12.15",
20
- "@trackunit/ui-icons": "1.10.15",
17
+ "@trackunit/ui-design-tokens": "1.10.16",
18
+ "@trackunit/css-class-variance-utilities": "1.10.16",
19
+ "@trackunit/shared-utils": "1.12.16",
20
+ "@trackunit/ui-icons": "1.10.16",
21
21
  "@tanstack/react-router": "1.114.29",
22
22
  "es-toolkit": "^1.39.10",
23
23
  "@tanstack/react-virtual": "3.13.12",
@@ -45,8 +45,66 @@ export interface AlertProps extends CommonProps {
45
45
  actionsInline?: boolean;
46
46
  }
47
47
  /**
48
- * The Alert component should be used to inform the user of important information.
48
+ * The Alert component should be used to inform the user of important information such as errors, warnings, success messages, or informational notices.
49
49
  *
50
+ * ### When to use
51
+ * Use alerts to communicate important information that requires user attention, such as form validation errors, action confirmations, or system status updates.
52
+ *
53
+ * ### When not to use
54
+ * Do not use alerts for non-critical information or marketing messages. Use Notice component for less urgent communications.
55
+ *
56
+ * @example Basic alert variants
57
+ * ```tsx
58
+ * import { Alert } from "@trackunit/react-components";
59
+ *
60
+ * const AlertExamples = () => {
61
+ * return (
62
+ * <div className="flex flex-col gap-4">
63
+ * <Alert color="info" title="Information">
64
+ * Your session will expire in 5 minutes.
65
+ * </Alert>
66
+ * <Alert color="success" title="Success">
67
+ * Asset successfully updated.
68
+ * </Alert>
69
+ * <Alert color="warning" title="Warning">
70
+ * Low battery detected on 3 assets.
71
+ * </Alert>
72
+ * <Alert color="danger" title="Error">
73
+ * Failed to save changes. Please try again.
74
+ * </Alert>
75
+ * </div>
76
+ * );
77
+ * };
78
+ * ```
79
+ * @example Alert with actions and close button
80
+ * ```tsx
81
+ * import { Alert } from "@trackunit/react-components";
82
+ * import { useState } from "react";
83
+ *
84
+ * const DismissibleAlert = () => {
85
+ * const [visible, setVisible] = useState(true);
86
+ *
87
+ * if (!visible) return null;
88
+ *
89
+ * return (
90
+ * <Alert
91
+ * color="warning"
92
+ * title="Unsaved Changes"
93
+ * onClose={() => setVisible(false)}
94
+ * primaryAction={{
95
+ * label: "Save Now",
96
+ * onClick: () => console.log("Saving..."),
97
+ * }}
98
+ * secondaryAction={{
99
+ * label: "Discard",
100
+ * onClick: () => setVisible(false),
101
+ * }}
102
+ * >
103
+ * You have unsaved changes that will be lost if you leave this page.
104
+ * </Alert>
105
+ * );
106
+ * };
107
+ * ```
50
108
  * @param {AlertProps} props - The props for the Alert component
51
109
  * @returns {ReactElement} Alert component
52
110
  */
@@ -45,6 +45,27 @@ export type BadgeProps = BaseBadgeProps;
45
45
  * - Use a Badge to indicate notifications or counts of applied elements.
46
46
  * - Use a [Tag](https://design.iris.trackunit.com/?path=/docs/react-components-tag--docs) for labeling statuses, categories, or selections.
47
47
  *
48
+ * @example Badge with count and max value
49
+ * ```tsx
50
+ * import { Badge, Button } from "@trackunit/react-components";
51
+ *
52
+ * const NotificationButton = () => (
53
+ * <Button variant="secondary">
54
+ * Notifications <Badge count={15} max={9} color="danger" />
55
+ * </Button>
56
+ * );
57
+ * ```
58
+ * @example Compact badge as status dot
59
+ * ```tsx
60
+ * import { Badge } from "@trackunit/react-components";
61
+ *
62
+ * const OnlineStatus = () => (
63
+ * <div className="flex items-center gap-2">
64
+ * <Badge compact color="primary" />
65
+ * <span>Online</span>
66
+ * </div>
67
+ * );
68
+ * ```
48
69
  * @param {BadgeProps} props - The props for the Badge component
49
70
  * @returns {ReactElement} Badge component
50
71
  */
@@ -10,6 +10,26 @@ import { BreadcrumbContainerProps, BreadcrumbProps } from "./utils/types";
10
10
  * Do not use on the first hierarchal level, such as a home page or a main page, as there is no previous step the user can get to.
11
11
  * Avoid using breadcrumbs to indicate forthcoming steps. For processes with sequential steps, use a wizard flow instead.
12
12
  *
13
+ * @example Basic breadcrumb navigation
14
+ * ```tsx
15
+ * import { Breadcrumb } from "@trackunit/react-components";
16
+ * import { useNavigate } from "@tanstack/react-router";
17
+ *
18
+ * const AssetDetailBreadcrumb = () => {
19
+ * const navigate = useNavigate();
20
+ *
21
+ * return (
22
+ * <Breadcrumb
23
+ * breadcrumbItems={[
24
+ * { label: "Fleet", to: "/fleet" },
25
+ * { label: "Assets", to: "/fleet/assets" },
26
+ * { label: "Excavator 001", to: "/fleet/assets/123" },
27
+ * ]}
28
+ * back={() => navigate({ to: "/fleet/assets" })}
29
+ * />
30
+ * );
31
+ * };
32
+ * ```
13
33
  * @param {BreadcrumbProps} props - The props for the Breadcrumb component
14
34
  * @returns {ReactElement} Breadcrumb component
15
35
  */
@@ -24,9 +24,49 @@ export interface CardProps extends CommonProps, InputHTMLAttributes<HTMLDivEleme
24
24
  onMouseLeave?: MouseEventHandler<HTMLDivElement>;
25
25
  }
26
26
  /**
27
- * The Card component is a container for UI elements, and is the main component of the modal.
27
+ * The Card component is a container for UI elements that groups related content together with a visual boundary.
28
28
  * To get the most out of the Card, use it in combination with the CardHeader, CardBody and CardFooter.
29
29
  *
30
+ * ### When to use
31
+ * Use cards to group related information and actions, such as in dashboards, list items, or content previews.
32
+ *
33
+ * ### When not to use
34
+ * Do not use cards for layout purposes only. Use standard containers or grid layouts instead.
35
+ *
36
+ * @example Basic card
37
+ * ```tsx
38
+ * import { Card, CardHeader, CardBody } from "@trackunit/react-components";
39
+ *
40
+ * const MyComponent = () => {
41
+ * return (
42
+ * <Card>
43
+ * <CardHeader title="Asset Details" />
44
+ * <CardBody>
45
+ * <p>This card contains information about the asset.</p>
46
+ * </CardBody>
47
+ * </Card>
48
+ * );
49
+ * };
50
+ * ```
51
+ * @example Clickable card with full content
52
+ * ```tsx
53
+ * import { Card, CardHeader, CardBody, CardFooter, Button } from "@trackunit/react-components";
54
+ *
55
+ * const AssetCard = () => {
56
+ * return (
57
+ * <Card onClick={() => console.log("Card clicked")}>
58
+ * <CardHeader title="Excavator #1234" subtitle="Last updated: 2 hours ago" />
59
+ * <CardBody>
60
+ * <p>Operating hours: 1,234</p>
61
+ * <p>Status: Active</p>
62
+ * </CardBody>
63
+ * <CardFooter>
64
+ * <Button variant="secondary" size="small">View Details</Button>
65
+ * </CardFooter>
66
+ * </Card>
67
+ * );
68
+ * };
69
+ * ```
30
70
  * @param {CardProps} props - The props for the Card component
31
71
  * @returns {ReactElement} Card component
32
72
  */
@@ -41,7 +41,7 @@ export interface CollapseProps extends CommonProps {
41
41
  * The Collapse component is a container for additional information that adds context to various flows. It is used for displaying non-essential information that can be hidden away.
42
42
  *
43
43
  * ### When to use
44
- * - To keep content off the screen to shorten pages and reduce scrolling, while its still only a tap away. Remember that the users might choose not to interact with the component and wont see the information within.
44
+ * - To keep content off the screen to shorten pages and reduce scrolling, while it's still only a tap away. Remember that the users might choose not to interact with the component and won't see the information within.
45
45
  * - To display additional details that are not essential or necessary in the main flow/page.
46
46
  *
47
47
  * ### When not to use
@@ -51,6 +51,35 @@ export interface CollapseProps extends CommonProps {
51
51
  * - To hide errors or information that is relevant for a user within a flow.
52
52
  * - To creating hierarchy levels by nesting them within each other.
53
53
  *
54
+ * @example Basic collapse section
55
+ * ```tsx
56
+ * import { Collapse, Text } from "@trackunit/react-components";
57
+ *
58
+ * const AdditionalDetails = () => (
59
+ * <Collapse id="details" label="Additional Details">
60
+ * <Text>
61
+ * This content is hidden by default and can be expanded by clicking the header.
62
+ * Use this for supplementary information that isn't critical to the main flow.
63
+ * </Text>
64
+ * </Collapse>
65
+ * );
66
+ * ```
67
+ * @example Collapse with header addon and initial expanded state
68
+ * ```tsx
69
+ * import { Collapse, Badge } from "@trackunit/react-components";
70
+ *
71
+ * const NotificationsSection = () => (
72
+ * <Collapse
73
+ * id="notifications"
74
+ * label="Notifications"
75
+ * initialExpanded={true}
76
+ * headerAddon={<Badge count={5} color="primary" />}
77
+ * onToggle={(e, expanded) => console.log("Expanded:", expanded)}
78
+ * >
79
+ * <div>Notification list content here</div>
80
+ * </Collapse>
81
+ * );
82
+ * ```
54
83
  * @param {CollapseProps} props - The props for the Collapse component
55
84
  * @returns {ReactElement} Collapse component
56
85
  */
@@ -23,13 +23,52 @@ export interface EmptyStateProps extends CommonProps {
23
23
  }
24
24
  /**
25
25
  *
26
- * Empty states serve as placeholders when there's no content to display in either a table or card. They guide users out of the empty state towards actionable steps, highlighting ways to progress. Its recommended to suggest simple actions that can help the users move out of the empty states towards the content that fits their goals.
26
+ * Empty states serve as placeholders when there's no content to display in either a table or card. They guide users out of the empty state towards actionable steps, highlighting ways to progress. It's recommended to suggest simple actions that can help the users move out of the empty states towards the content that fits their goals.
27
27
  * ## **When to Use**
28
28
  * - When user actions yield no results (e.g., empty search results or unfilled data).
29
29
  * - To offer guidance on navigating out of the empty state.
30
30
  * - In cases of errors (e.g., failed content loading, unexpected errors).
31
31
  * - For guidance purposes (e.g., onboarding, adjusting filters, exploring alternative approaches).
32
32
  * - In celebratory instances (e.g., no new notifications, services up to date).
33
+ *
34
+ * @example Empty state with actions for no search results
35
+ * ```tsx
36
+ * import { EmptyState } from "@trackunit/react-components";
37
+ *
38
+ * const NoSearchResults = () => (
39
+ * <EmptyState
40
+ * image="SEARCH_DOCUMENT"
41
+ * description="No assets match your search criteria"
42
+ * primaryAction={{
43
+ * title: "Clear filters",
44
+ * onClick: () => console.log("Clear filters"),
45
+ * }}
46
+ * secondaryAction={{
47
+ * title: "Add new asset",
48
+ * onClick: () => console.log("Add asset"),
49
+ * }}
50
+ * />
51
+ * );
52
+ * ```
53
+ * @example Empty state for error with help link
54
+ * ```tsx
55
+ * import { EmptyState } from "@trackunit/react-components";
56
+ *
57
+ * const ErrorState = () => (
58
+ * <EmptyState
59
+ * image="BUILDING_ERROR"
60
+ * description="Something went wrong while loading your data"
61
+ * primaryAction={{
62
+ * title: "Try again",
63
+ * onClick: () => window.location.reload(),
64
+ * }}
65
+ * additionalHelpAction={{
66
+ * title: "Contact support",
67
+ * to: { pathname: "https://support.trackunit.com", target: "_blank" },
68
+ * }}
69
+ * />
70
+ * );
71
+ * ```
33
72
  */
34
73
  export declare const EmptyState: ({ description, altText, image, customImageSrc, loading, "data-testid": dataTestId, className, primaryAction, secondaryAction, additionalHelpAction, }: EmptyStateProps) => ReactElement;
35
74
  export {};
@@ -1,4 +1,3 @@
1
- export * from "./AnatomySVG";
2
1
  export * from "./BuildingErrorSVG";
3
2
  export * from "./PhoneLockSecuritySVG";
4
3
  export * from "./RoadBlockSVG";
@@ -43,7 +43,32 @@ export interface IndicatorProps extends CommonProps {
43
43
  * _**Do use** indicators to communicate essential aspects of the state of an asset._
44
44
  *
45
45
  * _**Do not use** indicators for non-essential information, or to communicate information unrelated to the state of an asset._
46
-
46
+ *
47
+ * @example Asset status indicator with icon
48
+ * ```tsx
49
+ * import { Indicator, Icon } from "@trackunit/react-components";
50
+ *
51
+ * const AssetStatusIndicator = () => (
52
+ * <Indicator
53
+ * icon={<Icon name="Bolt" size="small" />}
54
+ * color="success"
55
+ * label="Running"
56
+ * />
57
+ * );
58
+ * ```
59
+ * @example Pinging indicator for alerts
60
+ * ```tsx
61
+ * import { Indicator, Icon } from "@trackunit/react-components";
62
+ *
63
+ * const AlertIndicator = () => (
64
+ * <Indicator
65
+ * icon={<Icon name="ExclamationTriangle" size="small" />}
66
+ * color="danger"
67
+ * label="Critical Alert"
68
+ * ping={true}
69
+ * />
70
+ * );
71
+ * ```
47
72
  * @param {IndicatorProps} props - The props for the Indicator component
48
73
  * @returns {ReactElement} Indicator component
49
74
  */
@@ -24,8 +24,43 @@ export interface KPIProps extends CommonProps, Styleable {
24
24
  variant?: "small" | "default" | "condensed";
25
25
  }
26
26
  /**
27
- * The KPI component is used to display KPIs.
27
+ * The KPI component displays a key performance indicator with a title, value, and unit.
28
+ * It's ideal for showing important metrics at a glance in dashboards and summary views.
28
29
  *
30
+ * ### When to use
31
+ * - To display important numeric metrics that users need to monitor
32
+ * - In dashboard headers, cards, or page summaries
33
+ * - When you need a compact way to show a labeled value with units
34
+ *
35
+ * ### When not to use
36
+ * - For detailed data that requires charts or tables
37
+ * - When the metric needs interactive elements (use KPICard instead)
38
+ *
39
+ * @example Basic KPI display
40
+ * ```tsx
41
+ * import { KPI } from "@trackunit/react-components";
42
+ *
43
+ * const FleetUtilization = () => (
44
+ * <KPI
45
+ * title="Fleet Utilization"
46
+ * value={87}
47
+ * unit="%"
48
+ * tooltipLabel="Average utilization across all assets"
49
+ * />
50
+ * );
51
+ * ```
52
+ * @example KPI variants
53
+ * ```tsx
54
+ * import { KPI } from "@trackunit/react-components";
55
+ *
56
+ * const MetricsRow = () => (
57
+ * <div className="flex gap-4">
58
+ * <KPI title="Total Assets" value={156} unit="units" variant="default" />
59
+ * <KPI title="Active" value={142} unit="" variant="small" />
60
+ * <KPI title="Idle Time" value="2.5" unit="hrs" variant="condensed" />
61
+ * </div>
62
+ * );
63
+ * ```
29
64
  * @param {KPIProps} props - The props for the KPI component
30
65
  * @returns {ReactElement} KPI component
31
66
  */
@@ -41,8 +41,54 @@ export interface KPICardProps extends MappedOmit<KPIProps, "variant"> {
41
41
  valueBar?: Omit<ValueBarProps, "className" | "dataTestId" | "size" | "valueColor">;
42
42
  }
43
43
  /**
44
- * The KPICard component is used to display KPIs.
44
+ * The KPICard component displays a key performance indicator in an interactive card format.
45
+ * It extends the basic KPI with additional features like icons, trends, value bars, and notices.
45
46
  *
47
+ * ### When to use
48
+ * - When KPIs need to be clickable or selectable
49
+ * - To show trends or progress alongside the metric value
50
+ * - When you need a richer visual representation of a KPI
51
+ *
52
+ * ### When not to use
53
+ * - For simple metric display without interaction (use KPI instead)
54
+ * - When space is very limited
55
+ *
56
+ * @example KPI card with trend indicator
57
+ * ```tsx
58
+ * import { KPICard } from "@trackunit/react-components";
59
+ *
60
+ * const UtilizationCard = () => (
61
+ * <KPICard
62
+ * title="Utilization"
63
+ * value={87}
64
+ * unit="%"
65
+ * iconName="ChartBar"
66
+ * iconColor="success"
67
+ * trends={[
68
+ * { value: 5, direction: "up", label: "vs last week" },
69
+ * ]}
70
+ * onClick={() => console.log("Navigate to details")}
71
+ * />
72
+ * );
73
+ * ```
74
+ * @example KPI card with value bar and notice
75
+ * ```tsx
76
+ * import { KPICard } from "@trackunit/react-components";
77
+ *
78
+ * const StorageCard = () => (
79
+ * <KPICard
80
+ * title="Storage Used"
81
+ * value={75}
82
+ * unit="GB"
83
+ * valueBar={{ value: 75, max: 100 }}
84
+ * notice={{
85
+ * label: "25 GB remaining",
86
+ * iconName: "InformationCircle",
87
+ * iconColor: "info",
88
+ * }}
89
+ * />
90
+ * );
91
+ * ```
46
92
  * @param {KPICardProps} props - The props for the KPICard component
47
93
  * @returns {ReactElement} KPICard component
48
94
  */
@@ -28,8 +28,53 @@ export interface MenuListProps extends CommonProps {
28
28
  * **When to use**
29
29
  * - Use the MenuList if you have limited space and need to display overflow actions in a list.
30
30
  * - Use the MenuList for actions that are not essential to completing workflows.
31
- * - Dont use the MenuList to display single or multi-select items within form components. For dropdowns within select components, use SelectDropdown (component not available yet).
31
+ * - Don't use the MenuList to display single or multi-select items within form components. For dropdowns within select components, use SelectDropdown (component not available yet).
32
32
  *
33
+ * @example MenuList with action items
34
+ * ```tsx
35
+ * import { MenuList, MenuItem, MoreMenu, Icon } from "@trackunit/react-components";
36
+ *
37
+ * const ActionsMenu = () => (
38
+ * <MoreMenu>
39
+ * {(close) => (
40
+ * <MenuList onClick={close}>
41
+ * <MenuItem id="edit" prefix={<Icon name="PencilSquare" size="small" />}>
42
+ * Edit
43
+ * </MenuItem>
44
+ * <MenuItem id="duplicate" prefix={<Icon name="DocumentDuplicate" size="small" />}>
45
+ * Duplicate
46
+ * </MenuItem>
47
+ * <MenuItem id="delete" prefix={<Icon name="Trash" size="small" />} destructive>
48
+ * Delete
49
+ * </MenuItem>
50
+ * </MenuList>
51
+ * )}
52
+ * </MoreMenu>
53
+ * );
54
+ * ```
55
+ * @example Multi-select MenuList
56
+ * ```tsx
57
+ * import { MenuList, MenuItem, MoreMenu } from "@trackunit/react-components";
58
+ * import { useState } from "react";
59
+ *
60
+ * const FilterMenu = () => {
61
+ * const [selected, setSelected] = useState<string[]>(["active"]);
62
+ *
63
+ * return (
64
+ * <MoreMenu label="Filter by status">
65
+ * <MenuList
66
+ * isMulti
67
+ * selectedItems={selected}
68
+ * onSelectionChange={setSelected}
69
+ * >
70
+ * <MenuItem id="active">Active</MenuItem>
71
+ * <MenuItem id="idle">Idle</MenuItem>
72
+ * <MenuItem id="offline">Offline</MenuItem>
73
+ * </MenuList>
74
+ * </MoreMenu>
75
+ * );
76
+ * };
77
+ * ```
33
78
  * @param {MenuListProps} props - The props for the MenuList component
34
79
  * @returns {ReactElement} MenuList component
35
80
  */
@@ -7,6 +7,45 @@ import { PageHeaderProps } from "./types";
7
7
  * PageHeader can be used to highlight the page topic, display helpful information about the page, and carry the action items related to the current page.
8
8
  * Tabs can be added to the PageHeader to allow users to navigate between different sections of the page.
9
9
  *
10
+ * @example Page header with actions
11
+ * ```tsx
12
+ * import { PageHeader } from "@trackunit/react-components";
13
+ *
14
+ * const AssetPage = () => (
15
+ * <PageHeader
16
+ * title="Asset Management"
17
+ * description="Manage and monitor your fleet assets"
18
+ * accessoryType="actions"
19
+ * primaryAction={{
20
+ * actionText: "Add Asset",
21
+ * actionCallback: () => console.log("Add asset"),
22
+ * prefixIconName: "Plus",
23
+ * variant: "primary",
24
+ * }}
25
+ * secondaryActions={[
26
+ * { actionText: "Export", actionCallback: () => {}, variant: "secondary" },
27
+ * ]}
28
+ * />
29
+ * );
30
+ * ```
31
+ * @example Page header with KPI metrics
32
+ * ```tsx
33
+ * import { PageHeader } from "@trackunit/react-components";
34
+ *
35
+ * const DashboardHeader = () => (
36
+ * <PageHeader
37
+ * title="Fleet Overview"
38
+ * tagLabel="Live"
39
+ * tagColor="success"
40
+ * accessoryType="kpi-metrics"
41
+ * kpiMetrics={[
42
+ * { header: "Total Assets", value: 156, unit: "" },
43
+ * { header: "Active", value: 142, unit: "assets" },
44
+ * { header: "Utilization", value: 87, unit: "%" },
45
+ * ]}
46
+ * />
47
+ * );
48
+ * ```
10
49
  * @param {PageHeaderProps} props - The props for the PageHeader component
11
50
  * @returns {ReactElement} PageHeader component
12
51
  */
@@ -23,6 +23,45 @@ type ModalCallback = {
23
23
  *
24
24
  * To render the content of the popover, use the `<PopoverContent />` component.
25
25
  *
26
+ * @example Basic popover with trigger
27
+ * ```tsx
28
+ * import { Popover, PopoverTrigger, PopoverContent, Button, Text } from "@trackunit/react-components";
29
+ *
30
+ * const InfoPopover = () => (
31
+ * <Popover placement="bottom-start">
32
+ * <PopoverTrigger>
33
+ * <Button variant="secondary">Show Info</Button>
34
+ * </PopoverTrigger>
35
+ * <PopoverContent>
36
+ * <div className="p-4 max-w-xs">
37
+ * <Text weight="bold">Asset Information</Text>
38
+ * <Text size="small">Additional details about this asset appear here.</Text>
39
+ * </div>
40
+ * </PopoverContent>
41
+ * </Popover>
42
+ * );
43
+ * ```
44
+ * @example Controlled popover with render prop
45
+ * ```tsx
46
+ * import { Popover, PopoverTrigger, PopoverContent, Button } from "@trackunit/react-components";
47
+ *
48
+ * const ControlledPopover = () => (
49
+ * <Popover placement="right">
50
+ * {({ isOpen, setIsOpen }) => (
51
+ * <>
52
+ * <PopoverTrigger>
53
+ * <Button onClick={() => setIsOpen(!isOpen)}>
54
+ * {isOpen ? "Close" : "Open"} Menu
55
+ * </Button>
56
+ * </PopoverTrigger>
57
+ * <PopoverContent>
58
+ * <div className="p-4">Popover content</div>
59
+ * </PopoverContent>
60
+ * </>
61
+ * )}
62
+ * </Popover>
63
+ * );
64
+ * ```
26
65
  * @param {PopoverProps} props The props for the popover
27
66
  * @returns {ReactElement} A Popover Context Provider containing the children
28
67
  */
@@ -51,6 +51,27 @@ export interface SidebarProps extends CommonProps {
51
51
  *
52
52
  * When using this component make sure to add `setupIntersectionObserver();` to your jest.setup.ts file.
53
53
  *
54
+ * @example Responsive sidebar with navigation items
55
+ * ```tsx
56
+ * import { Sidebar, Button } from "@trackunit/react-components";
57
+ *
58
+ * const NavigationSidebar = () => (
59
+ * <Sidebar breakpoint="lg">
60
+ * <Button id="overview" variant="ghost-neutral" className="min-w-[100px]">
61
+ * Overview
62
+ * </Button>
63
+ * <Button id="assets" variant="ghost-neutral" className="min-w-[100px]">
64
+ * Assets
65
+ * </Button>
66
+ * <Button id="reports" variant="ghost-neutral" className="min-w-[100px]">
67
+ * Reports
68
+ * </Button>
69
+ * <Button id="settings" variant="ghost-neutral" className="min-w-[100px]">
70
+ * Settings
71
+ * </Button>
72
+ * </Sidebar>
73
+ * );
74
+ * ```
54
75
  * @param {SidebarProps} props - The props for the Sidebar component
55
76
  * @returns {ReactElement} Sidebar component
56
77
  */
@@ -24,5 +24,38 @@ export interface TabsProps extends TabsRootProps {
24
24
  }
25
25
  /**
26
26
  * Tabs are used to group different but related content, allowing users to navigate views without leaving the page. They always contain at least two items and one tab is active at a time. Tabs can be used on full page layouts or in components such as modals or tables.
27
+ *
28
+ * @example Basic tabs with content panels
29
+ * ```tsx
30
+ * import { Tabs, TabList, Tab, TabContent } from "@trackunit/react-components";
31
+ *
32
+ * const MyTabs = () => (
33
+ * <Tabs defaultValue="tab1">
34
+ * <TabList>
35
+ * <Tab value="tab1">Overview</Tab>
36
+ * <Tab value="tab2">Details</Tab>
37
+ * <Tab value="tab3">Settings</Tab>
38
+ * </TabList>
39
+ * <TabContent value="tab1">Overview content goes here</TabContent>
40
+ * <TabContent value="tab2">Details content goes here</TabContent>
41
+ * <TabContent value="tab3">Settings content goes here</TabContent>
42
+ * </Tabs>
43
+ * );
44
+ * ```
45
+ * @example Full width tabs with icons
46
+ * ```tsx
47
+ * import { Tabs, TabList, Tab, TabContent } from "@trackunit/react-components";
48
+ *
49
+ * const FullWidthTabs = () => (
50
+ * <Tabs defaultValue="assets" fullWidth>
51
+ * <TabList>
52
+ * <Tab value="assets" iconName="Truck" isFullWidth>Assets</Tab>
53
+ * <Tab value="sites" iconName="MapPin" isFullWidth>Sites</Tab>
54
+ * </TabList>
55
+ * <TabContent value="assets">Asset list</TabContent>
56
+ * <TabContent value="sites">Site list</TabContent>
57
+ * </Tabs>
58
+ * );
59
+ * ```
27
60
  */
28
61
  export declare const Tabs: ({ children, forceRender, className, "data-testid": dataTestId, fullWidth, ...rest }: TabsProps) => ReactElement;