@trackunit/react-components 0.1.411 → 0.1.412
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 +69 -104
- package/index.esm.js +70 -104
- package/package.json +1 -1
- package/src/common/index.d.ts +0 -1
- package/src/components/InteractableItem/InteractableItem.variants.d.ts +13 -7
- package/src/components/Menu/MenuItem/MenuItem.d.ts +2 -9
- package/src/components/Menu/MenuItem/MenuItem.variants.d.ts +9 -10
- package/src/components/Tooltip/Tooltip.d.ts +1 -1
- package/src/components/Tooltip/Tooltip.variants.d.ts +1 -1
package/index.cjs.js
CHANGED
|
@@ -50,25 +50,6 @@ const docs = {
|
|
|
50
50
|
},
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
* Utility for common props on containers.
|
|
55
|
-
*
|
|
56
|
-
* @param {UseContainerProps} ContainerProps - Props for the utility
|
|
57
|
-
* @param {string} ContainerProps.className - Optional custom className
|
|
58
|
-
* @param {string} ContainerProps.dataTestId - Optional custom data-TestId
|
|
59
|
-
* @returns {UseContainerProps} - Object with undefined values removed
|
|
60
|
-
*/
|
|
61
|
-
const useContainerProps = ({ className, dataTestId }) => {
|
|
62
|
-
const containerProps = { className, "data-testid": dataTestId };
|
|
63
|
-
if (containerProps["data-testid"] === undefined) {
|
|
64
|
-
delete containerProps["data-testid"];
|
|
65
|
-
}
|
|
66
|
-
if (containerProps.className === undefined) {
|
|
67
|
-
delete containerProps.className;
|
|
68
|
-
}
|
|
69
|
-
return containerProps;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
53
|
const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-grid", "relative"], {
|
|
73
54
|
variants: {
|
|
74
55
|
color: {
|
|
@@ -862,13 +843,11 @@ const initLocalStorageState = ({ key, defaultState, schema, }) => {
|
|
|
862
843
|
if (!localStorageItem) {
|
|
863
844
|
return defaultState;
|
|
864
845
|
}
|
|
865
|
-
const
|
|
866
|
-
if (schema) {
|
|
867
|
-
return
|
|
868
|
-
}
|
|
869
|
-
else {
|
|
870
|
-
return parsedState;
|
|
846
|
+
const localStorageItemJSON = JSON.parse(localStorageItem);
|
|
847
|
+
if (!schema) {
|
|
848
|
+
return localStorageItemJSON;
|
|
871
849
|
}
|
|
850
|
+
return validateState({ state: localStorageItemJSON, defaultState, schema });
|
|
872
851
|
};
|
|
873
852
|
|
|
874
853
|
/**
|
|
@@ -3694,7 +3673,7 @@ const PopoverTrigger = React.forwardRef(function PopoverTrigger({ children, rend
|
|
|
3694
3673
|
}
|
|
3695
3674
|
});
|
|
3696
3675
|
|
|
3697
|
-
const
|
|
3676
|
+
const cvaTooltipContainer = cssClassVarianceUtilities.cvaMerge(["inline-flex"]);
|
|
3698
3677
|
const cvaTooltipIcon = cssClassVarianceUtilities.cvaMerge(["flex", "h-max", "w-fit", "text-slate-300", "transition", "hover:cursor-pointer", "hover:text-slate-400"], {
|
|
3699
3678
|
variants: {
|
|
3700
3679
|
color: {
|
|
@@ -3710,18 +3689,18 @@ const cvaTooltipPopover = cssClassVarianceUtilities.cvaMerge(["pointer-events-no
|
|
|
3710
3689
|
const cvaTooltipPopoverTail = cssClassVarianceUtilities.cvaMerge("", {
|
|
3711
3690
|
variants: {
|
|
3712
3691
|
placement: {
|
|
3713
|
-
top: "
|
|
3714
|
-
"top-start": "
|
|
3715
|
-
"top-end": "
|
|
3692
|
+
top: "left-2/4 top-full ml-[-5px]",
|
|
3693
|
+
"top-start": "left-[5%] top-full",
|
|
3694
|
+
"top-end": "right-[5%] top-full",
|
|
3716
3695
|
bottom: "bottom-full right-2/4 mr-[-6px] ",
|
|
3717
3696
|
"bottom-start": "bottom-full left-[5%]",
|
|
3718
3697
|
"bottom-end": "bottom-full right-[5%]",
|
|
3719
|
-
left: "top-2/4
|
|
3720
|
-
"left-start": "top-
|
|
3721
|
-
"left-end": "bottom-
|
|
3722
|
-
right: "top-2/4
|
|
3723
|
-
"right-start": "top-
|
|
3724
|
-
"right-end": "bottom-
|
|
3698
|
+
left: "left-full top-2/4 mt-[-6px]",
|
|
3699
|
+
"left-start": "top-[8%]",
|
|
3700
|
+
"left-end": "bottom-[8%]",
|
|
3701
|
+
right: "right-full top-2/4 mt-[-6px] ",
|
|
3702
|
+
"right-start": "top-[8%]",
|
|
3703
|
+
"right-end": "bottom-[8%]",
|
|
3725
3704
|
},
|
|
3726
3705
|
mode: {
|
|
3727
3706
|
light: "fill-white",
|
|
@@ -3767,7 +3746,7 @@ const FloatingArrowContainer = ({ arrowRef, mode = "dark", }) => {
|
|
|
3767
3746
|
* @param {TooltipProps} props - The props for the Tooltip component
|
|
3768
3747
|
* @returns {JSX.Element} Tooltip component
|
|
3769
3748
|
*/
|
|
3770
|
-
const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label, placement = "auto", mode = "dark", iconProps, }) => {
|
|
3749
|
+
const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label, placement = "auto", mode = "dark", iconProps, id, }) => {
|
|
3771
3750
|
const [isOpen, setIsOpen] = React__namespace.useState(false);
|
|
3772
3751
|
const arrowRef = React__namespace.useRef(null);
|
|
3773
3752
|
const { refs, floatingStyles, context } = react.useFloating({
|
|
@@ -3778,11 +3757,10 @@ const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label
|
|
|
3778
3757
|
whileElementsMounted: react.autoUpdate,
|
|
3779
3758
|
});
|
|
3780
3759
|
const { isMounted } = react.useTransitionStatus(context);
|
|
3781
|
-
const wrappedChildren = (jsxRuntime.jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-parent` : null, children: children }));
|
|
3782
3760
|
if (disabled) {
|
|
3783
|
-
return
|
|
3761
|
+
return children;
|
|
3784
3762
|
}
|
|
3785
|
-
return (jsxRuntime.jsxs(Popover, { activation: { hover: true }, className: cvaTooltipPopover(), dataTestId: dataTestId, placement: placement === "auto" ? "bottom" : placement, children: [jsxRuntime.jsx(PopoverTrigger, { className: cvaTooltipIcon({ color: mode, className }), "data-testid": dataTestId ? `${dataTestId}-trigger` : null, onMouseEnter: () => setIsOpen(true), onMouseLeave: () => setIsOpen(false), ref: refs.setReference, children: children === undefined ? (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Icon, { dataTestId: dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...iconProps }) })) : (
|
|
3763
|
+
return (jsxRuntime.jsxs(Popover, { activation: { hover: true }, className: cvaTooltipPopover(), dataTestId: dataTestId, id: id, placement: placement === "auto" ? "bottom" : placement, children: [jsxRuntime.jsx(PopoverTrigger, { className: cvaTooltipIcon({ color: mode, className }), "data-testid": dataTestId ? `${dataTestId}-trigger` : null, onMouseEnter: () => setIsOpen(true), onMouseLeave: () => setIsOpen(false), ref: refs.setReference, children: children === undefined ? (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Icon, { dataTestId: dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...iconProps }) })) : (jsxRuntime.jsx("span", { className: cvaTooltipContainer(), "data-testid": dataTestId ? `${dataTestId}-parent` : undefined, children: children })) }), isMounted ? (jsxRuntime.jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsxs("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipPopoverContent({ color: mode }), "data-testid": `${dataTestId}-content`, children: [jsxRuntime.jsx(Text, { inverted: mode === "dark", type: typeof label === "string" ? "p" : "span", children: label }), placement !== "auto" && jsxRuntime.jsx(FloatingArrowContainer, { arrowRef: arrowRef, mode: mode })] }) }) })) : null] }));
|
|
3786
3764
|
};
|
|
3787
3765
|
|
|
3788
3766
|
const cvaIndicator = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
|
|
@@ -3944,76 +3922,58 @@ const KPICard = ({ asChild = false, title, value, loading, unit, iconName, iconB
|
|
|
3944
3922
|
};
|
|
3945
3923
|
|
|
3946
3924
|
/**
|
|
3947
|
-
*
|
|
3948
|
-
* To be used for elements that do not have typical interactive roles and behaviors, such as divs, table rows, cards etc.
|
|
3925
|
+
* Applies standardized interaction-related styles to an element.
|
|
3949
3926
|
*
|
|
3950
|
-
*
|
|
3927
|
+
* Prefer using the "auto" settings — only resort to manual control if necessary!
|
|
3928
|
+
* - selected: "auto" will apply styling when it contains a `checked` input aka. `:has(:checked)`.
|
|
3929
|
+
* - focused: "auto" will apply styling when the element or it's children has focus aka. `:focus-within`.
|
|
3951
3930
|
*
|
|
3952
|
-
*
|
|
3931
|
+
* To be used for elements that do not have typical interactive roles and behaviors,
|
|
3932
|
+
* such as divs, table rows, cards etc.
|
|
3933
|
+
*
|
|
3934
|
+
* To not be used for buttons, links, or other elements that have their own intrinsic interactive roles.
|
|
3935
|
+
*
|
|
3936
|
+
* @returns tailwind class names on the basis on the provided props.
|
|
3953
3937
|
*/
|
|
3954
|
-
const cvaInteractableItem = cssClassVarianceUtilities.cvaMerge(
|
|
3938
|
+
const cvaInteractableItem = cssClassVarianceUtilities.cvaMerge("", {
|
|
3955
3939
|
variants: {
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3940
|
+
cursor: {
|
|
3941
|
+
pointer: "cursor-pointer",
|
|
3942
|
+
auto: "cursor-auto",
|
|
3943
|
+
help: "cursor-help",
|
|
3944
|
+
"zoom-in": "cursor-zoom-in",
|
|
3945
|
+
"zoom-out": "cursor-zoom-out",
|
|
3946
|
+
default: "cursor-default",
|
|
3947
|
+
"not-allowed": "cursor-not-allowed",
|
|
3959
3948
|
},
|
|
3960
3949
|
selected: {
|
|
3961
|
-
true: "bg-primary-600/[.08] hover:bg-primary-600/[.12]
|
|
3950
|
+
true: ["bg-primary-600/[.08]", "hover:bg-primary-600/[.12]", "focus-within:bg-primary-600/[.12]"],
|
|
3962
3951
|
false: "",
|
|
3952
|
+
auto: [
|
|
3953
|
+
"has-[:checked]:bg-primary-600/[.08]",
|
|
3954
|
+
"hover:has-[:checked]:bg-primary-600/[.12]",
|
|
3955
|
+
"focus-within:has-[:checked]:bg-primary-600/[.12]",
|
|
3956
|
+
],
|
|
3963
3957
|
},
|
|
3964
3958
|
disabled: {
|
|
3965
|
-
true: "pointer-events-none !bg-neutral-100",
|
|
3966
|
-
false: "",
|
|
3959
|
+
true: ["pointer-events-none", "!bg-neutral-100", "!cursor-not-allowed"],
|
|
3960
|
+
false: ["hover:bg-neutral-600/5", "focus-within:bg-neutral-600/5"],
|
|
3967
3961
|
},
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
// used in compound variant below since it depends on other conditions to be applied
|
|
3971
|
-
true: "",
|
|
3962
|
+
focused: {
|
|
3963
|
+
true: "outline-native",
|
|
3972
3964
|
false: "",
|
|
3965
|
+
auto: "[&:has(:focus-visible)]:outline-native",
|
|
3973
3966
|
},
|
|
3974
3967
|
},
|
|
3975
|
-
compoundVariants: [
|
|
3976
|
-
{
|
|
3977
|
-
disabled: false,
|
|
3978
|
-
selected: false,
|
|
3979
|
-
className: "hover:bg-neutral-600/5 focus-visible:bg-neutral-600/5 [&:has(:focus-visible)]:bg-neutral-600/5",
|
|
3980
|
-
},
|
|
3981
|
-
{
|
|
3982
|
-
disabled: false,
|
|
3983
|
-
focusRing: true,
|
|
3984
|
-
className:
|
|
3985
|
-
// focus-visible is a pseudo-class that is used to style an element when it is focused, and the user is navigating using the keyboard.
|
|
3986
|
-
// here we are targeting the parent element of the focus-visible element (so the parent containing a checkbox or radio button)
|
|
3987
|
-
"[&:has(:focus-visible)]:ring-primary-700 focus-visible:ring-primary-700 focus-visible:ring-2 focus-visible:ring-inset [&:has(:focus-visible)]:ring-2 [&:has(:focus-visible)]:ring-inset",
|
|
3988
|
-
},
|
|
3989
|
-
],
|
|
3990
3968
|
defaultVariants: {
|
|
3991
|
-
|
|
3992
|
-
selected:
|
|
3969
|
+
cursor: "auto",
|
|
3970
|
+
selected: "auto",
|
|
3993
3971
|
disabled: false,
|
|
3994
|
-
|
|
3972
|
+
focused: "auto",
|
|
3995
3973
|
},
|
|
3996
3974
|
});
|
|
3997
3975
|
|
|
3998
|
-
|
|
3999
|
-
* Extends the cvaInteractableItem variant in order to set the padding, width, height, cursor, and other styles particular to the MenuItem component.
|
|
4000
|
-
* The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
|
|
4001
|
-
*/
|
|
4002
|
-
const cvaMenuItem = ({ size, selected, disabled, focusRing, className } = {}) => tailwindMerge.twMerge(cvaMenuItemStyle({ size }), cvaInteractableItem({ selected, disabled, showPointer: true, focusRing }), className);
|
|
4003
|
-
const cvaMenuItemStyle = cssClassVarianceUtilities.cvaMerge([
|
|
4004
|
-
"py-2",
|
|
4005
|
-
"pl-2",
|
|
4006
|
-
"pr-3",
|
|
4007
|
-
"w-full",
|
|
4008
|
-
"h-auto",
|
|
4009
|
-
"cursor-pointer",
|
|
4010
|
-
"flex",
|
|
4011
|
-
"flex-row",
|
|
4012
|
-
"items-center",
|
|
4013
|
-
"gap-x-2",
|
|
4014
|
-
"select-none",
|
|
4015
|
-
"rounded",
|
|
4016
|
-
], {
|
|
3976
|
+
const cvaMenuItemStyle = cssClassVarianceUtilities.cvaMerge(["py-2", "pl-2", "pr-3", "w-full", "h-auto", "flex", "flex-row", "items-center", "gap-x-2", "select-none", "rounded"], {
|
|
4017
3977
|
variants: {
|
|
4018
3978
|
size: {
|
|
4019
3979
|
small: "py-1",
|
|
@@ -4021,6 +3981,14 @@ const cvaMenuItemStyle = cssClassVarianceUtilities.cvaMerge([
|
|
|
4021
3981
|
},
|
|
4022
3982
|
},
|
|
4023
3983
|
});
|
|
3984
|
+
/**
|
|
3985
|
+
* Extends the cvaInteractableItem variant in order to set the padding, width, height, cursor, and other styles particular to the MenuItem component.
|
|
3986
|
+
* The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
|
|
3987
|
+
*/
|
|
3988
|
+
const cvaMenuItem = (props) => {
|
|
3989
|
+
const { size, selected, disabled, focused, className } = props !== null && props !== void 0 ? props : {};
|
|
3990
|
+
return tailwindMerge.twMerge(cvaMenuItemStyle({ size }), cvaInteractableItem({ selected, disabled, cursor: "pointer", focused }), className);
|
|
3991
|
+
};
|
|
4024
3992
|
const cvaMenuItemLabel = cssClassVarianceUtilities.cvaMerge([
|
|
4025
3993
|
"flex-grow",
|
|
4026
3994
|
"text-gray-700",
|
|
@@ -4029,7 +3997,7 @@ const cvaMenuItemLabel = cssClassVarianceUtilities.cvaMerge([
|
|
|
4029
3997
|
"group-hover:text-gray-900",
|
|
4030
3998
|
"group-active:text-gray-700",
|
|
4031
3999
|
]);
|
|
4032
|
-
const cvaMenuItemSuffix = cssClassVarianceUtilities.cvaMerge(["self-center", "flex-grow-0", "text-slate-400"], {
|
|
4000
|
+
const cvaMenuItemSuffix = cssClassVarianceUtilities.cvaMerge(["self-center", "flex-grow-0", "text-slate-400", "text-sm"], {
|
|
4033
4001
|
variants: {
|
|
4034
4002
|
selected: {
|
|
4035
4003
|
true: "text-primary-600 hover:text-primary-700",
|
|
@@ -4037,7 +4005,7 @@ const cvaMenuItemSuffix = cssClassVarianceUtilities.cvaMerge(["self-center", "fl
|
|
|
4037
4005
|
},
|
|
4038
4006
|
},
|
|
4039
4007
|
});
|
|
4040
|
-
const cvaMenuItemPrefix = cssClassVarianceUtilities.cvaMerge(["self-center", "flex-grow-0", "text-slate-400", "group-hover:text-slate-600", "h-min", "leading-[0]"], {
|
|
4008
|
+
const cvaMenuItemPrefix = cssClassVarianceUtilities.cvaMerge(["self-center", "flex-grow-0", "text-slate-400", "group-hover:text-slate-600", "h-min", "leading-[0]", "text-sm"], {
|
|
4041
4009
|
variants: {
|
|
4042
4010
|
selected: {
|
|
4043
4011
|
true: "text-primary-600 hover:text-primary-700",
|
|
@@ -4052,25 +4020,23 @@ const cvaMenuItemPrefix = cssClassVarianceUtilities.cvaMerge(["self-center", "fl
|
|
|
4052
4020
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
4053
4021
|
* @returns {JSX.Element} MenuItem component
|
|
4054
4022
|
*/
|
|
4055
|
-
const MenuItem = ({ className, dataTestId, label, size, children, selected,
|
|
4056
|
-
|
|
4057
|
-
return (jsxRuntime.jsxs("div", { ...containerProps, className: cvaMenuItem({
|
|
4023
|
+
const MenuItem = ({ className, dataTestId, label, size, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, }) => {
|
|
4024
|
+
return (jsxRuntime.jsxs("div", { className: cvaMenuItem({
|
|
4058
4025
|
selected,
|
|
4059
4026
|
disabled,
|
|
4060
|
-
focusRing,
|
|
4061
4027
|
size,
|
|
4062
|
-
className
|
|
4063
|
-
}), id: id, onClick: e => {
|
|
4028
|
+
className,
|
|
4029
|
+
}), "data-testid": dataTestId !== null && dataTestId !== void 0 ? dataTestId : "menu-item", id: id, onClick: e => {
|
|
4064
4030
|
stopPropagation && e.stopPropagation();
|
|
4065
|
-
onClick
|
|
4031
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
4066
4032
|
}, tabIndex: tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0, children: [prefix ? (jsxRuntime.jsx("div", { className: cvaMenuItemPrefix({ selected }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsxRuntime.jsx("div", { className: cvaMenuItemLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : null, children: children !== null && children !== void 0 ? children : label })), suffix ? (jsxRuntime.jsx("div", { className: cvaMenuItemSuffix({ selected }), "data-testid": dataTestId ? `${dataTestId}-suffix` : null, children: suffix })) : null] }));
|
|
4067
4033
|
};
|
|
4068
4034
|
|
|
4069
|
-
const cvaMenuList = cssClassVarianceUtilities.cvaMerge(["shadow-md", "rounded-lg", "z-20", "bg-white", "
|
|
4035
|
+
const cvaMenuList = cssClassVarianceUtilities.cvaMerge(["shadow-md", "rounded-lg", "z-20", "bg-white", "border", "border-slate-300", "grid"], {
|
|
4070
4036
|
variants: {
|
|
4071
4037
|
stickyHeader: {
|
|
4072
|
-
true: "grid-rows-min-fr grid overflow-y-hidden
|
|
4073
|
-
false: "",
|
|
4038
|
+
true: "grid-rows-min-fr grid overflow-y-hidden p-0",
|
|
4039
|
+
false: "p-1",
|
|
4074
4040
|
},
|
|
4075
4041
|
},
|
|
4076
4042
|
});
|
|
@@ -5004,7 +4970,6 @@ exports.iconColorNames = iconColorNames;
|
|
|
5004
4970
|
exports.iconPalette = iconPalette;
|
|
5005
4971
|
exports.setLocalStorage = setLocalStorage;
|
|
5006
4972
|
exports.useClickOutside = useClickOutside;
|
|
5007
|
-
exports.useContainerProps = useContainerProps;
|
|
5008
4973
|
exports.useContinuousTimeout = useContinuousTimeout;
|
|
5009
4974
|
exports.useDebounce = useDebounce;
|
|
5010
4975
|
exports.useDevicePixelRatio = useDevicePixelRatio;
|
package/index.esm.js
CHANGED
|
@@ -30,25 +30,6 @@ const docs = {
|
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* Utility for common props on containers.
|
|
35
|
-
*
|
|
36
|
-
* @param {UseContainerProps} ContainerProps - Props for the utility
|
|
37
|
-
* @param {string} ContainerProps.className - Optional custom className
|
|
38
|
-
* @param {string} ContainerProps.dataTestId - Optional custom data-TestId
|
|
39
|
-
* @returns {UseContainerProps} - Object with undefined values removed
|
|
40
|
-
*/
|
|
41
|
-
const useContainerProps = ({ className, dataTestId }) => {
|
|
42
|
-
const containerProps = { className, "data-testid": dataTestId };
|
|
43
|
-
if (containerProps["data-testid"] === undefined) {
|
|
44
|
-
delete containerProps["data-testid"];
|
|
45
|
-
}
|
|
46
|
-
if (containerProps.className === undefined) {
|
|
47
|
-
delete containerProps.className;
|
|
48
|
-
}
|
|
49
|
-
return containerProps;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
33
|
const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative"], {
|
|
53
34
|
variants: {
|
|
54
35
|
color: {
|
|
@@ -842,13 +823,11 @@ const initLocalStorageState = ({ key, defaultState, schema, }) => {
|
|
|
842
823
|
if (!localStorageItem) {
|
|
843
824
|
return defaultState;
|
|
844
825
|
}
|
|
845
|
-
const
|
|
846
|
-
if (schema) {
|
|
847
|
-
return
|
|
848
|
-
}
|
|
849
|
-
else {
|
|
850
|
-
return parsedState;
|
|
826
|
+
const localStorageItemJSON = JSON.parse(localStorageItem);
|
|
827
|
+
if (!schema) {
|
|
828
|
+
return localStorageItemJSON;
|
|
851
829
|
}
|
|
830
|
+
return validateState({ state: localStorageItemJSON, defaultState, schema });
|
|
852
831
|
};
|
|
853
832
|
|
|
854
833
|
/**
|
|
@@ -3674,7 +3653,7 @@ const PopoverTrigger = forwardRef(function PopoverTrigger({ children, renderButt
|
|
|
3674
3653
|
}
|
|
3675
3654
|
});
|
|
3676
3655
|
|
|
3677
|
-
const
|
|
3656
|
+
const cvaTooltipContainer = cvaMerge(["inline-flex"]);
|
|
3678
3657
|
const cvaTooltipIcon = cvaMerge(["flex", "h-max", "w-fit", "text-slate-300", "transition", "hover:cursor-pointer", "hover:text-slate-400"], {
|
|
3679
3658
|
variants: {
|
|
3680
3659
|
color: {
|
|
@@ -3690,18 +3669,18 @@ const cvaTooltipPopover = cvaMerge(["pointer-events-none", "origin-center"]);
|
|
|
3690
3669
|
const cvaTooltipPopoverTail = cvaMerge("", {
|
|
3691
3670
|
variants: {
|
|
3692
3671
|
placement: {
|
|
3693
|
-
top: "
|
|
3694
|
-
"top-start": "
|
|
3695
|
-
"top-end": "
|
|
3672
|
+
top: "left-2/4 top-full ml-[-5px]",
|
|
3673
|
+
"top-start": "left-[5%] top-full",
|
|
3674
|
+
"top-end": "right-[5%] top-full",
|
|
3696
3675
|
bottom: "bottom-full right-2/4 mr-[-6px] ",
|
|
3697
3676
|
"bottom-start": "bottom-full left-[5%]",
|
|
3698
3677
|
"bottom-end": "bottom-full right-[5%]",
|
|
3699
|
-
left: "top-2/4
|
|
3700
|
-
"left-start": "top-
|
|
3701
|
-
"left-end": "bottom-
|
|
3702
|
-
right: "top-2/4
|
|
3703
|
-
"right-start": "top-
|
|
3704
|
-
"right-end": "bottom-
|
|
3678
|
+
left: "left-full top-2/4 mt-[-6px]",
|
|
3679
|
+
"left-start": "top-[8%]",
|
|
3680
|
+
"left-end": "bottom-[8%]",
|
|
3681
|
+
right: "right-full top-2/4 mt-[-6px] ",
|
|
3682
|
+
"right-start": "top-[8%]",
|
|
3683
|
+
"right-end": "bottom-[8%]",
|
|
3705
3684
|
},
|
|
3706
3685
|
mode: {
|
|
3707
3686
|
light: "fill-white",
|
|
@@ -3747,7 +3726,7 @@ const FloatingArrowContainer = ({ arrowRef, mode = "dark", }) => {
|
|
|
3747
3726
|
* @param {TooltipProps} props - The props for the Tooltip component
|
|
3748
3727
|
* @returns {JSX.Element} Tooltip component
|
|
3749
3728
|
*/
|
|
3750
|
-
const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label, placement = "auto", mode = "dark", iconProps, }) => {
|
|
3729
|
+
const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label, placement = "auto", mode = "dark", iconProps, id, }) => {
|
|
3751
3730
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
3752
3731
|
const arrowRef = React.useRef(null);
|
|
3753
3732
|
const { refs, floatingStyles, context } = useFloating({
|
|
@@ -3758,11 +3737,10 @@ const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label
|
|
|
3758
3737
|
whileElementsMounted: autoUpdate,
|
|
3759
3738
|
});
|
|
3760
3739
|
const { isMounted } = useTransitionStatus(context);
|
|
3761
|
-
const wrappedChildren = (jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-parent` : null, children: children }));
|
|
3762
3740
|
if (disabled) {
|
|
3763
|
-
return
|
|
3741
|
+
return children;
|
|
3764
3742
|
}
|
|
3765
|
-
return (jsxs(Popover, { activation: { hover: true }, className: cvaTooltipPopover(), dataTestId: dataTestId, placement: placement === "auto" ? "bottom" : placement, children: [jsx(PopoverTrigger, { className: cvaTooltipIcon({ color: mode, className }), "data-testid": dataTestId ? `${dataTestId}-trigger` : null, onMouseEnter: () => setIsOpen(true), onMouseLeave: () => setIsOpen(false), ref: refs.setReference, children: children === undefined ? (jsx("div", { children: jsx(Icon, { dataTestId: dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...iconProps }) })) : (
|
|
3743
|
+
return (jsxs(Popover, { activation: { hover: true }, className: cvaTooltipPopover(), dataTestId: dataTestId, id: id, placement: placement === "auto" ? "bottom" : placement, children: [jsx(PopoverTrigger, { className: cvaTooltipIcon({ color: mode, className }), "data-testid": dataTestId ? `${dataTestId}-trigger` : null, onMouseEnter: () => setIsOpen(true), onMouseLeave: () => setIsOpen(false), ref: refs.setReference, children: children === undefined ? (jsx("div", { children: jsx(Icon, { dataTestId: dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...iconProps }) })) : (jsx("span", { className: cvaTooltipContainer(), "data-testid": dataTestId ? `${dataTestId}-parent` : undefined, children: children })) }), isMounted ? (jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsx(PopoverContent, { children: jsxs("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipPopoverContent({ color: mode }), "data-testid": `${dataTestId}-content`, children: [jsx(Text, { inverted: mode === "dark", type: typeof label === "string" ? "p" : "span", children: label }), placement !== "auto" && jsx(FloatingArrowContainer, { arrowRef: arrowRef, mode: mode })] }) }) })) : null] }));
|
|
3766
3744
|
};
|
|
3767
3745
|
|
|
3768
3746
|
const cvaIndicator = cvaMerge(["flex", "items-center"]);
|
|
@@ -3924,76 +3902,58 @@ const KPICard = ({ asChild = false, title, value, loading, unit, iconName, iconB
|
|
|
3924
3902
|
};
|
|
3925
3903
|
|
|
3926
3904
|
/**
|
|
3927
|
-
*
|
|
3928
|
-
* To be used for elements that do not have typical interactive roles and behaviors, such as divs, table rows, cards etc.
|
|
3905
|
+
* Applies standardized interaction-related styles to an element.
|
|
3929
3906
|
*
|
|
3930
|
-
*
|
|
3907
|
+
* Prefer using the "auto" settings — only resort to manual control if necessary!
|
|
3908
|
+
* - selected: "auto" will apply styling when it contains a `checked` input aka. `:has(:checked)`.
|
|
3909
|
+
* - focused: "auto" will apply styling when the element or it's children has focus aka. `:focus-within`.
|
|
3931
3910
|
*
|
|
3932
|
-
*
|
|
3911
|
+
* To be used for elements that do not have typical interactive roles and behaviors,
|
|
3912
|
+
* such as divs, table rows, cards etc.
|
|
3913
|
+
*
|
|
3914
|
+
* To not be used for buttons, links, or other elements that have their own intrinsic interactive roles.
|
|
3915
|
+
*
|
|
3916
|
+
* @returns tailwind class names on the basis on the provided props.
|
|
3933
3917
|
*/
|
|
3934
|
-
const cvaInteractableItem = cvaMerge(
|
|
3918
|
+
const cvaInteractableItem = cvaMerge("", {
|
|
3935
3919
|
variants: {
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3920
|
+
cursor: {
|
|
3921
|
+
pointer: "cursor-pointer",
|
|
3922
|
+
auto: "cursor-auto",
|
|
3923
|
+
help: "cursor-help",
|
|
3924
|
+
"zoom-in": "cursor-zoom-in",
|
|
3925
|
+
"zoom-out": "cursor-zoom-out",
|
|
3926
|
+
default: "cursor-default",
|
|
3927
|
+
"not-allowed": "cursor-not-allowed",
|
|
3939
3928
|
},
|
|
3940
3929
|
selected: {
|
|
3941
|
-
true: "bg-primary-600/[.08] hover:bg-primary-600/[.12]
|
|
3930
|
+
true: ["bg-primary-600/[.08]", "hover:bg-primary-600/[.12]", "focus-within:bg-primary-600/[.12]"],
|
|
3942
3931
|
false: "",
|
|
3932
|
+
auto: [
|
|
3933
|
+
"has-[:checked]:bg-primary-600/[.08]",
|
|
3934
|
+
"hover:has-[:checked]:bg-primary-600/[.12]",
|
|
3935
|
+
"focus-within:has-[:checked]:bg-primary-600/[.12]",
|
|
3936
|
+
],
|
|
3943
3937
|
},
|
|
3944
3938
|
disabled: {
|
|
3945
|
-
true: "pointer-events-none !bg-neutral-100",
|
|
3946
|
-
false: "",
|
|
3939
|
+
true: ["pointer-events-none", "!bg-neutral-100", "!cursor-not-allowed"],
|
|
3940
|
+
false: ["hover:bg-neutral-600/5", "focus-within:bg-neutral-600/5"],
|
|
3947
3941
|
},
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
// used in compound variant below since it depends on other conditions to be applied
|
|
3951
|
-
true: "",
|
|
3942
|
+
focused: {
|
|
3943
|
+
true: "outline-native",
|
|
3952
3944
|
false: "",
|
|
3945
|
+
auto: "[&:has(:focus-visible)]:outline-native",
|
|
3953
3946
|
},
|
|
3954
3947
|
},
|
|
3955
|
-
compoundVariants: [
|
|
3956
|
-
{
|
|
3957
|
-
disabled: false,
|
|
3958
|
-
selected: false,
|
|
3959
|
-
className: "hover:bg-neutral-600/5 focus-visible:bg-neutral-600/5 [&:has(:focus-visible)]:bg-neutral-600/5",
|
|
3960
|
-
},
|
|
3961
|
-
{
|
|
3962
|
-
disabled: false,
|
|
3963
|
-
focusRing: true,
|
|
3964
|
-
className:
|
|
3965
|
-
// focus-visible is a pseudo-class that is used to style an element when it is focused, and the user is navigating using the keyboard.
|
|
3966
|
-
// here we are targeting the parent element of the focus-visible element (so the parent containing a checkbox or radio button)
|
|
3967
|
-
"[&:has(:focus-visible)]:ring-primary-700 focus-visible:ring-primary-700 focus-visible:ring-2 focus-visible:ring-inset [&:has(:focus-visible)]:ring-2 [&:has(:focus-visible)]:ring-inset",
|
|
3968
|
-
},
|
|
3969
|
-
],
|
|
3970
3948
|
defaultVariants: {
|
|
3971
|
-
|
|
3972
|
-
selected:
|
|
3949
|
+
cursor: "auto",
|
|
3950
|
+
selected: "auto",
|
|
3973
3951
|
disabled: false,
|
|
3974
|
-
|
|
3952
|
+
focused: "auto",
|
|
3975
3953
|
},
|
|
3976
3954
|
});
|
|
3977
3955
|
|
|
3978
|
-
|
|
3979
|
-
* Extends the cvaInteractableItem variant in order to set the padding, width, height, cursor, and other styles particular to the MenuItem component.
|
|
3980
|
-
* The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
|
|
3981
|
-
*/
|
|
3982
|
-
const cvaMenuItem = ({ size, selected, disabled, focusRing, className } = {}) => twMerge(cvaMenuItemStyle({ size }), cvaInteractableItem({ selected, disabled, showPointer: true, focusRing }), className);
|
|
3983
|
-
const cvaMenuItemStyle = cvaMerge([
|
|
3984
|
-
"py-2",
|
|
3985
|
-
"pl-2",
|
|
3986
|
-
"pr-3",
|
|
3987
|
-
"w-full",
|
|
3988
|
-
"h-auto",
|
|
3989
|
-
"cursor-pointer",
|
|
3990
|
-
"flex",
|
|
3991
|
-
"flex-row",
|
|
3992
|
-
"items-center",
|
|
3993
|
-
"gap-x-2",
|
|
3994
|
-
"select-none",
|
|
3995
|
-
"rounded",
|
|
3996
|
-
], {
|
|
3956
|
+
const cvaMenuItemStyle = cvaMerge(["py-2", "pl-2", "pr-3", "w-full", "h-auto", "flex", "flex-row", "items-center", "gap-x-2", "select-none", "rounded"], {
|
|
3997
3957
|
variants: {
|
|
3998
3958
|
size: {
|
|
3999
3959
|
small: "py-1",
|
|
@@ -4001,6 +3961,14 @@ const cvaMenuItemStyle = cvaMerge([
|
|
|
4001
3961
|
},
|
|
4002
3962
|
},
|
|
4003
3963
|
});
|
|
3964
|
+
/**
|
|
3965
|
+
* Extends the cvaInteractableItem variant in order to set the padding, width, height, cursor, and other styles particular to the MenuItem component.
|
|
3966
|
+
* The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
|
|
3967
|
+
*/
|
|
3968
|
+
const cvaMenuItem = (props) => {
|
|
3969
|
+
const { size, selected, disabled, focused, className } = props !== null && props !== void 0 ? props : {};
|
|
3970
|
+
return twMerge(cvaMenuItemStyle({ size }), cvaInteractableItem({ selected, disabled, cursor: "pointer", focused }), className);
|
|
3971
|
+
};
|
|
4004
3972
|
const cvaMenuItemLabel = cvaMerge([
|
|
4005
3973
|
"flex-grow",
|
|
4006
3974
|
"text-gray-700",
|
|
@@ -4009,7 +3977,7 @@ const cvaMenuItemLabel = cvaMerge([
|
|
|
4009
3977
|
"group-hover:text-gray-900",
|
|
4010
3978
|
"group-active:text-gray-700",
|
|
4011
3979
|
]);
|
|
4012
|
-
const cvaMenuItemSuffix = cvaMerge(["self-center", "flex-grow-0", "text-slate-400"], {
|
|
3980
|
+
const cvaMenuItemSuffix = cvaMerge(["self-center", "flex-grow-0", "text-slate-400", "text-sm"], {
|
|
4013
3981
|
variants: {
|
|
4014
3982
|
selected: {
|
|
4015
3983
|
true: "text-primary-600 hover:text-primary-700",
|
|
@@ -4017,7 +3985,7 @@ const cvaMenuItemSuffix = cvaMerge(["self-center", "flex-grow-0", "text-slate-40
|
|
|
4017
3985
|
},
|
|
4018
3986
|
},
|
|
4019
3987
|
});
|
|
4020
|
-
const cvaMenuItemPrefix = cvaMerge(["self-center", "flex-grow-0", "text-slate-400", "group-hover:text-slate-600", "h-min", "leading-[0]"], {
|
|
3988
|
+
const cvaMenuItemPrefix = cvaMerge(["self-center", "flex-grow-0", "text-slate-400", "group-hover:text-slate-600", "h-min", "leading-[0]", "text-sm"], {
|
|
4021
3989
|
variants: {
|
|
4022
3990
|
selected: {
|
|
4023
3991
|
true: "text-primary-600 hover:text-primary-700",
|
|
@@ -4032,25 +4000,23 @@ const cvaMenuItemPrefix = cvaMerge(["self-center", "flex-grow-0", "text-slate-40
|
|
|
4032
4000
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
4033
4001
|
* @returns {JSX.Element} MenuItem component
|
|
4034
4002
|
*/
|
|
4035
|
-
const MenuItem = ({ className, dataTestId, label, size, children, selected,
|
|
4036
|
-
|
|
4037
|
-
return (jsxs("div", { ...containerProps, className: cvaMenuItem({
|
|
4003
|
+
const MenuItem = ({ className, dataTestId, label, size, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, }) => {
|
|
4004
|
+
return (jsxs("div", { className: cvaMenuItem({
|
|
4038
4005
|
selected,
|
|
4039
4006
|
disabled,
|
|
4040
|
-
focusRing,
|
|
4041
4007
|
size,
|
|
4042
|
-
className
|
|
4043
|
-
}), id: id, onClick: e => {
|
|
4008
|
+
className,
|
|
4009
|
+
}), "data-testid": dataTestId !== null && dataTestId !== void 0 ? dataTestId : "menu-item", id: id, onClick: e => {
|
|
4044
4010
|
stopPropagation && e.stopPropagation();
|
|
4045
|
-
onClick
|
|
4011
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
4046
4012
|
}, tabIndex: tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0, children: [prefix ? (jsx("div", { className: cvaMenuItemPrefix({ selected }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsx("div", { className: cvaMenuItemLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : null, children: children !== null && children !== void 0 ? children : label })), suffix ? (jsx("div", { className: cvaMenuItemSuffix({ selected }), "data-testid": dataTestId ? `${dataTestId}-suffix` : null, children: suffix })) : null] }));
|
|
4047
4013
|
};
|
|
4048
4014
|
|
|
4049
|
-
const cvaMenuList = cvaMerge(["shadow-md", "rounded-lg", "z-20", "bg-white", "
|
|
4015
|
+
const cvaMenuList = cvaMerge(["shadow-md", "rounded-lg", "z-20", "bg-white", "border", "border-slate-300", "grid"], {
|
|
4050
4016
|
variants: {
|
|
4051
4017
|
stickyHeader: {
|
|
4052
|
-
true: "grid-rows-min-fr grid overflow-y-hidden
|
|
4053
|
-
false: "",
|
|
4018
|
+
true: "grid-rows-min-fr grid overflow-y-hidden p-0",
|
|
4019
|
+
false: "p-1",
|
|
4054
4020
|
},
|
|
4055
4021
|
},
|
|
4056
4022
|
});
|
|
@@ -4903,4 +4869,4 @@ const cvaClickable = cvaMerge([
|
|
|
4903
4869
|
},
|
|
4904
4870
|
});
|
|
4905
4871
|
|
|
4906
|
-
export { Alert, Badge, Breadcrumb, BreadcrumbContainer, BreadcrumbItem, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CompletionStatusIndicator, CopyableText, Drawer, EmptyState, EmptyValue, ExternalLink, Heading, Icon, IconButton, Indicator, KPICard, MenuItem, MenuList, MoreMenu, Notice, PackageNameStoryComponent, Page, PageContent, PageHeader, Pagination, Polygon, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, Timeline, TimelineElement, ToggleGroup, Tooltip, ValueBar, VirtualizedList, WidgetBody, cvaButton, cvaButtonPrefixSuffix, cvaButtonSpinner, cvaButtonSpinnerContainer, cvaClickable, cvaIconButton, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaInteractableItem, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemStyle, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside,
|
|
4872
|
+
export { Alert, Badge, Breadcrumb, BreadcrumbContainer, BreadcrumbItem, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CompletionStatusIndicator, CopyableText, Drawer, EmptyState, EmptyValue, ExternalLink, Heading, Icon, IconButton, Indicator, KPICard, MenuItem, MenuList, MoreMenu, Notice, PackageNameStoryComponent, Page, PageContent, PageHeader, Pagination, Polygon, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, Timeline, TimelineElement, ToggleGroup, Tooltip, ValueBar, VirtualizedList, WidgetBody, cvaButton, cvaButtonPrefixSuffix, cvaButtonSpinner, cvaButtonSpinnerContainer, cvaClickable, cvaIconButton, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaInteractableItem, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemStyle, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContinuousTimeout, useDebounce, useDevicePixelRatio, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useOptionallyElevatedState, useOverflowItems, usePopoverContext, usePrompt, useResize, useSelfUpdatingRef, useTimeout, useWindowActivity };
|
package/package.json
CHANGED
package/src/common/index.d.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* To be used for elements that do not have typical interactive roles and behaviors, such as divs, table rows, cards etc.
|
|
2
|
+
* Applies standardized interaction-related styles to an element.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
4
|
+
* Prefer using the "auto" settings — only resort to manual control if necessary!
|
|
5
|
+
* - selected: "auto" will apply styling when it contains a `checked` input aka. `:has(:checked)`.
|
|
6
|
+
* - focused: "auto" will apply styling when the element or it's children has focus aka. `:focus-within`.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
+
* To be used for elements that do not have typical interactive roles and behaviors,
|
|
9
|
+
* such as divs, table rows, cards etc.
|
|
10
|
+
*
|
|
11
|
+
* To not be used for buttons, links, or other elements that have their own intrinsic interactive roles.
|
|
12
|
+
*
|
|
13
|
+
* @returns tailwind class names on the basis on the provided props.
|
|
8
14
|
*/
|
|
9
15
|
export declare const cvaInteractableItem: (props?: ({
|
|
10
|
-
|
|
11
|
-
selected?: boolean | null | undefined;
|
|
16
|
+
cursor?: "default" | "pointer" | "auto" | "help" | "zoom-in" | "zoom-out" | "not-allowed" | null | undefined;
|
|
17
|
+
selected?: boolean | "auto" | null | undefined;
|
|
12
18
|
disabled?: boolean | null | undefined;
|
|
13
|
-
|
|
19
|
+
focused?: boolean | "auto" | null | undefined;
|
|
14
20
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -27,7 +27,7 @@ export interface MenuItemProps extends CommonProps {
|
|
|
27
27
|
* This is typically used to render an icon.
|
|
28
28
|
*
|
|
29
29
|
*/
|
|
30
|
-
suffix?:
|
|
30
|
+
suffix?: React.ReactNode;
|
|
31
31
|
/**
|
|
32
32
|
* An boolean flag to turn on/off selected state
|
|
33
33
|
* This is typically used highlight that item is selected
|
|
@@ -41,13 +41,6 @@ export interface MenuItemProps extends CommonProps {
|
|
|
41
41
|
* @memberof MenuItemProps
|
|
42
42
|
*/
|
|
43
43
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
44
|
-
/**
|
|
45
|
-
* An boolean flag to turn on/off focus rings
|
|
46
|
-
* This is used for keyboard navigation
|
|
47
|
-
*
|
|
48
|
-
* @memberof MenuItemProps
|
|
49
|
-
*/
|
|
50
|
-
focusRing?: boolean;
|
|
51
44
|
/**
|
|
52
45
|
* A boolean prop to set menu item to disabled state
|
|
53
46
|
* used in disabled select options
|
|
@@ -66,5 +59,5 @@ export interface MenuItemProps extends CommonProps {
|
|
|
66
59
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
67
60
|
* @returns {JSX.Element} MenuItem component
|
|
68
61
|
*/
|
|
69
|
-
export declare const MenuItem: ({ className, dataTestId, label, size, children, selected,
|
|
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;
|
|
70
63
|
export {};
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { type VariantProps } from "@trackunit/css-class-variance-utilities";
|
|
2
|
+
import { MappedOmit } from "@trackunit/shared-utils";
|
|
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;
|
|
7
|
+
type CvaMenuItemProps = Partial<MappedOmit<VariantProps<typeof cvaInteractableItem>, "cursor">> & {
|
|
2
8
|
size?: "small" | "medium";
|
|
3
|
-
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
focusRing?: boolean;
|
|
6
|
-
className?: string;
|
|
7
|
-
}
|
|
9
|
+
};
|
|
8
10
|
/**
|
|
9
11
|
* Extends the cvaInteractableItem variant in order to set the padding, width, height, cursor, and other styles particular to the MenuItem component.
|
|
10
12
|
* The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
|
|
11
13
|
*/
|
|
12
|
-
export declare const cvaMenuItem: (
|
|
13
|
-
export declare const cvaMenuItemStyle: (props?: ({
|
|
14
|
-
size?: "small" | "medium" | null | undefined;
|
|
15
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
14
|
+
export declare const cvaMenuItem: (props?: CvaMenuItemProps) => string;
|
|
16
15
|
export declare const cvaMenuItemLabel: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
17
16
|
export declare const cvaMenuItemSuffix: (props?: ({
|
|
18
17
|
selected?: boolean | null | undefined;
|
|
@@ -42,4 +42,4 @@ export interface TooltipProps extends CommonProps {
|
|
|
42
42
|
* @param {TooltipProps} props - The props for the Tooltip component
|
|
43
43
|
* @returns {JSX.Element} Tooltip component
|
|
44
44
|
*/
|
|
45
|
-
export declare const Tooltip: ({ children, dataTestId, disabled, className, label, placement, mode, iconProps, }: TooltipProps) =>
|
|
45
|
+
export declare const Tooltip: ({ children, dataTestId, disabled, className, label, placement, mode, iconProps, id, }: TooltipProps) => React.ReactNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const cvaTooltipContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
2
|
export declare const cvaTooltipIcon: (props?: ({
|
|
3
3
|
color?: "light" | "dark" | null | undefined;
|
|
4
4
|
defaultVariants?: "color" | null | undefined;
|