@trackunit/react-components 1.17.22 → 1.17.23

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.
Files changed (56) hide show
  1. package/index.cjs.js +1309 -185
  2. package/index.esm.js +1309 -185
  3. package/package.json +1 -1
  4. package/src/components/Badge/Badge.d.ts +13 -6
  5. package/src/components/Card/CardBody.d.ts +38 -3
  6. package/src/components/Card/CardFooter.d.ts +44 -3
  7. package/src/components/Card/CardHeader.d.ts +43 -2
  8. package/src/components/CompletionStatusIndicator/CompletionStatusIndicator.d.ts +19 -10
  9. package/src/components/CopyableText/CopyableText.d.ts +28 -2
  10. package/src/components/DetailsList/DetailsList.d.ts +28 -7
  11. package/src/components/EmptyState/EmptyState.d.ts +24 -0
  12. package/src/components/EmptyValue/EmptyValue.d.ts +19 -1
  13. package/src/components/ExternalLink/ExternalLink.d.ts +35 -4
  14. package/src/components/Heading/Heading.d.ts +22 -1
  15. package/src/components/Highlight/Highlight.d.ts +32 -7
  16. package/src/components/HorizontalOverflowScroller/HorizontalOverflowScroller.d.ts +24 -9
  17. package/src/components/Icon/Icon.d.ts +19 -2
  18. package/src/components/KPI/KPISkeleton.d.ts +23 -2
  19. package/src/components/KPICard/KPICardSkeleton.d.ts +23 -2
  20. package/src/components/ListItem/ListItem.d.ts +25 -3
  21. package/src/components/ListItem/ListItemSkeleton.d.ts +24 -2
  22. package/src/components/Menu/MenuDivider/MenuDivider.d.ts +22 -1
  23. package/src/components/Menu/MenuItem/MenuItem.d.ts +30 -1
  24. package/src/components/Menu/MoreMenu/MoreMenu.d.ts +56 -2
  25. package/src/components/Notice/Notice.d.ts +33 -3
  26. package/src/components/Page/Page.d.ts +38 -2
  27. package/src/components/Page/PageContent.d.ts +34 -5
  28. package/src/components/PageHeader/PageHeader.d.ts +8 -4
  29. package/src/components/Pagination/Pagination.d.ts +31 -2
  30. package/src/components/Polygon/Polygon.d.ts +38 -3
  31. package/src/components/Popover/Popover.d.ts +8 -6
  32. package/src/components/Popover/PopoverContent.d.ts +29 -3
  33. package/src/components/Popover/PopoverTitle.d.ts +36 -2
  34. package/src/components/Popover/PopoverTrigger.d.ts +35 -4
  35. package/src/components/Portal/Portal.d.ts +35 -4
  36. package/src/components/PreferenceCard/PreferenceCard.d.ts +25 -3
  37. package/src/components/PreferenceCard/PreferenceCardSkeleton.d.ts +23 -2
  38. package/src/components/Prompt/Prompt.d.ts +42 -8
  39. package/src/components/SectionHeader/SectionHeader.d.ts +23 -3
  40. package/src/components/Sidebar/Sidebar.d.ts +12 -5
  41. package/src/components/Skeleton/SkeletonBlock/SkeletonBlock.d.ts +21 -5
  42. package/src/components/Skeleton/SkeletonLabel/SkeletonLabel.d.ts +21 -5
  43. package/src/components/SkeletonLines/SkeletonLines.d.ts +8 -6
  44. package/src/components/Spacer/Spacer.d.ts +17 -10
  45. package/src/components/Spinner/Spinner.d.ts +27 -6
  46. package/src/components/Tabs/Tab.d.ts +29 -2
  47. package/src/components/Tabs/TabContent.d.ts +46 -1
  48. package/src/components/Tabs/TabList.d.ts +29 -1
  49. package/src/components/Tabs/Tabs.d.ts +14 -1
  50. package/src/components/Tag/Tag.d.ts +13 -6
  51. package/src/components/Text/Text.d.ts +28 -3
  52. package/src/components/ToggleGroup/ToggleGroup.d.ts +30 -1
  53. package/src/components/ValueBar/ValueBar.d.ts +38 -2
  54. package/src/components/ZStack/ZStack.d.ts +23 -4
  55. package/src/components/buttons/Button/Button.d.ts +1 -1
  56. package/src/components/buttons/StarButton/StarButton.d.ts +24 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.17.22",
3
+ "version": "1.17.23",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -39,14 +39,21 @@ interface BaseBadgeProps extends CommonProps, Refable<HTMLSpanElement> {
39
39
  }
40
40
  export type BadgeProps = BaseBadgeProps;
41
41
  /**
42
- * The Badge component is used to indicate notifications or counts of applied elements.
43
- * It's typically used to display numbers on elements like filters, tabs, or buttons.
42
+ * Badge displays a numeric count or a small colored dot to indicate notifications or applied elements.
43
+ * It is typically placed on buttons, tabs, or filters to draw attention to new or pending items.
44
44
  *
45
- * How to choose between Badge and Tag?
45
+ * ### When to use
46
+ * Use Badge to indicate a count (e.g., unread notifications, active filters) or as a compact status dot.
47
+ *
48
+ * ### When not to use
49
+ * Do not use Badge for labeling statuses or categories — use `Tag` instead.
50
+ * Do not use Badge for highlighting data values — use `Highlight`.
51
+ *
52
+ * How to choose between Badge and `Tag`?
46
53
  * - Use a Badge to indicate notifications or counts of applied elements.
47
- * - Use a [Tag](https://design.iris.trackunit.com/?path=/docs/react-components-tag--docs) for labeling statuses, categories, or selections.
54
+ * - Use a `Tag` for labeling statuses, categories, or selections.
48
55
  *
49
- * @example Badge with count and max value
56
+ * @example Badge with count and max — Use `count` and `max` to show a capped notification count. Values above `max` display as "9+".
50
57
  * ```tsx
51
58
  * import { Badge, Button } from "@trackunit/react-components";
52
59
  *
@@ -56,7 +63,7 @@ export type BadgeProps = BaseBadgeProps;
56
63
  * </Button>
57
64
  * );
58
65
  * ```
59
- * @example Compact badge as status dot
66
+ * @example Compact status dot Set `compact` to render a small colored dot without any count, useful for online/offline indicators.
60
67
  * ```tsx
61
68
  * import { Badge } from "@trackunit/react-components";
62
69
  *
@@ -24,10 +24,45 @@ export interface CardBodyProps extends CommonProps, Refable<HTMLDivElement> {
24
24
  id?: string;
25
25
  }
26
26
  /**
27
- * The CardBody component should be used to inform the user of important information.
27
+ * CardBody is the main content area of a Card. It provides consistent padding and gap between child elements.
28
+ * Padding is applied here rather than on the Card itself to avoid insetting the scrollbar when content overflows.
28
29
  *
29
- * @summary For applying padding and gap to a Card.
30
- * @description The padding must live here, and not on the Card itself, as to not inset the scrollbar in case of overflow
30
+ * Use CardBody inside a Card to wrap the primary content.
31
+ * It works alongside CardHeader and CardFooter.
32
+ *
33
+ * ### When to use
34
+ * Use CardBody to wrap the main content area of a `Card`. It handles padding, gap, and flex direction so content is laid out consistently.
35
+ *
36
+ * ### When not to use
37
+ * Do not use CardBody outside of a `Card`. For standalone content layout, use standard flex or grid containers.
38
+ *
39
+ * @example Basic card body inside a card
40
+ * ```tsx
41
+ * import { Card, CardHeader, CardBody, Text } from "@trackunit/react-components";
42
+ *
43
+ * const AssetInfo = () => (
44
+ * <Card>
45
+ * <CardHeader heading="Asset Details" />
46
+ * <CardBody>
47
+ * <Text>Operating hours: 1,234</Text>
48
+ * <Text>Status: Active</Text>
49
+ * </CardBody>
50
+ * </Card>
51
+ * );
52
+ * ```
53
+ * @example Card body with custom direction and no gap
54
+ * ```tsx
55
+ * import { Card, CardBody } from "@trackunit/react-components";
56
+ *
57
+ * const HorizontalLayout = () => (
58
+ * <Card>
59
+ * <CardBody direction="row" gap="none" padding="none">
60
+ * <div>Left section</div>
61
+ * <div>Right section</div>
62
+ * </CardBody>
63
+ * </Card>
64
+ * );
65
+ * ```
31
66
  * @param {CardBodyProps} props - The props for the CardBody component
32
67
  * @returns {ReactElement} CardBody component
33
68
  */
@@ -16,10 +16,51 @@ export interface CardFooterProps extends CommonProps, Refable<HTMLDivElement> {
16
16
  padding?: "none" | "default";
17
17
  }
18
18
  /**
19
- * A simple footer intended to use with Cards and Modals.
20
- * Currently only intended to contain Buttons.
21
- * The buttons justifies to the right, but if you style a button with "margin-right: auto" it will move to the left
19
+ * CardFooter provides a consistent footer section for a Card, typically containing action buttons.
20
+ * Buttons are right-justified by default. To push a button to the left, apply `margin-right: auto` to it.
22
21
  *
22
+ * Use CardFooter as the last child inside a Card, below CardBody.
23
+ *
24
+ * ### When to use
25
+ * Use CardFooter to add action buttons (e.g., Save, Cancel, View Details) at the bottom of a `Card` or Modal.
26
+ *
27
+ * ### When not to use
28
+ * Do not use CardFooter for content display. It is designed specifically for action buttons and controls.
29
+ *
30
+ * @example Card with footer actions
31
+ * ```tsx
32
+ * import { Card, CardHeader, CardBody, CardFooter, Button, Text } from "@trackunit/react-components";
33
+ *
34
+ * const ConfirmationCard = () => (
35
+ * <Card>
36
+ * <CardHeader heading="Confirm Action" />
37
+ * <CardBody>
38
+ * <Text>Are you sure you want to proceed?</Text>
39
+ * </CardBody>
40
+ * <CardFooter>
41
+ * <Button variant="secondary">Cancel</Button>
42
+ * <Button variant="primary">Confirm</Button>
43
+ * </CardFooter>
44
+ * </Card>
45
+ * );
46
+ * ```
47
+ * @example Footer with left-aligned and right-aligned buttons
48
+ * ```tsx
49
+ * import { Card, CardBody, CardFooter, Button, Text } from "@trackunit/react-components";
50
+ *
51
+ * const FormCard = () => (
52
+ * <Card>
53
+ * <CardBody>
54
+ * <Text>Form content here</Text>
55
+ * </CardBody>
56
+ * <CardFooter>
57
+ * <Button variant="secondary-danger" className="mr-auto">Delete</Button>
58
+ * <Button variant="secondary">Cancel</Button>
59
+ * <Button variant="primary">Save</Button>
60
+ * </CardFooter>
61
+ * </Card>
62
+ * );
63
+ * ```
23
64
  * @param {CardFooterProps} props - The props for the CardFooter component
24
65
  * @returns {ReactElement} CardFooter component
25
66
  */
@@ -9,7 +9,7 @@ export interface CardHeaderProps extends CommonProps, Refable<HTMLDivElement> {
9
9
  heading?: string;
10
10
  /**
11
11
  * The variant/size of the heading.
12
- * Same as the `Heading` component.
12
+ * Same as the Heading component.
13
13
  *
14
14
  * @default "secondary"
15
15
  */
@@ -43,8 +43,49 @@ export interface CardHeaderProps extends CommonProps, Refable<HTMLDivElement> {
43
43
  padding?: "none" | "default";
44
44
  }
45
45
  /**
46
- * Header for Cards.
46
+ * CardHeader provides a consistent header section for a Card, including a heading, optional subheading, accessories, and action buttons.
47
+ * It is designed to be used as the first child inside a Card, above CardBody.
47
48
  *
49
+ * ### When to use
50
+ * Use CardHeader when a `Card` needs a title and optional actions (e.g., close button, edit button). It handles heading layout, separator lines, and action placement.
51
+ *
52
+ * ### When not to use
53
+ * Do not use CardHeader outside of a `Card`. For standalone section titles, use `SectionHeader` or `Heading` instead.
54
+ *
55
+ * @example Card header with heading and actions
56
+ * ```tsx
57
+ * import { Card, CardHeader, CardBody, Button, Text } from "@trackunit/react-components";
58
+ *
59
+ * const AssetCard = () => (
60
+ * <Card>
61
+ * <CardHeader
62
+ * heading="Excavator #1234"
63
+ * subHeading="Last updated: 2 hours ago"
64
+ * actions={<Button variant="ghost" size="small">Edit</Button>}
65
+ * />
66
+ * <CardBody>
67
+ * <Text>Operating hours: 1,234</Text>
68
+ * </CardBody>
69
+ * </Card>
70
+ * );
71
+ * ```
72
+ * @example Card header with accessories and no separator
73
+ * ```tsx
74
+ * import { Card, CardHeader, CardBody, Badge, Text } from "@trackunit/react-components";
75
+ *
76
+ * const NotificationsCard = () => (
77
+ * <Card>
78
+ * <CardHeader
79
+ * heading="Notifications"
80
+ * accessories={<Badge count={5} color="primary" />}
81
+ * hideSeparator
82
+ * />
83
+ * <CardBody>
84
+ * <Text>Notification list here</Text>
85
+ * </CardBody>
86
+ * </Card>
87
+ * );
88
+ * ```
48
89
  * @param {CardHeaderProps} props - The props for the CardHeader component
49
90
  * @returns {ReactElement} CardHeader component
50
91
  */
@@ -6,16 +6,25 @@ export interface CompletionStatusIndicatorProps extends CommonProps {
6
6
  error: boolean;
7
7
  }
8
8
  /**
9
- * A component that displays a visual indicator based on the completion status.
9
+ * CompletionStatusIndicator displays a visual icon or spinner based on a process completion status:
10
+ * loading (spinner), success (green check circle), or error (red X circle). Returns null if no status flag is set.
10
11
  *
11
- * @example
12
- * <CompletionStatusIndicator loading={true} />
13
- * <CompletionStatusIndicator error={true} />
14
- * <CompletionStatusIndicator success={true} />
15
- * @param {CompletionStatusIndicatorProps} props - The properties for the indicator.
16
- * @param {boolean} props.loading - Indicates if the process is in a loading state.
17
- * @param {boolean} props.error - Indicates if an error has occurred.
18
- * @param {boolean} props.warning - Indicates if the process has a warning.
19
- * @param {boolean} props.success - Indicates if the process was successful.
12
+ * ### When to use
13
+ * Use CompletionStatusIndicator to show inline feedback for async operations (e.g., form submissions, save actions, data syncs).
14
+ *
15
+ * ### When not to use
16
+ * Do not use for page-level loading use `Spinner`.
17
+ * Do not use for persistent status labels use `Tag` or `Notice`.
18
+ *
19
+ * @example Completion status for a save action
20
+ * ```tsx
21
+ * import { CompletionStatusIndicator } from "@trackunit/react-components";
22
+ *
23
+ * const SaveStatus = ({ saving, saved, failed }: { saving: boolean; saved: boolean; failed: boolean }) => (
24
+ * <CompletionStatusIndicator loading={saving} success={saved} error={failed} />
25
+ * );
26
+ * ```
27
+ * @param {CompletionStatusIndicatorProps} props - The props for the CompletionStatusIndicator component
28
+ * @returns {ReactElement | null} CompletionStatusIndicator component, or null when no status flag is set
20
29
  */
21
30
  export declare const CompletionStatusIndicator: ({ loading, error, success, ...rest }: CompletionStatusIndicatorProps) => ReactElement | null;
@@ -14,8 +14,34 @@ export interface CopyableTextProps extends CommonProps, Refable<HTMLSpanElement>
14
14
  alternativeText?: string;
15
15
  }
16
16
  /**
17
- * The CopyableText component is used where the user should have easy access to copy information.
18
-
17
+ * CopyableText displays a text value that the user can click to copy to the clipboard.
18
+ * It shows a brief animation on copy to provide visual feedback. The copied value can differ from the displayed text via `alternativeText`.
19
+ *
20
+ * ### When to use
21
+ * Use CopyableText for identifiers, serial numbers, URLs, or any value the user may want to copy (e.g., asset IDs, error codes).
22
+ *
23
+ * ### When not to use
24
+ * Do not use CopyableText for long paragraphs or content that doesn't need to be copied.
25
+ *
26
+ * @example Copyable serial number
27
+ * ```tsx
28
+ * import { CopyableText } from "@trackunit/react-components";
29
+ *
30
+ * const AssetSerial = () => (
31
+ * <CopyableText text="SN-2024-00142" data-testid="serial-number" />
32
+ * );
33
+ * ```
34
+ * @example Copyable text with alternative clipboard value
35
+ * ```tsx
36
+ * import { CopyableText } from "@trackunit/react-components";
37
+ *
38
+ * const AssetLink = () => (
39
+ * <CopyableText
40
+ * text="Excavator #1234"
41
+ * alternativeText="https://app.trackunit.com/assets/1234"
42
+ * />
43
+ * );
44
+ * ```
19
45
  * @param {CopyableTextProps} props - The props for the CopyableText component
20
46
  * @returns {ReactElement} CopyableText component
21
47
  */
@@ -6,14 +6,35 @@ interface DetailsListProps extends Refable<HTMLDivElement> {
6
6
  hasLink?: boolean;
7
7
  }
8
8
  /**
9
- * Renders a one-line list of details separated by a Slash icon.
9
+ * DetailsList renders a one-line list of text values separated by slash icons.
10
+ * It is used to display compact metadata such as model, serial number, or location in a single row.
10
11
  *
11
- * @param {object} props - Component props.
12
- * @param {string[]} props.details - Values to render.
13
- * @param {string} [props.className] - Optional CSS class for customization.
14
- * @param {boolean} [props.hasLink=false] - Whether the parent component contains a link.
15
- * @param [props.ref] - Ref forwarded to the root element.
16
- * @returns {ReactElement} The details list element.
12
+ * ### When to use
13
+ * Use DetailsList to display a compact, horizontal list of metadata values (e.g., in a card subtitle or list item description).
14
+ *
15
+ * ### When not to use
16
+ * Do not use DetailsList for key-value pairs use a standard layout with labels. Do not use for long text — values should be short strings.
17
+ *
18
+ * @example Displaying asset metadata
19
+ * ```tsx
20
+ * import { DetailsList } from "@trackunit/react-components";
21
+ *
22
+ * const AssetMeta = () => (
23
+ * <DetailsList details={["Excavator", "CAT 320", "SN-00142"]} />
24
+ * );
25
+ * ```
26
+ * @example DetailsList inside a linked context
27
+ * ```tsx
28
+ * import { DetailsList } from "@trackunit/react-components";
29
+ *
30
+ * const LinkedAssetMeta = () => (
31
+ * <a href="/assets/123">
32
+ * <DetailsList details={["Site: Oslo", "Group: Heavy"]} hasLink />
33
+ * </a>
34
+ * );
35
+ * ```
36
+ * @param {DetailsListProps} props - The props for the DetailsList component
37
+ * @returns {ReactElement} DetailsList component
17
38
  */
18
39
  export declare const DetailsList: ({ details, className, hasLink, ref }: DetailsListProps) => ReactElement;
19
40
  export {};
@@ -13,13 +13,37 @@ type EmptyStateButtonAction = {
13
13
  };
14
14
  };
15
15
  export interface EmptyStateProps extends CommonProps, Refable<HTMLDivElement> {
16
+ /**
17
+ * Description text to display below the image. Explains the empty state and guides the user.
18
+ */
16
19
  description?: string;
20
+ /**
21
+ * Alt text for the custom image source. Used for accessibility when `customImageSrc` is a URL string.
22
+ */
17
23
  altText?: string;
24
+ /**
25
+ * Predefined illustration to display. Options: "WORKER_WITH_SIGN", "ROAD_BLOCK", "BUILDING_ERROR", "WALL_CONSTRUCTION", "PHONE_LOCK_SECURITY", "SEARCH_DOCUMENT".
26
+ */
18
27
  image?: EmptyStateImage;
28
+ /**
29
+ * A custom image URL string or ReactNode to replace the predefined illustration.
30
+ */
19
31
  customImageSrc?: string | ReactNode;
32
+ /**
33
+ * Primary action button configuration. Recommend the best next step for users to proceed.
34
+ */
20
35
  primaryAction?: EmptyStateButtonAction;
36
+ /**
37
+ * Secondary action button configuration. Suggest an alternative action users could consider.
38
+ */
21
39
  secondaryAction?: EmptyStateButtonAction;
40
+ /**
41
+ * Additional help action (e.g., a link to external documentation or support).
42
+ */
22
43
  additionalHelpAction?: EmptyStateButtonAction;
44
+ /**
45
+ * Whether the component is in a loading state. Shows a spinner and skeleton text instead of the illustration.
46
+ */
23
47
  loading?: boolean;
24
48
  }
25
49
  /**
@@ -3,8 +3,26 @@ import { CommonProps } from "../../common/CommonProps";
3
3
  import { Refable } from "../../common/Refable";
4
4
  export type EmptyValueProps = CommonProps & Refable<HTMLDivElement>;
5
5
  /**
6
- * The EmptyValue component renders a consistent "–" symbol to represent empty, null, undefined, or not applicable values in tables.
6
+ * EmptyValue renders a consistent dash symbol ("–") to represent missing, null, undefined, or not applicable values.
7
+ * It is primarily used in tables and detail lists to maintain visual consistency when data is absent.
7
8
  *
9
+ * ### When to use
10
+ * Use EmptyValue as a placeholder in table cells, detail lists, or any data display where values may be missing.
11
+ *
12
+ * ### When not to use
13
+ * Do not use EmptyValue for empty pages or sections — use `EmptyState` instead.
14
+ *
15
+ * @example Empty value in a details row
16
+ * ```tsx
17
+ * import { EmptyValue, Text } from "@trackunit/react-components";
18
+ *
19
+ * const AssetDetail = ({ value }: { value?: string }) => (
20
+ * <div className="flex justify-between">
21
+ * <Text weight="bold">Serial Number</Text>
22
+ * {value ? <Text>{value}</Text> : <EmptyValue />}
23
+ * </div>
24
+ * );
25
+ * ```
8
26
  * @param {EmptyValueProps} props - The props for the EmptyValue component
9
27
  * @returns {ReactElement} EmptyValue component
10
28
  */
@@ -29,9 +29,40 @@ export interface ExternalLinkProps extends CommonProps, Refable<HTMLAnchorElemen
29
29
  onClick?: MouseEventHandler<HTMLAnchorElement>;
30
30
  }
31
31
  /**
32
- * Link is an interactive element that allows users to navigate between different parts of an application or to external resources. Links are used to indicate clickable text.
33
-
34
- * @param {ExternalLinkProps} props - The props for the external link component
35
- * @returns {ReactElement} External Link component
32
+ * ExternalLink renders an anchor element for navigating to external URLs. It opens in a new tab by default with `rel="noreferrer"` for security.
33
+ * If no children are provided, the href URL is displayed as the link text.
34
+ *
35
+ * ### When to use
36
+ * Use ExternalLink for any links that navigate to external resources outside the application (e.g., documentation, support pages, vendor sites).
37
+ *
38
+ * ### When not to use
39
+ * Do not use ExternalLink for in-app navigation. Use `Link` from `@tanstack/react-router` for internal routes.
40
+ *
41
+ * @example Basic external link
42
+ * ```tsx
43
+ * import { ExternalLink } from "@trackunit/react-components";
44
+ *
45
+ * const SupportLink = () => (
46
+ * <ExternalLink href="https://support.trackunit.com">
47
+ * Visit Support Center
48
+ * </ExternalLink>
49
+ * );
50
+ * ```
51
+ * @example Neutral colored link opening in same window
52
+ * ```tsx
53
+ * import { ExternalLink } from "@trackunit/react-components";
54
+ *
55
+ * const DocumentLink = () => (
56
+ * <ExternalLink
57
+ * href="https://docs.trackunit.com/api"
58
+ * color="neutral"
59
+ * target="_self"
60
+ * >
61
+ * API Documentation
62
+ * </ExternalLink>
63
+ * );
64
+ * ```
65
+ * @param {ExternalLinkProps} props - The props for the ExternalLink component
66
+ * @returns {ReactElement} ExternalLink component
36
67
  */
37
68
  export declare const ExternalLink: ({ rel, target, href, className, children, title, "data-testid": dataTestId, onClick, color, ref, }: ExternalLinkProps) => ReactElement;
@@ -21,8 +21,29 @@ export interface HeadingProps extends CommonProps, Refable<HTMLHeadingElement> {
21
21
  subtle?: boolean;
22
22
  }
23
23
  /**
24
- * The Heading is used for a heading of a section (h1,h2,h3,h4).
24
+ * Heading renders semantic heading elements (h1, h2, h3, h4) with Trackunit typography styles.
25
+ * The `variant` prop maps to the semantic heading level: "primary" = h1, "secondary" = h2, "tertiary" = h3, "subtitle" = h4.
25
26
  *
27
+ * ### When to use
28
+ * Use Heading for page titles, section titles, and any hierarchical heading. Choose the variant based on the semantic level of the heading.
29
+ *
30
+ * ### When not to use
31
+ * Do not use Heading for body text — use `Text` instead.
32
+ * Do not use Heading for page-level headers with actions — use `PageHeader` or `SectionHeader`.
33
+ *
34
+ * @example Heading variants
35
+ * ```tsx
36
+ * import { Heading } from "@trackunit/react-components";
37
+ *
38
+ * const HeadingExamples = () => (
39
+ * <div>
40
+ * <Heading variant="primary">Page Title (h1)</Heading>
41
+ * <Heading variant="secondary">Section Title (h2)</Heading>
42
+ * <Heading variant="tertiary">Subsection (h3)</Heading>
43
+ * <Heading variant="subtitle" subtle>Subtitle (h4)</Heading>
44
+ * </div>
45
+ * );
46
+ * ```
26
47
  * @param {HeadingProps} props - The props for the Heading component
27
48
  * @returns {ReactElement} Heading component
28
49
  */
@@ -21,15 +21,40 @@ export interface HighlightProps extends CommonProps {
21
21
  ref?: Ref<HTMLDivElement>;
22
22
  }
23
23
  /**
24
- * The Highlight component is used to draw attention to data values that may require user action, monitoring, or investigation.
25
- * It visually emphasizes out-of-range or critical values using color cues (e.g. danger or warning) to support quick scanning and awareness.
24
+ * Highlight draws visual attention to data values that may require user action, monitoring, or investigation.
25
+ * It uses color cues (e.g., danger, warning, success) to emphasize out-of-range or critical values for quick scanning.
26
26
  *
27
- * How to choose between Highlight and Tag?
28
- * - Use Highlight to draw attention to values in plain text that require special attention or have crossed a threshold.
29
- * - Use a [Tag](https://design.iris.trackunit.com/?path=/docs/react-components-tag--docs) for labeling statuses, categories, or selections.
27
+ * ### When to use
28
+ * Use Highlight to emphasize numeric or text values inline that have crossed a threshold or need attention (e.g., temperature warnings, low battery).
30
29
  *
31
- * @param {HighlightProps} props - The props for the highlight component
32
- * @returns {ReactElement} highlight component
30
+ * ### When not to use
31
+ * Do not use Highlight for labeling statuses or categories — use `Tag`.
32
+ * Do not use Highlight for notification counts — use `Badge`.
33
+ *
34
+ * @example Highlighting a warning value
35
+ * ```tsx
36
+ * import { Highlight, Text } from "@trackunit/react-components";
37
+ *
38
+ * const TemperatureDisplay = () => (
39
+ * <Text>
40
+ * Engine temperature: <Highlight color="warning">92°C</Highlight>
41
+ * </Text>
42
+ * );
43
+ * ```
44
+ * @example Different highlight colors for thresholds
45
+ * ```tsx
46
+ * import { Highlight } from "@trackunit/react-components";
47
+ *
48
+ * const BatteryStatus = () => (
49
+ * <div className="flex gap-2">
50
+ * <Highlight color="success">85%</Highlight>
51
+ * <Highlight color="warning">32%</Highlight>
52
+ * <Highlight color="danger">8%</Highlight>
53
+ * </div>
54
+ * );
55
+ * ```
56
+ * @param {HighlightProps} props - The props for the Highlight component
57
+ * @returns {ReactElement} Highlight component
33
58
  */
34
59
  export declare const Highlight: {
35
60
  ({ className, "data-testid": dataTestId, children, size, color, ref, }: HighlightProps): ReactElement;
@@ -14,15 +14,30 @@ export interface HorizontalOverflowScrollerProps extends CommonProps, Styleable,
14
14
  }) => void;
15
15
  }
16
16
  /**
17
- * Container for displaying components in a horizontal layout with overflow detection.
18
- * Provides visual indicators when content overflows and can be scrolled.
17
+ * HorizontalOverflowScroller displays child elements in a horizontal row with automatic overflow detection.
18
+ * When content overflows, it shows left/right scroll indicators with click-to-scroll functionality.
19
19
  *
20
- * @param props - Component properties
21
- * @param props.children - The content to display in the horizontal scroller
22
- * @param props.className - Optional CSS class name for styling
23
- * @param props."data-testid" - Optional test ID for testing purposes
24
- * @param props.onScrollStateChange - Optional callback fired when scroll state changes
25
- * @param [props.ref] - Ref forwarded to the root element
26
- * @returns {ReactElement} A horizontal overflow scroller component with visual indicators
20
+ * ### When to use
21
+ * Use HorizontalOverflowScroller to display a row of items (cards, tags, buttons) that may overflow on smaller screens, with visual cues that more content is available.
22
+ *
23
+ * ### When not to use
24
+ * Do not use HorizontalOverflowScroller for tab navigation — use `TabList` which has its own scroll handling.
25
+ *
26
+ * @example Horizontal scroller for KPI cards
27
+ * ```tsx
28
+ * import { HorizontalOverflowScroller, Tag } from "@trackunit/react-components";
29
+ *
30
+ * const TagRow = () => (
31
+ * <HorizontalOverflowScroller>
32
+ * <Tag color="success">Active</Tag>
33
+ * <Tag color="warning">Idle</Tag>
34
+ * <Tag color="danger">Offline</Tag>
35
+ * <Tag color="info">Maintenance</Tag>
36
+ * <Tag color="neutral">Archived</Tag>
37
+ * </HorizontalOverflowScroller>
38
+ * );
39
+ * ```
40
+ * @param {HorizontalOverflowScrollerProps} props - The props for the HorizontalOverflowScroller component
41
+ * @returns {ReactElement} HorizontalOverflowScroller component
27
42
  */
28
43
  export declare const HorizontalOverflowScroller: ({ className, "data-testid": dataTestId, children, onScrollStateChange, ref, }: HorizontalOverflowScrollerProps) => ReactElement;
@@ -294,10 +294,27 @@ export type IconProps = DiscriminatedIconProps & CommonProps & AriaProps & Refab
294
294
  fontSize?: boolean;
295
295
  };
296
296
  /**
297
- * Icons help in making the interface more intuitive by providing visual cues for various actions or elements. They're used to enhance usability, and depending on the context, they can be used alone or paired with text to increase comprehension.
297
+ * Icon renders SVG icons from the icon sprite sheets. All [HeroIcons](https://heroicons.com/) as well as custom Trackunit icons are available.
298
+ * Icons support three sizes (small=16px, medium=20px, large=24px) and theme-based colors.
298
299
  *
299
- * All the [HeroIcons](https://heroicons.com/) as well as custom Trackunit icons are available.
300
+ * ### When to use
301
+ * Use Icon to provide visual cues for actions, statuses, or navigation. Icons can be used standalone or paired with text (e.g., inside Buttons, MenuItems, Tags).
300
302
  *
303
+ * ### When not to use
304
+ * Do not use Icon alone for critical actions without an accessible label. Always provide `ariaLabel` or pair with visible text.
305
+ *
306
+ * @example Icons at different sizes
307
+ * ```tsx
308
+ * import { Icon } from "@trackunit/react-components";
309
+ *
310
+ * const IconExamples = () => (
311
+ * <div className="flex items-center gap-4">
312
+ * <Icon name="MapPin" size="small" color="danger" />
313
+ * <Icon name="Truck" size="medium" color="primary" />
314
+ * <Icon name="Cog6Tooth" size="large" type="outline" />
315
+ * </div>
316
+ * );
317
+ * ```
301
318
  * @param {IconProps} props - The props for the Icon component
302
319
  * @returns {ReactElement} Icon component
303
320
  */
@@ -9,7 +9,28 @@ export interface KPISkeletonProps extends CommonProps, Styleable, Refable<HTMLDi
9
9
  variant?: "small" | "default" | "condensed";
10
10
  }
11
11
  /**
12
- * Skeleton loading indicator that mimics the KPI component structure.
13
- * Uses the same layout, spacing, and visual hierarchy as KPI.
12
+ * KPISkeleton is a loading placeholder that mimics the layout of a KPI component.
13
+ * It renders skeleton lines for the title and value with randomized widths for a natural appearance.
14
+ *
15
+ * ### When to use
16
+ * Use KPISkeleton while `KPI` data is loading to maintain layout stability and reduce perceived load time.
17
+ *
18
+ * ### When not to use
19
+ * Do not use KPISkeleton for generic text loading — use `SkeletonLabel`.
20
+ *
21
+ * @example KPI skeleton in a dashboard
22
+ * ```tsx
23
+ * import { KPISkeleton } from "@trackunit/react-components";
24
+ *
25
+ * const LoadingDashboard = () => (
26
+ * <div className="flex gap-4">
27
+ * <KPISkeleton variant="default" />
28
+ * <KPISkeleton variant="default" />
29
+ * <KPISkeleton variant="small" />
30
+ * </div>
31
+ * );
32
+ * ```
33
+ * @param {KPISkeletonProps} props - The props for the KPISkeleton component
34
+ * @returns {ReactElement} KPISkeleton component
14
35
  */
15
36
  export declare const KPISkeleton: ({ variant, className, "data-testid": dataTestId, style, ref, ...rest }: KPISkeletonProps) => ReactElement;