@trackunit/react-components 1.1.11 → 1.1.13
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
|
@@ -475,6 +475,7 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
475
475
|
"bg-primary-600",
|
|
476
476
|
"hover:bg-primary-700",
|
|
477
477
|
"active:bg-primary-800",
|
|
478
|
+
"focus:bg-primary-800",
|
|
478
479
|
"disabled:bg-slate-400",
|
|
479
480
|
"disabled:text-slate-200",
|
|
480
481
|
],
|
|
@@ -483,6 +484,7 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
483
484
|
"bg-danger-600",
|
|
484
485
|
"hover:bg-danger-700",
|
|
485
486
|
"active:bg-danger-800",
|
|
487
|
+
"focus:bg-danger-800",
|
|
486
488
|
"disabled:bg-slate-400",
|
|
487
489
|
"disabled:text-slate-200",
|
|
488
490
|
],
|
|
@@ -494,6 +496,8 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
494
496
|
"text-slate-600",
|
|
495
497
|
"hover:bg-slate-100",
|
|
496
498
|
"hover:text-slate-700",
|
|
499
|
+
"focus:bg-slate-200",
|
|
500
|
+
"focus:text-slate-800",
|
|
497
501
|
"active:bg-slate-200",
|
|
498
502
|
"active:text-slate-800",
|
|
499
503
|
"disabled:bg-slate-200",
|
|
@@ -510,6 +514,9 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
510
514
|
"active:bg-danger-200",
|
|
511
515
|
"active:text-danger-800",
|
|
512
516
|
"active:border-danger-800",
|
|
517
|
+
"focus:bg-danger-200",
|
|
518
|
+
"focus:text-danger-800",
|
|
519
|
+
"focus:border-danger-800",
|
|
513
520
|
"disabled:bg-slate-300",
|
|
514
521
|
"disabled:text-slate-400",
|
|
515
522
|
],
|
|
@@ -520,6 +527,8 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
520
527
|
"hover:text-primary-700",
|
|
521
528
|
"active:bg-black/10",
|
|
522
529
|
"active:text-primary-800",
|
|
530
|
+
"focus:bg-black/10",
|
|
531
|
+
"focus:text-primary-800",
|
|
523
532
|
"disabled:bg-transparent",
|
|
524
533
|
"disabled:text-slate-400",
|
|
525
534
|
],
|
|
@@ -531,6 +540,8 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
531
540
|
"hover:text-slate-700",
|
|
532
541
|
"active:bg-black/10",
|
|
533
542
|
"active:text-slate-800",
|
|
543
|
+
"focus:bg-black/10",
|
|
544
|
+
"focus:text-slate-800",
|
|
534
545
|
"disabled:bg-transparent",
|
|
535
546
|
"disabled:text-slate-400",
|
|
536
547
|
],
|
|
@@ -2393,7 +2404,7 @@ const PopoverTrigger = react.forwardRef(function PopoverTrigger({ children, rend
|
|
|
2393
2404
|
}
|
|
2394
2405
|
});
|
|
2395
2406
|
|
|
2396
|
-
const cvaTooltipContainer = cssClassVarianceUtilities.cvaMerge(["flex"]);
|
|
2407
|
+
const cvaTooltipContainer = cssClassVarianceUtilities.cvaMerge(["flex", "leading-5"]);
|
|
2397
2408
|
const cvaTooltipIcon = cssClassVarianceUtilities.cvaMerge(["flex", "h-max", "w-fit", "text-slate-300", "transition", "hover:cursor-pointer", "hover:text-slate-400"], {
|
|
2398
2409
|
variants: {
|
|
2399
2410
|
color: {
|
|
@@ -2772,11 +2783,16 @@ const cvaInteractableItem = cssClassVarianceUtilities.cvaMerge("", {
|
|
|
2772
2783
|
* The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
|
|
2773
2784
|
*/
|
|
2774
2785
|
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);
|
|
2786
|
+
const { selected, disabled, focused, className, variant, fieldSize } = props ?? {};
|
|
2787
|
+
return tailwindMerge.twMerge(cvaMenuItemStyle({ variant, selected, disabled, fieldSize }), cvaInteractableItem({ selected, disabled, cursor: "pointer", focused }), className);
|
|
2777
2788
|
};
|
|
2778
2789
|
const cvaMenuItemStyle = cssClassVarianceUtilities.cvaMerge(["py-2", "px-2", "h-auto", "flex", "flex-row", "items-center", "gap-x-2", "select-none", "rounded", "text-sm"], {
|
|
2779
2790
|
variants: {
|
|
2791
|
+
fieldSize: {
|
|
2792
|
+
small: ["text-xs", "py-1.5"],
|
|
2793
|
+
medium: "",
|
|
2794
|
+
large: "",
|
|
2795
|
+
},
|
|
2780
2796
|
variant: {
|
|
2781
2797
|
primary: [],
|
|
2782
2798
|
danger: [
|
|
@@ -2873,7 +2889,7 @@ const cvaMenuItemSuffix = cssClassVarianceUtilities.cvaMerge(["text-secondary-40
|
|
|
2873
2889
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
2874
2890
|
* @returns {JSX.Element} MenuItem component
|
|
2875
2891
|
*/
|
|
2876
|
-
const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, variant = "primary", }) => {
|
|
2892
|
+
const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, fieldSize = "medium", variant = "primary", }) => {
|
|
2877
2893
|
/* Handle tab navigation */
|
|
2878
2894
|
const handleKeyDown = (e) => {
|
|
2879
2895
|
if (e.key === "Enter" && onClick && !disabled) {
|
|
@@ -2884,6 +2900,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
|
|
|
2884
2900
|
};
|
|
2885
2901
|
return (jsxRuntime.jsxs("div", { "aria-disabled": disabled, className: cvaMenuItem({
|
|
2886
2902
|
selected,
|
|
2903
|
+
fieldSize,
|
|
2887
2904
|
disabled,
|
|
2888
2905
|
className,
|
|
2889
2906
|
variant,
|
package/index.esm.js
CHANGED
|
@@ -473,6 +473,7 @@ const cvaButton = cvaMerge([
|
|
|
473
473
|
"bg-primary-600",
|
|
474
474
|
"hover:bg-primary-700",
|
|
475
475
|
"active:bg-primary-800",
|
|
476
|
+
"focus:bg-primary-800",
|
|
476
477
|
"disabled:bg-slate-400",
|
|
477
478
|
"disabled:text-slate-200",
|
|
478
479
|
],
|
|
@@ -481,6 +482,7 @@ const cvaButton = cvaMerge([
|
|
|
481
482
|
"bg-danger-600",
|
|
482
483
|
"hover:bg-danger-700",
|
|
483
484
|
"active:bg-danger-800",
|
|
485
|
+
"focus:bg-danger-800",
|
|
484
486
|
"disabled:bg-slate-400",
|
|
485
487
|
"disabled:text-slate-200",
|
|
486
488
|
],
|
|
@@ -492,6 +494,8 @@ const cvaButton = cvaMerge([
|
|
|
492
494
|
"text-slate-600",
|
|
493
495
|
"hover:bg-slate-100",
|
|
494
496
|
"hover:text-slate-700",
|
|
497
|
+
"focus:bg-slate-200",
|
|
498
|
+
"focus:text-slate-800",
|
|
495
499
|
"active:bg-slate-200",
|
|
496
500
|
"active:text-slate-800",
|
|
497
501
|
"disabled:bg-slate-200",
|
|
@@ -508,6 +512,9 @@ const cvaButton = cvaMerge([
|
|
|
508
512
|
"active:bg-danger-200",
|
|
509
513
|
"active:text-danger-800",
|
|
510
514
|
"active:border-danger-800",
|
|
515
|
+
"focus:bg-danger-200",
|
|
516
|
+
"focus:text-danger-800",
|
|
517
|
+
"focus:border-danger-800",
|
|
511
518
|
"disabled:bg-slate-300",
|
|
512
519
|
"disabled:text-slate-400",
|
|
513
520
|
],
|
|
@@ -518,6 +525,8 @@ const cvaButton = cvaMerge([
|
|
|
518
525
|
"hover:text-primary-700",
|
|
519
526
|
"active:bg-black/10",
|
|
520
527
|
"active:text-primary-800",
|
|
528
|
+
"focus:bg-black/10",
|
|
529
|
+
"focus:text-primary-800",
|
|
521
530
|
"disabled:bg-transparent",
|
|
522
531
|
"disabled:text-slate-400",
|
|
523
532
|
],
|
|
@@ -529,6 +538,8 @@ const cvaButton = cvaMerge([
|
|
|
529
538
|
"hover:text-slate-700",
|
|
530
539
|
"active:bg-black/10",
|
|
531
540
|
"active:text-slate-800",
|
|
541
|
+
"focus:bg-black/10",
|
|
542
|
+
"focus:text-slate-800",
|
|
532
543
|
"disabled:bg-transparent",
|
|
533
544
|
"disabled:text-slate-400",
|
|
534
545
|
],
|
|
@@ -2391,7 +2402,7 @@ const PopoverTrigger = forwardRef(function PopoverTrigger({ children, renderButt
|
|
|
2391
2402
|
}
|
|
2392
2403
|
});
|
|
2393
2404
|
|
|
2394
|
-
const cvaTooltipContainer = cvaMerge(["flex"]);
|
|
2405
|
+
const cvaTooltipContainer = cvaMerge(["flex", "leading-5"]);
|
|
2395
2406
|
const cvaTooltipIcon = cvaMerge(["flex", "h-max", "w-fit", "text-slate-300", "transition", "hover:cursor-pointer", "hover:text-slate-400"], {
|
|
2396
2407
|
variants: {
|
|
2397
2408
|
color: {
|
|
@@ -2770,11 +2781,16 @@ const cvaInteractableItem = cvaMerge("", {
|
|
|
2770
2781
|
* The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
|
|
2771
2782
|
*/
|
|
2772
2783
|
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);
|
|
2784
|
+
const { selected, disabled, focused, className, variant, fieldSize } = props ?? {};
|
|
2785
|
+
return twMerge(cvaMenuItemStyle({ variant, selected, disabled, fieldSize }), cvaInteractableItem({ selected, disabled, cursor: "pointer", focused }), className);
|
|
2775
2786
|
};
|
|
2776
2787
|
const cvaMenuItemStyle = cvaMerge(["py-2", "px-2", "h-auto", "flex", "flex-row", "items-center", "gap-x-2", "select-none", "rounded", "text-sm"], {
|
|
2777
2788
|
variants: {
|
|
2789
|
+
fieldSize: {
|
|
2790
|
+
small: ["text-xs", "py-1.5"],
|
|
2791
|
+
medium: "",
|
|
2792
|
+
large: "",
|
|
2793
|
+
},
|
|
2778
2794
|
variant: {
|
|
2779
2795
|
primary: [],
|
|
2780
2796
|
danger: [
|
|
@@ -2871,7 +2887,7 @@ const cvaMenuItemSuffix = cvaMerge(["text-secondary-400", "text-sm"], {
|
|
|
2871
2887
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
2872
2888
|
* @returns {JSX.Element} MenuItem component
|
|
2873
2889
|
*/
|
|
2874
|
-
const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, variant = "primary", }) => {
|
|
2890
|
+
const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, fieldSize = "medium", variant = "primary", }) => {
|
|
2875
2891
|
/* Handle tab navigation */
|
|
2876
2892
|
const handleKeyDown = (e) => {
|
|
2877
2893
|
if (e.key === "Enter" && onClick && !disabled) {
|
|
@@ -2882,6 +2898,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
|
|
|
2882
2898
|
};
|
|
2883
2899
|
return (jsxs("div", { "aria-disabled": disabled, className: cvaMenuItem({
|
|
2884
2900
|
selected,
|
|
2901
|
+
fieldSize,
|
|
2885
2902
|
disabled,
|
|
2886
2903
|
className,
|
|
2887
2904
|
variant,
|
package/package.json
CHANGED
|
@@ -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;
|