@trackunit/react-components 0.1.162 → 0.1.164

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.1.162",
3
+ "version": "0.1.164",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -10,8 +10,9 @@
10
10
  "@floating-ui/react": "0.25.4",
11
11
  "@trackunit/css-class-variance-utilities": "0.0.14",
12
12
  "@trackunit/css-core": "0.0.95",
13
+ "@trackunit/shared-utils": "0.0.9",
13
14
  "@trackunit/ui-design-tokens": "0.0.77",
14
- "@trackunit/ui-icons": "0.0.76",
15
+ "@trackunit/ui-icons": "0.0.77",
15
16
  "date-fns": "2.29.3",
16
17
  "lodash": "4.17.21",
17
18
  "react": "18.2.0",
@@ -6,12 +6,6 @@ export interface CardProps extends CommonProps, React.InputHTMLAttributes<HTMLDi
6
6
  * Whether the card should have full height or not.
7
7
  */
8
8
  fullHeight?: boolean;
9
- /**
10
- * The css grid area to place the card.
11
- *
12
- * @deprecated Use tailwind based grid layouts instead.
13
- */
14
- gridArea?: string;
15
9
  /**
16
10
  * Children to show in the card
17
11
  */
@@ -36,4 +30,4 @@ export interface CardProps extends CommonProps, React.InputHTMLAttributes<HTMLDi
36
30
  * @param {CardProps} props - The props for the Card component
37
31
  * @returns {JSX.Element} Card component
38
32
  */
39
- export declare const Card: ({ children, onClick, fullHeight, onMouseEnter, onMouseLeave, className, dataTestId, gridArea, ...rest }: CardProps) => JSX.Element;
33
+ export declare const Card: ({ children, onClick, fullHeight, onMouseEnter, onMouseLeave, className, dataTestId, ...rest }: CardProps) => JSX.Element;
@@ -1,5 +1,7 @@
1
+ import { Size } from "@trackunit/shared-utils";
1
2
  import * as React from "react";
2
3
  import { CommonProps } from "../../../common";
4
+ type MenuItemSize = Extract<Size, "small" | "medium">;
3
5
  export interface MenuItemProps extends CommonProps {
4
6
  /**
5
7
  * Label of the menu item
@@ -10,6 +12,10 @@ export interface MenuItemProps extends CommonProps {
10
12
  * If you use this prop, the label prop will be ignored.
11
13
  */
12
14
  children?: React.ReactNode;
15
+ /**
16
+ * Size of the menu item
17
+ */
18
+ size?: MenuItemSize;
13
19
  /**
14
20
  * An React element to render before the label.
15
21
  * This is typically used to render an icon.
@@ -54,4 +60,5 @@ export interface MenuItemProps extends CommonProps {
54
60
  * @param {MenuItemProps} props - The props for the MenuItem component
55
61
  * @returns {JSX.Element} MenuItem component
56
62
  */
57
- export declare const MenuItem: ({ className, dataTestId, label, children, selected, focused, prefix, suffix, disabled, onClick, }: MenuItemProps) => JSX.Element;
63
+ export declare const MenuItem: ({ className, dataTestId, label, size, children, selected, focused, prefix, suffix, disabled, onClick, }: MenuItemProps) => JSX.Element;
64
+ export {};
@@ -2,6 +2,7 @@ export declare const cvaMenuItem: (props?: ({
2
2
  selected?: boolean | null | undefined;
3
3
  disabled?: boolean | null | undefined;
4
4
  focused?: boolean | null | undefined;
5
+ size?: "small" | "medium" | null | undefined;
5
6
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
6
7
  export declare const cvaMenuItemLabel: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
7
8
  export declare const cvaMenuItemSuffix: (props?: ({
@@ -1,14 +1,14 @@
1
1
  import { ReactNode } from "react";
2
2
  import { CommonProps } from "../../../common/CommonProps";
3
3
  import { IconProps } from "../../Icon/Icon";
4
- import { PopoverContentChildren, PopoverPlacement } from "../../Popover";
4
+ import { PopoverContentChildren, PopoverProps } from "../../Popover";
5
5
  import { IconButtonProps } from "../../buttons";
6
6
  export type MenuPlacement = "above" | "below";
7
7
  type FilteredIconProps = Omit<IconProps, "onClick" | "name"> & Pick<Partial<IconProps>, "name">;
8
8
  type FilteredIconButtonProps = Omit<IconButtonProps, "icon" | "onClick">;
9
9
  export interface MoreMenuProps extends CommonProps {
10
10
  children: PopoverContentChildren;
11
- menuPlacement?: PopoverPlacement;
11
+ popoverProps?: PopoverProps;
12
12
  iconProps?: FilteredIconProps;
13
13
  iconButtonProps?: FilteredIconButtonProps;
14
14
  customPortalId?: string;
@@ -21,5 +21,5 @@ export interface MoreMenuProps extends CommonProps {
21
21
  * @param {MoreMenuProps} props - The props for the MoreMenu component
22
22
  * @returns {JSX.Element} MoreMenu component
23
23
  */
24
- export declare const MoreMenu: ({ className, dataTestId, menuPlacement, iconProps, iconButtonProps, customButton, customPortalId, children, }: MoreMenuProps) => JSX.Element;
24
+ export declare const MoreMenu: ({ className, dataTestId, popoverProps, iconProps, iconButtonProps, customButton, customPortalId, children, }: MoreMenuProps) => JSX.Element;
25
25
  export {};
@@ -16,6 +16,9 @@ export declare const usePopoverContext: () => {
16
16
  className?: string | undefined;
17
17
  dataTestId?: string | undefined;
18
18
  };
19
+ getReferenceProps: (userProps?: import("react").HTMLProps<Element> | undefined) => Record<string, unknown>;
20
+ getFloatingProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
21
+ getItemProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
19
22
  placement: import("@floating-ui/utils").Placement;
20
23
  strategy: import("@floating-ui/utils").Strategy;
21
24
  middlewareData: import("@floating-ui/core").MiddlewareData;
@@ -52,11 +55,8 @@ export declare const usePopoverContext: () => {
52
55
  refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
53
56
  elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
54
57
  };
55
- getReferenceProps: (userProps?: import("react").HTMLProps<Element> | undefined) => Record<string, unknown>;
56
- getFloatingProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
57
- getItemProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
58
58
  isOpen: boolean;
59
- setIsOpen: (open: boolean) => void;
59
+ setIsOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
60
60
  };
61
61
  /**
62
62
  * The popover component.
@@ -1,9 +1,10 @@
1
- import { Placement } from "@floating-ui/react";
1
+ import { Placement, UseDismissProps } from "@floating-ui/react";
2
2
  import { CommonProps } from "../../common";
3
3
  export type PopoverActivation = {
4
4
  click?: boolean;
5
5
  hover?: boolean;
6
6
  };
7
+ export type PopoverDismissal = Pick<UseDismissProps, "ancestorScroll" | "enabled" | "outsidePress" | "referencePress">;
7
8
  export type PopoverPlacement = Placement;
8
9
  export interface PopoverProps extends CommonProps {
9
10
  /**
@@ -23,9 +24,13 @@ export interface PopoverProps extends CommonProps {
23
24
  */
24
25
  isOpen?: boolean;
25
26
  /**
26
- * Action(s) that activates the popover
27
+ * Options for activation of the popover
27
28
  */
28
29
  activation?: PopoverActivation;
30
+ /**
31
+ * Options for dismissal of the popover
32
+ */
33
+ dismissal?: PopoverDismissal;
29
34
  /**
30
35
  * Callback to be called when the popover open state changes
31
36
  */
@@ -7,7 +7,7 @@ import { PopoverProps } from "./PopoverTypes";
7
7
  * @param {PopoverProps} options The options for the popover
8
8
  * @returns {ReturnType<usePopover>} The data for the popover
9
9
  */
10
- export declare const usePopover: ({ initialOpen, placement, isModal, isOpen: controlledIsOpen, activation, onOpenStateChange: setControlledIsOpen, ...restOptions }: PopoverProps) => {
10
+ export declare const usePopover: ({ initialOpen, placement, isModal, isOpen: controlledIsOpen, activation, dismissal, onOpenStateChange, ...restOptions }: PopoverProps) => {
11
11
  isModal: boolean | undefined;
12
12
  labelId: string | undefined;
13
13
  descriptionId: string | undefined;
@@ -17,6 +17,9 @@ export declare const usePopover: ({ initialOpen, placement, isModal, isOpen: con
17
17
  className?: string | undefined;
18
18
  dataTestId?: string | undefined;
19
19
  };
20
+ getReferenceProps: (userProps?: import("react").HTMLProps<Element> | undefined) => Record<string, unknown>;
21
+ getFloatingProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
22
+ getItemProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
20
23
  placement: import("@floating-ui/utils").Placement;
21
24
  strategy: import("@floating-ui/utils").Strategy;
22
25
  middlewareData: import("@floating-ui/core").MiddlewareData;
@@ -53,9 +56,6 @@ export declare const usePopover: ({ initialOpen, placement, isModal, isOpen: con
53
56
  refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
54
57
  elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
55
58
  };
56
- getReferenceProps: (userProps?: import("react").HTMLProps<Element> | undefined) => Record<string, unknown>;
57
- getFloatingProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
58
- getItemProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
59
59
  isOpen: boolean;
60
- setIsOpen: (open: boolean) => void;
60
+ setIsOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
61
61
  };
@@ -1,7 +1,7 @@
1
1
  import { ActivityColors, CriticalityColors, GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
2
2
  import * as React from "react";
3
- import { CommonProps } from "../../common/CommonProps";
4
- export type TagSize = "small" | "medium";
3
+ import { CommonProps, Size } from "../../common/CommonProps";
4
+ export type TagSize = Extract<Size, "small" | "medium">;
5
5
  export type TagColors = IntentColors | GeneralColors | CriticalityColors | ActivityColors;
6
6
  export interface TagProps extends CommonProps {
7
7
  /**
@@ -1,6 +1,8 @@
1
1
  /// <reference types="react" />
2
+ import { Size } from "@trackunit/shared-utils";
2
3
  import { CommonProps } from "../../common";
3
4
  import { LevelColors } from "./ValueBarTypes";
5
+ type ValueBarSize = Extract<Size, "small" | "large">;
4
6
  export interface ValueBarProps extends CommonProps {
5
7
  /**
6
8
  * Value to display.
@@ -21,7 +23,7 @@ export interface ValueBarProps extends CommonProps {
21
23
  /**
22
24
  * Size of the tooltip
23
25
  */
24
- size?: "small" | "large";
26
+ size?: ValueBarSize;
25
27
  /**
26
28
  * Custom level colors. If this param is not provided then default values are used.
27
29
  */
@@ -42,3 +44,4 @@ export interface ValueBarProps extends CommonProps {
42
44
  * @returns {JSX.Element} ValueBar component
43
45
  */
44
46
  export declare const ValueBar: ({ value, min, max, unit, size, levelColors, valueColor, showValue, className, dataTestId, }: ValueBarProps) => JSX.Element;
47
+ export {};