@trackunit/react-components 0.4.33 → 0.5.0

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": "0.4.33",
3
+ "version": "0.5.0",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -23,7 +23,6 @@
23
23
  "@testing-library/react": "15.0.6",
24
24
  "@floating-ui/react": "^0.26.25",
25
25
  "@tanstack/react-router": "1.47.1",
26
- "react-swipeable": "^7.0.1",
27
26
  "string-ts": "^2.0.0",
28
27
  "tailwind-merge": "^2.0.0",
29
28
  "@trackunit/react-table-pagination": "*"
@@ -0,0 +1,4 @@
1
+ /**
2
+ * The MenuDivider component is used to separate items in a menu list.
3
+ */
4
+ export declare const MenuDivider: () => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,10 @@
1
- import * as React from "react";
2
1
  import { CommonProps, Size } from "../../../common";
3
2
  type MenuItemSize = Extract<Size, "small" | "medium">;
3
+ export type MenuItemVariant = "primary" | "danger";
4
4
  export interface MenuItemProps extends CommonProps {
5
+ /**
6
+ * The unique id for the menu item
7
+ */
5
8
  id?: string;
6
9
  /**
7
10
  * Label of the menu item
@@ -51,7 +54,14 @@ export interface MenuItemProps extends CommonProps {
51
54
  * used in Menu and Select components
52
55
  */
53
56
  stopPropagation?: boolean;
57
+ /**
58
+ * The tab index of the menu item.
59
+ */
54
60
  tabIndex?: number;
61
+ /**
62
+ * The button's variant. Values are primary and danger.
63
+ */
64
+ variant?: MenuItemVariant;
55
65
  }
56
66
  /**
57
67
  * The MenuItem component is used to display a menu, primarily meant to be used in a list form.
@@ -59,5 +69,5 @@ export interface MenuItemProps extends CommonProps {
59
69
  * @param {MenuItemProps} props - The props for the MenuItem component
60
70
  * @returns {JSX.Element} MenuItem component
61
71
  */
62
- export declare const MenuItem: ({ className, dataTestId, label, size, children, selected, prefix, suffix, disabled, onClick, stopPropagation, id, tabIndex, }: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
72
+ export declare const MenuItem: ({ className, dataTestId, label, size, children, selected, prefix, suffix, disabled, onClick, stopPropagation, id, tabIndex, variant, }: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
63
73
  export {};
@@ -1,22 +1,35 @@
1
1
  import { type VariantProps } from "@trackunit/css-class-variance-utilities";
2
2
  import { MappedOmit } from "@trackunit/shared-utils";
3
3
  import { cvaInteractableItem } from "../../InteractableItem/InteractableItem.variants";
4
- export declare const cvaMenuItemStyle: (props?: ({
5
- size?: "small" | "medium" | null | undefined;
6
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
4
+ import { MenuItemVariant } from "./MenuItem";
7
5
  type CvaMenuItemProps = Partial<MappedOmit<VariantProps<typeof cvaInteractableItem>, "cursor">> & {
8
6
  size?: "small" | "medium";
7
+ variant?: MenuItemVariant;
8
+ selected?: boolean | null | undefined;
9
9
  };
10
10
  /**
11
11
  * Extends the cvaInteractableItem variant in order to set the padding, width, height, cursor, and other styles particular to the MenuItem component.
12
12
  * The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
13
13
  */
14
14
  export declare const cvaMenuItem: (props?: CvaMenuItemProps) => string;
15
- export declare const cvaMenuItemLabel: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
16
- export declare const cvaMenuItemSuffix: (props?: ({
15
+ export declare const cvaMenuItemStyle: (props?: ({
16
+ size?: "small" | "medium" | null | undefined;
17
+ variant?: "primary" | "danger" | null | undefined;
17
18
  selected?: boolean | null | undefined;
19
+ disabled?: boolean | null | undefined;
20
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
21
+ export declare const cvaMenuItemLabel: (props?: ({
22
+ variant?: "primary" | "danger" | null | undefined;
23
+ disabled?: boolean | null | undefined;
18
24
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
19
25
  export declare const cvaMenuItemPrefix: (props?: ({
20
26
  selected?: boolean | null | undefined;
27
+ variant?: "primary" | "danger" | null | undefined;
28
+ disabled?: boolean | null | undefined;
29
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
30
+ export declare const cvaMenuItemSuffix: (props?: ({
31
+ selected?: boolean | null | undefined;
32
+ variant?: "primary" | "danger" | null | undefined;
33
+ disabled?: boolean | null | undefined;
21
34
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
22
35
  export {};
@@ -1,17 +1,9 @@
1
1
  import { CommonProps } from "../../../common";
2
- import { MenuItemProps } from "../MenuItem/MenuItem";
3
- export interface MenuListItemProps extends MenuItemProps {
4
- showDivider?: boolean;
5
- }
6
2
  export interface MenuListProps extends CommonProps {
7
3
  /**
8
4
  * List of menu items to be rendered.
9
5
  */
10
6
  children: React.ReactNode;
11
- /**
12
- * List of menu items to be rendered.
13
- */
14
- showDivider?: boolean;
15
7
  /**
16
8
  * When enabled the menu list padding will be removed, and a grid will be applied to keep the first column "sticky".
17
9
  *
@@ -20,11 +12,30 @@ export interface MenuListProps extends CommonProps {
20
12
  withStickyHeader?: boolean;
21
13
  /** Click handler - typically used to trigger close action. when propagation is NOT prevented on menuItem */
22
14
  onClick?: () => void;
15
+ /**
16
+ * Enable multi-selection in the menu list.
17
+ *
18
+ * @default false
19
+ */
20
+ isMulti?: boolean;
21
+ /**
22
+ * Array of IDs representing the currently selected items.
23
+ */
24
+ selectedItems?: string[];
25
+ /**
26
+ * Callback triggered when selected items change.
27
+ */
28
+ onSelectionChange?: (selected: string[]) => void;
23
29
  }
24
30
  /**
25
- * The MenuList component is used for menus and selects.
26
-
31
+ * The MenuList is a popover menu that appears above all other content on the page. The menu offers a list of actions or functions that a user can access by clicking on a trigger.
32
+ *
33
+ * **When to use**
34
+ * - Use the MenuList if you have limited space and need to display overflow actions in a list.
35
+ * - Use the MenuList for actions that are not essential to completing workflows.
36
+ * - 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).
37
+ *
27
38
  * @param {MenuListProps} props - The props for the MenuList component
28
39
  * @returns {JSX.Element} MenuList component
29
40
  */
30
- export declare const MenuList: ({ dataTestId, className, children, withStickyHeader, showDivider, ...args }: MenuListProps) => JSX.Element;
41
+ export declare const MenuList: ({ dataTestId, className, children, withStickyHeader, isMulti, selectedItems: controlledSelectedItems, onSelectionChange, ...args }: MenuListProps) => JSX.Element;
@@ -2,3 +2,5 @@ export declare const cvaMenuList: (props?: ({
2
2
  stickyHeader?: boolean | null | undefined;
3
3
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
4
4
  export declare const cvaMenuListDivider: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
5
+ export declare const cvaMenuListMultiSelect: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
6
+ export declare const cvaMenuListItem: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -1,3 +1,4 @@
1
+ export * from "./MenuDivider/MenuDivider";
1
2
  export * from "./MenuItem/MenuItem";
2
3
  export * from "./MenuList/MenuList";
3
4
  export * from "./MoreMenu/MoreMenu";
@@ -6,7 +6,6 @@ export * from "./Card";
6
6
  export * from "./Collapse";
7
7
  export * from "./CompletionStatusIndicator/CompletionStatusIndicator";
8
8
  export * from "./CopyableText";
9
- export * from "./Drawer";
10
9
  export * from "./EmptyState/EmptyState";
11
10
  export * from "./EmptyValue/EmptyValue";
12
11
  export * from "./ExternalLink/ExternalLink";
@@ -41,4 +40,3 @@ export * from "./Tooltip";
41
40
  export * from "./ValueBar";
42
41
  export * from "./VirtualizedList/VirtualizedList";
43
42
  export * from "./Widget";
44
- export * from "./buttons";
@@ -1,37 +0,0 @@
1
- import { CommonProps } from "../../common";
2
- export type Position = "left" | "right" | "top" | "bottom";
3
- export interface DrawerProps extends CommonProps {
4
- /**
5
- * Specifies whether the sidebar drawer is open or not.
6
- */
7
- open?: boolean;
8
- /**
9
- * The onClose handler for the drawer.
10
- */
11
- onClose?: (event?: React.MouseEvent | KeyboardEvent) => void;
12
- /**
13
- * The handler for toggling the drawer state.
14
- */
15
- onToggle?: (event: React.MouseEvent) => void;
16
- /**
17
- * Whether the drawer needs an overlay or not. Without the overlay, user will have to handle mechanism for closing the drawer.
18
- */
19
- disableOverlay?: boolean;
20
- /**
21
- * The position of the drawer.
22
- */
23
- position?: Position;
24
- /**
25
- * The child node that will be rendered inside the drawer.
26
- */
27
- children?: React.ReactNode;
28
- dialogClassName?: string;
29
- }
30
- /**
31
- * MapSidebar is a sidebar component used with Maps.
32
- * It provides a slide over sidebar drawer which can be used for displaying map related information or controls.
33
- *
34
- * @param {DrawerProps} props - The props for the MapSidebar component
35
- * @returns {JSX.Element | null} Drawer component
36
- */
37
- export declare const Drawer: ({ open, onToggle, onClose, disableOverlay, position, children, dataTestId, className, dialogClassName, }: DrawerProps) => JSX.Element | null;
@@ -1,20 +0,0 @@
1
- export declare const cvaDialog: (props?: ({
2
- position?: "left" | "right" | "top" | "bottom" | null | undefined;
3
- sidebarMode?: "semi-closed" | "1/3" | "2/3" | "full" | "semi-full" | "closed" | null | undefined;
4
- isLargeScreen?: boolean | null | undefined;
5
- open?: boolean | null | undefined;
6
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
- export declare const cvaDialogContainer: (props?: ({
8
- sidebarMode?: "semi-closed" | "1/3" | "2/3" | "full" | "semi-full" | "closed" | null | undefined;
9
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
10
- export declare const cvaSwipeContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
11
- export declare const cvaSwipeIcon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
12
- export declare const cvaToogleContainer: (props?: ({
13
- position?: "left" | "right" | "top" | "bottom" | null | undefined;
14
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
15
- export declare const cvaToogleButton: (props?: ({
16
- position?: "left" | "right" | "top" | "bottom" | null | undefined;
17
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
18
- export declare const cvaOverlayContainer: (props?: ({
19
- open?: boolean | null | undefined;
20
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -1,14 +0,0 @@
1
- interface OverlayProps {
2
- open: boolean;
3
- onClose?: (event: React.MouseEvent | KeyboardEvent) => void;
4
- }
5
- /**
6
- * Overlay Component
7
- *
8
- * @param {object} props - The Overlay component properties
9
- * @param {boolean} props.open - Open status of the Overlay
10
- * @param {Function} props.onClose - Callback function when Overlay is closed
11
- * @returns {JSX.Element|null} The Overlay component
12
- */
13
- declare const Overlay: ({ open, onClose }: OverlayProps) => JSX.Element | null;
14
- export default Overlay;
@@ -1,19 +0,0 @@
1
- import { Position } from "./Drawer";
2
- interface ToogleButtonProps {
3
- open: boolean;
4
- onToggle?: (event: React.MouseEvent) => void;
5
- position: Position;
6
- }
7
- /**
8
- * ToggleButton is a React functional component that returns a button with a chevron icon.
9
- * The direction of the chevron changes depending on the state of the 'open' prop and
10
- * the side the button is positioned ('position' prop).
11
- * The button might be disabled based on the 'disableButton' prop.
12
- *
13
- * @param {object} props - The properties passed to the component
14
- * @param {boolean} props.open - Indicates if the button is in "open" state
15
- * @param {Function} [props.onToggle] - Optional callback function for when the button is clicked
16
- * @param {Position} props.position - The position of the button relative to its container
17
- */
18
- declare const ToogleButton: ({ open, position, onToggle }: ToogleButtonProps) => import("react/jsx-runtime").JSX.Element;
19
- export default ToogleButton;
@@ -1 +0,0 @@
1
- export * from "./Drawer";