@trackunit/react-components 1.1.11 → 1.1.12

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/index.cjs.js CHANGED
@@ -2393,7 +2393,7 @@ const PopoverTrigger = react.forwardRef(function PopoverTrigger({ children, rend
2393
2393
  }
2394
2394
  });
2395
2395
 
2396
- const cvaTooltipContainer = cssClassVarianceUtilities.cvaMerge(["flex"]);
2396
+ const cvaTooltipContainer = cssClassVarianceUtilities.cvaMerge(["flex", "leading-5"]);
2397
2397
  const cvaTooltipIcon = cssClassVarianceUtilities.cvaMerge(["flex", "h-max", "w-fit", "text-slate-300", "transition", "hover:cursor-pointer", "hover:text-slate-400"], {
2398
2398
  variants: {
2399
2399
  color: {
@@ -2772,11 +2772,16 @@ const cvaInteractableItem = cssClassVarianceUtilities.cvaMerge("", {
2772
2772
  * The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
2773
2773
  */
2774
2774
  const cvaMenuItem = (props) => {
2775
- const { selected, disabled, focused, className, variant } = props ?? {};
2776
- return tailwindMerge.twMerge(cvaMenuItemStyle({ variant, selected, disabled }), cvaInteractableItem({ selected, disabled, cursor: "pointer", focused }), className);
2775
+ const { selected, disabled, focused, className, variant, fieldSize } = props ?? {};
2776
+ return tailwindMerge.twMerge(cvaMenuItemStyle({ variant, selected, disabled, fieldSize }), cvaInteractableItem({ selected, disabled, cursor: "pointer", focused }), className);
2777
2777
  };
2778
2778
  const cvaMenuItemStyle = cssClassVarianceUtilities.cvaMerge(["py-2", "px-2", "h-auto", "flex", "flex-row", "items-center", "gap-x-2", "select-none", "rounded", "text-sm"], {
2779
2779
  variants: {
2780
+ fieldSize: {
2781
+ small: ["text-xs", "py-1.5"],
2782
+ medium: "",
2783
+ large: "",
2784
+ },
2780
2785
  variant: {
2781
2786
  primary: [],
2782
2787
  danger: [
@@ -2873,7 +2878,7 @@ const cvaMenuItemSuffix = cssClassVarianceUtilities.cvaMerge(["text-secondary-40
2873
2878
  * @param {MenuItemProps} props - The props for the MenuItem component
2874
2879
  * @returns {JSX.Element} MenuItem component
2875
2880
  */
2876
- const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, variant = "primary", }) => {
2881
+ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, fieldSize = "medium", variant = "primary", }) => {
2877
2882
  /* Handle tab navigation */
2878
2883
  const handleKeyDown = (e) => {
2879
2884
  if (e.key === "Enter" && onClick && !disabled) {
@@ -2884,6 +2889,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
2884
2889
  };
2885
2890
  return (jsxRuntime.jsxs("div", { "aria-disabled": disabled, className: cvaMenuItem({
2886
2891
  selected,
2892
+ fieldSize,
2887
2893
  disabled,
2888
2894
  className,
2889
2895
  variant,
package/index.esm.js CHANGED
@@ -2391,7 +2391,7 @@ const PopoverTrigger = forwardRef(function PopoverTrigger({ children, renderButt
2391
2391
  }
2392
2392
  });
2393
2393
 
2394
- const cvaTooltipContainer = cvaMerge(["flex"]);
2394
+ const cvaTooltipContainer = cvaMerge(["flex", "leading-5"]);
2395
2395
  const cvaTooltipIcon = cvaMerge(["flex", "h-max", "w-fit", "text-slate-300", "transition", "hover:cursor-pointer", "hover:text-slate-400"], {
2396
2396
  variants: {
2397
2397
  color: {
@@ -2770,11 +2770,16 @@ const cvaInteractableItem = cvaMerge("", {
2770
2770
  * The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
2771
2771
  */
2772
2772
  const cvaMenuItem = (props) => {
2773
- const { selected, disabled, focused, className, variant } = props ?? {};
2774
- return twMerge(cvaMenuItemStyle({ variant, selected, disabled }), cvaInteractableItem({ selected, disabled, cursor: "pointer", focused }), className);
2773
+ const { selected, disabled, focused, className, variant, fieldSize } = props ?? {};
2774
+ return twMerge(cvaMenuItemStyle({ variant, selected, disabled, fieldSize }), cvaInteractableItem({ selected, disabled, cursor: "pointer", focused }), className);
2775
2775
  };
2776
2776
  const cvaMenuItemStyle = cvaMerge(["py-2", "px-2", "h-auto", "flex", "flex-row", "items-center", "gap-x-2", "select-none", "rounded", "text-sm"], {
2777
2777
  variants: {
2778
+ fieldSize: {
2779
+ small: ["text-xs", "py-1.5"],
2780
+ medium: "",
2781
+ large: "",
2782
+ },
2778
2783
  variant: {
2779
2784
  primary: [],
2780
2785
  danger: [
@@ -2871,7 +2876,7 @@ const cvaMenuItemSuffix = cvaMerge(["text-secondary-400", "text-sm"], {
2871
2876
  * @param {MenuItemProps} props - The props for the MenuItem component
2872
2877
  * @returns {JSX.Element} MenuItem component
2873
2878
  */
2874
- const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, variant = "primary", }) => {
2879
+ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, fieldSize = "medium", variant = "primary", }) => {
2875
2880
  /* Handle tab navigation */
2876
2881
  const handleKeyDown = (e) => {
2877
2882
  if (e.key === "Enter" && onClick && !disabled) {
@@ -2882,6 +2887,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
2882
2887
  };
2883
2888
  return (jsxs("div", { "aria-disabled": disabled, className: cvaMenuItem({
2884
2889
  selected,
2890
+ fieldSize,
2885
2891
  disabled,
2886
2892
  className,
2887
2893
  variant,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -1,4 +1,6 @@
1
+ import { VariantProps } from "@trackunit/css-class-variance-utilities";
1
2
  import { CommonProps } from "../../../common";
3
+ import { cvaMenuItemStyle } from "./MenuItem.variants";
2
4
  export type MenuItemVariant = "primary" | "danger";
3
5
  export interface MenuItemProps extends CommonProps {
4
6
  /**
@@ -61,6 +63,13 @@ export interface MenuItemProps extends CommonProps {
61
63
  * Adds a suffixed description to the label, ie. (CustomerID 1234)
62
64
  */
63
65
  optionLabelDescription?: string;
66
+ /**
67
+ * The size of the field.
68
+ *
69
+ * @default "medium"
70
+ * @memberof MenuItemProps
71
+ */
72
+ fieldSize?: VariantProps<typeof cvaMenuItemStyle>["fieldSize"];
64
73
  }
65
74
  /**
66
75
  * The MenuItem component is used to display a menu, primarily meant to be used in a list form.
@@ -68,4 +77,4 @@ export interface MenuItemProps extends CommonProps {
68
77
  * @param {MenuItemProps} props - The props for the MenuItem component
69
78
  * @returns {JSX.Element} MenuItem component
70
79
  */
71
- export declare const MenuItem: ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation, id, tabIndex, optionLabelDescription, variant, }: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
80
+ export declare const MenuItem: ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation, id, tabIndex, optionLabelDescription, fieldSize, variant, }: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,6 +5,7 @@ import { MenuItemVariant } from "./MenuItem";
5
5
  type CvaMenuItemProps = Partial<MappedOmit<VariantProps<typeof cvaInteractableItem>, "cursor">> & {
6
6
  variant?: MenuItemVariant;
7
7
  selected: boolean | null | undefined;
8
+ fieldSize?: VariantProps<typeof cvaMenuItemStyle>["fieldSize"];
8
9
  };
9
10
  /**
10
11
  * Extends the cvaInteractableItem variant in order to set the padding, width, height, cursor, and other styles particular to the MenuItem component.
@@ -12,6 +13,7 @@ type CvaMenuItemProps = Partial<MappedOmit<VariantProps<typeof cvaInteractableIt
12
13
  */
13
14
  export declare const cvaMenuItem: (props?: CvaMenuItemProps) => string;
14
15
  export declare const cvaMenuItemStyle: (props?: ({
16
+ fieldSize?: "small" | "medium" | "large" | null | undefined;
15
17
  variant?: "primary" | "danger" | null | undefined;
16
18
  selected?: boolean | null | undefined;
17
19
  disabled?: boolean | null | undefined;