@trackunit/react-components 1.4.124 → 1.4.125
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 +3 -2
- package/index.esm.js +3 -2
- package/package.json +1 -1
- package/src/components/Menu/MenuItem/MenuItem.d.ts +10 -3
package/index.cjs.js
CHANGED
|
@@ -2923,7 +2923,7 @@ const cvaInteractableItem = cssClassVarianceUtilities.cvaMerge("", {
|
|
|
2923
2923
|
false: "", // use compoundVariants instead
|
|
2924
2924
|
},
|
|
2925
2925
|
focused: {
|
|
2926
|
-
true: "
|
|
2926
|
+
true: ["bg-neutral-600/5"],
|
|
2927
2927
|
false: "",
|
|
2928
2928
|
auto: "[&:has(:focus-visible)]:outline-native",
|
|
2929
2929
|
},
|
|
@@ -3054,7 +3054,7 @@ const cvaMenuItemSuffix = cssClassVarianceUtilities.cvaMerge(["text-secondary-40
|
|
|
3054
3054
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
3055
3055
|
* @returns {ReactElement} MenuItem component
|
|
3056
3056
|
*/
|
|
3057
|
-
const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, fieldSize = "medium", variant = "primary", }) => {
|
|
3057
|
+
const MenuItem = ({ className, dataTestId, label, children, selected, focused, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, fieldSize = "medium", variant = "primary", }) => {
|
|
3058
3058
|
/* Handle tab navigation */
|
|
3059
3059
|
const handleKeyDown = (e) => {
|
|
3060
3060
|
if (e.key === "Enter" && onClick && !disabled) {
|
|
@@ -3069,6 +3069,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
|
|
|
3069
3069
|
disabled,
|
|
3070
3070
|
className,
|
|
3071
3071
|
variant,
|
|
3072
|
+
focused,
|
|
3072
3073
|
}), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
|
|
3073
3074
|
stopPropagation && e.stopPropagation();
|
|
3074
3075
|
onClick?.(e);
|
package/index.esm.js
CHANGED
|
@@ -2921,7 +2921,7 @@ const cvaInteractableItem = cvaMerge("", {
|
|
|
2921
2921
|
false: "", // use compoundVariants instead
|
|
2922
2922
|
},
|
|
2923
2923
|
focused: {
|
|
2924
|
-
true: "
|
|
2924
|
+
true: ["bg-neutral-600/5"],
|
|
2925
2925
|
false: "",
|
|
2926
2926
|
auto: "[&:has(:focus-visible)]:outline-native",
|
|
2927
2927
|
},
|
|
@@ -3052,7 +3052,7 @@ const cvaMenuItemSuffix = cvaMerge(["text-secondary-400", "text-sm"], {
|
|
|
3052
3052
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
3053
3053
|
* @returns {ReactElement} MenuItem component
|
|
3054
3054
|
*/
|
|
3055
|
-
const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, fieldSize = "medium", variant = "primary", }) => {
|
|
3055
|
+
const MenuItem = ({ className, dataTestId, label, children, selected, focused, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, fieldSize = "medium", variant = "primary", }) => {
|
|
3056
3056
|
/* Handle tab navigation */
|
|
3057
3057
|
const handleKeyDown = (e) => {
|
|
3058
3058
|
if (e.key === "Enter" && onClick && !disabled) {
|
|
@@ -3067,6 +3067,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
|
|
|
3067
3067
|
disabled,
|
|
3068
3068
|
className,
|
|
3069
3069
|
variant,
|
|
3070
|
+
focused,
|
|
3070
3071
|
}), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
|
|
3071
3072
|
stopPropagation && e.stopPropagation();
|
|
3072
3073
|
onClick?.(e);
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MouseEventHandler, ReactNode } from "react";
|
|
2
1
|
import { VariantProps } from "@trackunit/css-class-variance-utilities";
|
|
2
|
+
import { MouseEventHandler, ReactNode } from "react";
|
|
3
3
|
import { CommonProps } from "../../../common";
|
|
4
4
|
import { cvaMenuItemStyle } from "./MenuItem.variants";
|
|
5
5
|
export type MenuItemVariant = "primary" | "danger";
|
|
@@ -30,12 +30,19 @@ export interface MenuItemProps extends CommonProps {
|
|
|
30
30
|
*/
|
|
31
31
|
suffix?: ReactNode;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* A boolean flag to turn on/off selected state
|
|
34
34
|
* This is typically used highlight that item is selected
|
|
35
35
|
*
|
|
36
36
|
* @memberof MenuItemProps
|
|
37
37
|
*/
|
|
38
38
|
selected?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* A boolean flag to turn on/off focused state
|
|
41
|
+
* This is typically used highlight that item is focused
|
|
42
|
+
*
|
|
43
|
+
* @memberof MenuItemProps
|
|
44
|
+
*/
|
|
45
|
+
focused?: boolean;
|
|
39
46
|
/**
|
|
40
47
|
* OnClick event handler it is thrown on root element of the component tree
|
|
41
48
|
*
|
|
@@ -78,4 +85,4 @@ export interface MenuItemProps extends CommonProps {
|
|
|
78
85
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
79
86
|
* @returns {ReactElement} MenuItem component
|
|
80
87
|
*/
|
|
81
|
-
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;
|
|
88
|
+
export declare const MenuItem: ({ className, dataTestId, label, children, selected, focused, prefix, suffix, disabled, onClick, stopPropagation, id, tabIndex, optionLabelDescription, fieldSize, variant, }: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
|