@trackunit/react-components 1.14.18 → 1.14.20

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.
@@ -55,6 +55,33 @@ export interface TagProps extends CommonProps {
55
55
  * - Use a [Badge](https://design.iris.trackunit.com/?path=/docs/react-components-badge--docs) to indicate notifications or counts of applied elements, such as filters.
56
56
  * - Use a [Highlight](https://design.iris.trackunit.com/?path=/docs/react-components-highlight--docs) to draw attention to values in plain text that require special attention or have crossed a threshold.
57
57
  *
58
+ * @example Status tags with different colors
59
+ * ```tsx
60
+ * import { Tag } from "@trackunit/react-components";
61
+ *
62
+ * const AssetStatus = () => (
63
+ * <div className="flex gap-2">
64
+ * <Tag color="success">Active</Tag>
65
+ * <Tag color="warning">Idle</Tag>
66
+ * <Tag color="danger">Offline</Tag>
67
+ * <Tag color="info">Beta</Tag>
68
+ * </div>
69
+ * );
70
+ * ```
71
+ * @example Dismissible tag for selections
72
+ * ```tsx
73
+ * import { Tag, Icon } from "@trackunit/react-components";
74
+ *
75
+ * const SelectedFilter = ({ label, onRemove }: { label: string; onRemove: () => void }) => (
76
+ * <Tag
77
+ * color="primary"
78
+ * icon={<Icon name="Funnel" size="small" />}
79
+ * onClose={onRemove}
80
+ * >
81
+ * {label}
82
+ * </Tag>
83
+ * );
84
+ * ```
58
85
  * @param {TagProps} props - The props for the Tag component.
59
86
  * @returns {ReactElement} The rendered Tag component.
60
87
  */
@@ -43,6 +43,35 @@ export interface TooltipProps extends CommonProps, Styleable {
43
43
  *
44
44
  * **Do not use** tooltips to include information that is necessary for the user to complete their task. Use helper text that is always visible and accessible for vital information.
45
45
  *
46
+ * @example Tooltip on an icon button
47
+ * ```tsx
48
+ * import { Tooltip, IconButton, Icon } from "@trackunit/react-components";
49
+ *
50
+ * const SettingsButton = () => (
51
+ * <Tooltip label="Open settings" placement="bottom">
52
+ * <IconButton
53
+ * icon={<Icon name="Cog6Tooth" size="small" />}
54
+ * variant="ghost-neutral"
55
+ * onClick={() => console.log("Settings clicked")}
56
+ * />
57
+ * </Tooltip>
58
+ * );
59
+ * ```
60
+ * @example Standalone tooltip icon for explanations
61
+ * ```tsx
62
+ * import { Tooltip } from "@trackunit/react-components";
63
+ *
64
+ * const FieldWithHelp = () => (
65
+ * <div className="flex items-center gap-2">
66
+ * <span>Utilization Rate</span>
67
+ * <Tooltip
68
+ * label="The percentage of time the asset was actively in use during the selected period"
69
+ * placement="right"
70
+ * mode="light"
71
+ * />
72
+ * </div>
73
+ * );
74
+ * ```
46
75
  * @param {TooltipProps} props - The props for the Tooltip component
47
76
  * @returns {ReactElement} Tooltip component
48
77
  */
@@ -50,8 +50,39 @@ export interface ButtonProps extends Omit<ButtonCommonProps, "size"> {
50
50
  * Use buttons to communicate actions users can take and to allow users to interact with the page. Each page should have one primary button, and any remaining calls to action should be represented as lower emphasis buttons.
51
51
  *
52
52
  * ### When not to use
53
- * Do not use buttons as navigational elements. Instead, use [Links](https://www.notion.so/Links-49638788b6c042698b40b94a318361f1?pvs=21) when the desired action is to take the user to a new page.
53
+ * Do not use buttons as navigational elements. Instead, use [Links](?path=/docs/components-link--docs) when the desired action is to take the user to a new page.
54
54
  *
55
+ * @example Basic button with click handler
56
+ * ```tsx
57
+ * import { Button } from "@trackunit/react-components";
58
+ *
59
+ * const MyComponent = () => {
60
+ * return (
61
+ * <Button onClick={() => console.log('clicked')}>
62
+ * Click me
63
+ * </Button>
64
+ * );
65
+ * };
66
+ * ```
67
+ * @example Button variants and sizes
68
+ * ```tsx
69
+ * import { Button, Icon } from "@trackunit/react-components";
70
+ *
71
+ * const ButtonExamples = () => {
72
+ * return (
73
+ * <div className="flex gap-2">
74
+ * <Button variant="primary">Primary</Button>
75
+ * <Button variant="secondary">Secondary</Button>
76
+ * <Button variant="ghost">Ghost</Button>
77
+ * <Button variant="primary-danger">Danger</Button>
78
+ * <Button size="small">Small</Button>
79
+ * <Button prefix={<Icon name="Plus" size="small" />}>With Icon</Button>
80
+ * <Button loading>Loading</Button>
81
+ * <Button disabled>Disabled</Button>
82
+ * </div>
83
+ * );
84
+ * };
85
+ * ```
55
86
  * @param {ButtonProps} props - The props for the Button component
56
87
  * @returns {ReactElement} Button component
57
88
  */
@@ -24,6 +24,45 @@ export interface IconButtonProps extends MappedOmit<ButtonCommonProps, "size"> {
24
24
  }
25
25
  /**
26
26
  * Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. The Icon Button is a version of the standard Button component without the text label.
27
+ *
28
+ * ### When to use
29
+ * Use icon buttons for actions that are well-understood through the icon alone, such as close, delete, or settings buttons. Always provide a `title` prop for accessibility.
30
+ *
31
+ * ### When not to use
32
+ * Do not use icon buttons when the action is not immediately clear from the icon. Use a regular Button with text instead.
33
+ *
34
+ * @example Basic icon button
35
+ * ```tsx
36
+ * import { IconButton, Icon } from "@trackunit/react-components";
37
+ *
38
+ * const MyComponent = () => {
39
+ * return (
40
+ * <IconButton
41
+ * icon={<Icon name="Trash" />}
42
+ * onClick={() => console.log('delete')}
43
+ * title="Delete item"
44
+ * />
45
+ * );
46
+ * };
47
+ * ```
48
+ * @example Icon button variants
49
+ * ```tsx
50
+ * import { IconButton, Icon } from "@trackunit/react-components";
51
+ *
52
+ * const IconButtonExamples = () => {
53
+ * return (
54
+ * <div className="flex gap-2">
55
+ * <IconButton icon={<Icon name="Plus" />} variant="primary" title="Add" />
56
+ * <IconButton icon={<Icon name="Cog" />} variant="secondary" title="Settings" />
57
+ * <IconButton icon={<Icon name="XMark" />} variant="ghost" title="Close" />
58
+ * <IconButton icon={<Icon name="Trash" />} variant="primary-danger" title="Delete" />
59
+ * <IconButton icon={<Icon name="Plus" />} size="small" title="Small add" />
60
+ * </div>
61
+ * );
62
+ * };
63
+ * ```
64
+ * @param {IconButtonProps} props - The props for the IconButton component
65
+ * @returns {ReactElement} IconButton component
27
66
  */
28
67
  export declare const IconButton: {
29
68
  ({ icon, size, square, loading, disabled, className, ref, ...rest }: IconButtonProps): ReactElement;
@@ -1,5 +0,0 @@
1
- import { type SVGProps } from "react";
2
- /**
3
- * The Graphic for the Anatomy EmptyState
4
- */
5
- export declare const AnatomySVG: import("react").ForwardRefExoticComponent<Omit<SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;