@trackunit/react-components 0.1.146 → 0.1.148
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 +67 -34
- package/index.esm.js +66 -35
- package/package.json +1 -1
- package/src/hooks/index.d.ts +2 -0
- package/src/hooks/localStorage/setLocalStorage.d.ts +11 -0
- package/src/hooks/useVisibilityChange.d.ts +10 -0
package/index.cjs.js
CHANGED
|
@@ -181,6 +181,7 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
181
181
|
"text-sm",
|
|
182
182
|
"font-medium",
|
|
183
183
|
"align-middle",
|
|
184
|
+
"h-min",
|
|
184
185
|
], {
|
|
185
186
|
variants: {
|
|
186
187
|
color: {
|
|
@@ -18936,6 +18937,37 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
|
|
|
18936
18937
|
return (jsxRuntime.jsx("a", { "data-testid": dataTestId, className: className, title: title, href: href, rel: rel, target: target, children: children }));
|
|
18937
18938
|
};
|
|
18938
18939
|
|
|
18940
|
+
const cvaTooltipFlexContainer = cssClassVarianceUtilities.cvaMerge("inline-flex");
|
|
18941
|
+
const cvaTooltipPopover = cssClassVarianceUtilities.cvaMerge("pointer-events-none origin-center");
|
|
18942
|
+
cssClassVarianceUtilities.cvaMerge("pointer-events-none origin-center");
|
|
18943
|
+
const cvaTooltipContent = cssClassVarianceUtilities.cvaMerge("p-2 rounded max-w-sm", {
|
|
18944
|
+
variants: {
|
|
18945
|
+
color: {
|
|
18946
|
+
light: "shadow-md bg-white",
|
|
18947
|
+
dark: "text-white bg-neutral-800",
|
|
18948
|
+
},
|
|
18949
|
+
},
|
|
18950
|
+
defaultVariants: {
|
|
18951
|
+
color: "light",
|
|
18952
|
+
},
|
|
18953
|
+
});
|
|
18954
|
+
|
|
18955
|
+
/**
|
|
18956
|
+
* The Tooltip component is used to show helpful tips or contextual information to the users.
|
|
18957
|
+
*
|
|
18958
|
+
* @param {TooltipProps} props - The props for the Tooltip component
|
|
18959
|
+
* @returns {JSX.Element} Tooltip component
|
|
18960
|
+
*/
|
|
18961
|
+
const Tooltip = (_a) => {
|
|
18962
|
+
var { children, dataTestId, disabled, className } = _a, rest = __rest$1(_a, ["children", "dataTestId", "disabled", "className"]);
|
|
18963
|
+
const wrappedChildren = (jsxRuntime.jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId && `${dataTestId}-parent`, children: children }));
|
|
18964
|
+
if (disabled) {
|
|
18965
|
+
return wrappedChildren;
|
|
18966
|
+
}
|
|
18967
|
+
return (jsxRuntime.jsx(TooltipContainer, Object.assign({ dataTestId: dataTestId }, rest, { children: wrappedChildren })));
|
|
18968
|
+
};
|
|
18969
|
+
const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxRuntime.jsxs(Popover, { className: cvaTooltipPopover(), placement: placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsxRuntime.jsx(PopoverTrigger, { children: children }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsx("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipContent({ color: mode }), children: jsxRuntime.jsx(Text, { inverted: mode === "dark", type: contentTextType, children: label }) }) })] }));
|
|
18970
|
+
|
|
18939
18971
|
const cvaIndicator = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
|
|
18940
18972
|
const cvaIndicatorIcon = cssClassVarianceUtilities.cvaMerge(["mr-2"]);
|
|
18941
18973
|
const cvaIndicatorLabel = cssClassVarianceUtilities.cvaMerge(["pl-2", "pr-2", "font-medium", "capitalize", "text-sm", "xl:text-base"]);
|
|
@@ -19036,7 +19068,7 @@ const cvaIndicatorIconBackground = cssClassVarianceUtilities.cvaMerge(["rounded-
|
|
|
19036
19068
|
*/
|
|
19037
19069
|
const Indicator = (_a) => {
|
|
19038
19070
|
var { dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false, className } = _a, rest = __rest$1(_a, ["dataTestId", "icon", "label", "color", "withBackground", "withLabel", "ping", "className"]);
|
|
19039
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: cvaIndicator({ className }), "data-testid": dataTestId }, rest, {
|
|
19071
|
+
return (jsxRuntime.jsx(Tooltip, { disabled: withLabel, label: label, children: jsxRuntime.jsxs("div", Object.assign({ className: cvaIndicator({ className }), "data-testid": dataTestId, "aria-label": label }, rest, { children: [jsxRuntime.jsxs("div", { className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", children: [ping && (jsxRuntime.jsx("div", { className: cvaIndicatorPing({ color }), "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" })), icon] }), label !== undefined && withLabel && (jsxRuntime.jsx("div", { className: cvaIndicatorLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label", children: label }))] })) }));
|
|
19040
19072
|
};
|
|
19041
19073
|
|
|
19042
19074
|
const cvaMenuItem = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -19148,6 +19180,20 @@ const MenuList = (_a) => {
|
|
|
19148
19180
|
return (jsxRuntime.jsx("div", { "data-testid": dataTestId, className: cvaMenuList({ stickyHeader: withStickyHeader, className }), tabIndex: 0, role: "list", children: React.Children.map(childrenArr, (menuItem, index) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [menuItem, showDivider && !isLastItem(index) && jsxRuntime.jsx("hr", { className: cvaMenuListDivider() })] }))) }));
|
|
19149
19181
|
};
|
|
19150
19182
|
|
|
19183
|
+
/**
|
|
19184
|
+
* Sets a value in the local storage with the specified key.
|
|
19185
|
+
* Thin wrapper around localStorage.setItem() that is slightly more type safe
|
|
19186
|
+
* Stringifies value automatically.
|
|
19187
|
+
* Useful if you for some reason can't use the useLocalStorage hook for React lifecycle reasons
|
|
19188
|
+
*
|
|
19189
|
+
* @template TValue - The type of value to be stored.
|
|
19190
|
+
* @param {string} key - The key under which to store the value.
|
|
19191
|
+
* @param {TValue} value - The value to store in the local storage.
|
|
19192
|
+
*/
|
|
19193
|
+
const setLocalStorage = (key, value) => {
|
|
19194
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
19195
|
+
};
|
|
19196
|
+
|
|
19151
19197
|
/**
|
|
19152
19198
|
* Validates the state object using a Zod schema.
|
|
19153
19199
|
*
|
|
@@ -36427,8 +36473,7 @@ const useLocalStorageEffect = ({ key, state, defaultState, schema, onValidationF
|
|
|
36427
36473
|
onValidationFailed === null || onValidationFailed === void 0 ? void 0 : onValidationFailed(error);
|
|
36428
36474
|
},
|
|
36429
36475
|
onValidationSuccessful: () => {
|
|
36430
|
-
|
|
36431
|
-
localStorage.setItem(key, stringifiedState);
|
|
36476
|
+
setLocalStorage(key, state);
|
|
36432
36477
|
onValidationSuccessful === null || onValidationSuccessful === void 0 ? void 0 : onValidationSuccessful();
|
|
36433
36478
|
},
|
|
36434
36479
|
});
|
|
@@ -36697,6 +36742,23 @@ const useTimeout = ({ onTimeout, duration }) => {
|
|
|
36697
36742
|
return [startTimeout, stopTimeout];
|
|
36698
36743
|
};
|
|
36699
36744
|
|
|
36745
|
+
/**
|
|
36746
|
+
* Returns a callback that will be called when the visibility state of the document changes.
|
|
36747
|
+
*/
|
|
36748
|
+
const useVisibilityChange = ({ onChange, targetState }) => {
|
|
36749
|
+
React.useEffect(() => {
|
|
36750
|
+
const handleVisibilityChange = () => {
|
|
36751
|
+
if (document.visibilityState === targetState) {
|
|
36752
|
+
onChange();
|
|
36753
|
+
}
|
|
36754
|
+
};
|
|
36755
|
+
window.addEventListener("visibilitychange", handleVisibilityChange);
|
|
36756
|
+
return () => {
|
|
36757
|
+
window.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
36758
|
+
};
|
|
36759
|
+
}, [onChange, targetState]);
|
|
36760
|
+
};
|
|
36761
|
+
|
|
36700
36762
|
const cvaMoreMenu = cssClassVarianceUtilities.cvaMerge(["p-4"]);
|
|
36701
36763
|
|
|
36702
36764
|
/**
|
|
@@ -38835,37 +38897,6 @@ function defaultHeader(date, showTime) {
|
|
|
38835
38897
|
})})`;
|
|
38836
38898
|
}
|
|
38837
38899
|
|
|
38838
|
-
const cvaTooltipFlexContainer = cssClassVarianceUtilities.cvaMerge("inline-flex");
|
|
38839
|
-
const cvaTooltipPopover = cssClassVarianceUtilities.cvaMerge("pointer-events-none origin-center");
|
|
38840
|
-
cssClassVarianceUtilities.cvaMerge("pointer-events-none origin-center");
|
|
38841
|
-
const cvaTooltipContent = cssClassVarianceUtilities.cvaMerge("p-2 rounded max-w-sm", {
|
|
38842
|
-
variants: {
|
|
38843
|
-
color: {
|
|
38844
|
-
light: "shadow-md bg-white",
|
|
38845
|
-
dark: "text-white bg-neutral-800",
|
|
38846
|
-
},
|
|
38847
|
-
},
|
|
38848
|
-
defaultVariants: {
|
|
38849
|
-
color: "light",
|
|
38850
|
-
},
|
|
38851
|
-
});
|
|
38852
|
-
|
|
38853
|
-
/**
|
|
38854
|
-
* The Tooltip component is used to show helpful tips or contextual information to the users.
|
|
38855
|
-
*
|
|
38856
|
-
* @param {TooltipProps} props - The props for the Tooltip component
|
|
38857
|
-
* @returns {JSX.Element} Tooltip component
|
|
38858
|
-
*/
|
|
38859
|
-
const Tooltip = (_a) => {
|
|
38860
|
-
var { children, dataTestId, disabled, className } = _a, rest = __rest$1(_a, ["children", "dataTestId", "disabled", "className"]);
|
|
38861
|
-
const wrappedChildren = (jsxRuntime.jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId && `${dataTestId}-parent`, children: children }));
|
|
38862
|
-
if (disabled) {
|
|
38863
|
-
return wrappedChildren;
|
|
38864
|
-
}
|
|
38865
|
-
return (jsxRuntime.jsx(TooltipContainer, Object.assign({ dataTestId: dataTestId }, rest, { children: wrappedChildren })));
|
|
38866
|
-
};
|
|
38867
|
-
const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxRuntime.jsxs(Popover, { className: cvaTooltipPopover(), placement: placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsxRuntime.jsx(PopoverTrigger, { children: children }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsx("div", { className: cvaTooltipContent({ color: mode }), children: jsxRuntime.jsx(Text, { inverted: mode === "dark", type: contentTextType, children: label }) }) })] }));
|
|
38868
|
-
|
|
38869
38900
|
const cvaValueBar = cssClassVarianceUtilities.cvaMerge(["w-full"], {
|
|
38870
38901
|
variants: {
|
|
38871
38902
|
size: {
|
|
@@ -39062,6 +39093,7 @@ exports.cvaMenuItemSuffix = cvaMenuItemSuffix;
|
|
|
39062
39093
|
exports.docs = docs;
|
|
39063
39094
|
exports.getDevicePixelRatio = getDevicePixelRatio;
|
|
39064
39095
|
exports.getValueBarColorByValue = getValueBarColorByValue;
|
|
39096
|
+
exports.setLocalStorage = setLocalStorage;
|
|
39065
39097
|
exports.useClickOutside = useClickOutside;
|
|
39066
39098
|
exports.useContainerProps = useContainerProps;
|
|
39067
39099
|
exports.useDebounce = useDebounce;
|
|
@@ -39075,3 +39107,4 @@ exports.usePopoverContext = usePopoverContext;
|
|
|
39075
39107
|
exports.usePrompt = usePrompt;
|
|
39076
39108
|
exports.useResize = useResize;
|
|
39077
39109
|
exports.useTimeout = useTimeout;
|
|
39110
|
+
exports.useVisibilityChange = useVisibilityChange;
|
package/index.esm.js
CHANGED
|
@@ -154,6 +154,7 @@ const cvaButton = cvaMerge([
|
|
|
154
154
|
"text-sm",
|
|
155
155
|
"font-medium",
|
|
156
156
|
"align-middle",
|
|
157
|
+
"h-min",
|
|
157
158
|
], {
|
|
158
159
|
variants: {
|
|
159
160
|
color: {
|
|
@@ -18909,6 +18910,37 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
|
|
|
18909
18910
|
return (jsx("a", { "data-testid": dataTestId, className: className, title: title, href: href, rel: rel, target: target, children: children }));
|
|
18910
18911
|
};
|
|
18911
18912
|
|
|
18913
|
+
const cvaTooltipFlexContainer = cvaMerge("inline-flex");
|
|
18914
|
+
const cvaTooltipPopover = cvaMerge("pointer-events-none origin-center");
|
|
18915
|
+
cvaMerge("pointer-events-none origin-center");
|
|
18916
|
+
const cvaTooltipContent = cvaMerge("p-2 rounded max-w-sm", {
|
|
18917
|
+
variants: {
|
|
18918
|
+
color: {
|
|
18919
|
+
light: "shadow-md bg-white",
|
|
18920
|
+
dark: "text-white bg-neutral-800",
|
|
18921
|
+
},
|
|
18922
|
+
},
|
|
18923
|
+
defaultVariants: {
|
|
18924
|
+
color: "light",
|
|
18925
|
+
},
|
|
18926
|
+
});
|
|
18927
|
+
|
|
18928
|
+
/**
|
|
18929
|
+
* The Tooltip component is used to show helpful tips or contextual information to the users.
|
|
18930
|
+
*
|
|
18931
|
+
* @param {TooltipProps} props - The props for the Tooltip component
|
|
18932
|
+
* @returns {JSX.Element} Tooltip component
|
|
18933
|
+
*/
|
|
18934
|
+
const Tooltip = (_a) => {
|
|
18935
|
+
var { children, dataTestId, disabled, className } = _a, rest = __rest$1(_a, ["children", "dataTestId", "disabled", "className"]);
|
|
18936
|
+
const wrappedChildren = (jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId && `${dataTestId}-parent`, children: children }));
|
|
18937
|
+
if (disabled) {
|
|
18938
|
+
return wrappedChildren;
|
|
18939
|
+
}
|
|
18940
|
+
return (jsx(TooltipContainer, Object.assign({ dataTestId: dataTestId }, rest, { children: wrappedChildren })));
|
|
18941
|
+
};
|
|
18942
|
+
const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxs(Popover, { className: cvaTooltipPopover(), placement: placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsx(PopoverTrigger, { children: children }), jsx(PopoverContent, { children: jsx("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipContent({ color: mode }), children: jsx(Text, { inverted: mode === "dark", type: contentTextType, children: label }) }) })] }));
|
|
18943
|
+
|
|
18912
18944
|
const cvaIndicator = cvaMerge(["flex", "items-center"]);
|
|
18913
18945
|
const cvaIndicatorIcon = cvaMerge(["mr-2"]);
|
|
18914
18946
|
const cvaIndicatorLabel = cvaMerge(["pl-2", "pr-2", "font-medium", "capitalize", "text-sm", "xl:text-base"]);
|
|
@@ -19009,7 +19041,7 @@ const cvaIndicatorIconBackground = cvaMerge(["rounded-full", "items-center", "ju
|
|
|
19009
19041
|
*/
|
|
19010
19042
|
const Indicator = (_a) => {
|
|
19011
19043
|
var { dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false, className } = _a, rest = __rest$1(_a, ["dataTestId", "icon", "label", "color", "withBackground", "withLabel", "ping", "className"]);
|
|
19012
|
-
return (jsxs("div", Object.assign({ className: cvaIndicator({ className }), "data-testid": dataTestId }, rest, {
|
|
19044
|
+
return (jsx(Tooltip, { disabled: withLabel, label: label, children: jsxs("div", Object.assign({ className: cvaIndicator({ className }), "data-testid": dataTestId, "aria-label": label }, rest, { children: [jsxs("div", { className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", children: [ping && (jsx("div", { className: cvaIndicatorPing({ color }), "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" })), icon] }), label !== undefined && withLabel && (jsx("div", { className: cvaIndicatorLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label", children: label }))] })) }));
|
|
19013
19045
|
};
|
|
19014
19046
|
|
|
19015
19047
|
const cvaMenuItem = cvaMerge([
|
|
@@ -19121,6 +19153,20 @@ const MenuList = (_a) => {
|
|
|
19121
19153
|
return (jsx("div", { "data-testid": dataTestId, className: cvaMenuList({ stickyHeader: withStickyHeader, className }), tabIndex: 0, role: "list", children: Children.map(childrenArr, (menuItem, index) => (jsxs(Fragment, { children: [menuItem, showDivider && !isLastItem(index) && jsx("hr", { className: cvaMenuListDivider() })] }))) }));
|
|
19122
19154
|
};
|
|
19123
19155
|
|
|
19156
|
+
/**
|
|
19157
|
+
* Sets a value in the local storage with the specified key.
|
|
19158
|
+
* Thin wrapper around localStorage.setItem() that is slightly more type safe
|
|
19159
|
+
* Stringifies value automatically.
|
|
19160
|
+
* Useful if you for some reason can't use the useLocalStorage hook for React lifecycle reasons
|
|
19161
|
+
*
|
|
19162
|
+
* @template TValue - The type of value to be stored.
|
|
19163
|
+
* @param {string} key - The key under which to store the value.
|
|
19164
|
+
* @param {TValue} value - The value to store in the local storage.
|
|
19165
|
+
*/
|
|
19166
|
+
const setLocalStorage = (key, value) => {
|
|
19167
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
19168
|
+
};
|
|
19169
|
+
|
|
19124
19170
|
/**
|
|
19125
19171
|
* Validates the state object using a Zod schema.
|
|
19126
19172
|
*
|
|
@@ -36400,8 +36446,7 @@ const useLocalStorageEffect = ({ key, state, defaultState, schema, onValidationF
|
|
|
36400
36446
|
onValidationFailed === null || onValidationFailed === void 0 ? void 0 : onValidationFailed(error);
|
|
36401
36447
|
},
|
|
36402
36448
|
onValidationSuccessful: () => {
|
|
36403
|
-
|
|
36404
|
-
localStorage.setItem(key, stringifiedState);
|
|
36449
|
+
setLocalStorage(key, state);
|
|
36405
36450
|
onValidationSuccessful === null || onValidationSuccessful === void 0 ? void 0 : onValidationSuccessful();
|
|
36406
36451
|
},
|
|
36407
36452
|
});
|
|
@@ -36670,6 +36715,23 @@ const useTimeout = ({ onTimeout, duration }) => {
|
|
|
36670
36715
|
return [startTimeout, stopTimeout];
|
|
36671
36716
|
};
|
|
36672
36717
|
|
|
36718
|
+
/**
|
|
36719
|
+
* Returns a callback that will be called when the visibility state of the document changes.
|
|
36720
|
+
*/
|
|
36721
|
+
const useVisibilityChange = ({ onChange, targetState }) => {
|
|
36722
|
+
useEffect(() => {
|
|
36723
|
+
const handleVisibilityChange = () => {
|
|
36724
|
+
if (document.visibilityState === targetState) {
|
|
36725
|
+
onChange();
|
|
36726
|
+
}
|
|
36727
|
+
};
|
|
36728
|
+
window.addEventListener("visibilitychange", handleVisibilityChange);
|
|
36729
|
+
return () => {
|
|
36730
|
+
window.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
36731
|
+
};
|
|
36732
|
+
}, [onChange, targetState]);
|
|
36733
|
+
};
|
|
36734
|
+
|
|
36673
36735
|
const cvaMoreMenu = cvaMerge(["p-4"]);
|
|
36674
36736
|
|
|
36675
36737
|
/**
|
|
@@ -38808,37 +38870,6 @@ function defaultHeader(date, showTime) {
|
|
|
38808
38870
|
})})`;
|
|
38809
38871
|
}
|
|
38810
38872
|
|
|
38811
|
-
const cvaTooltipFlexContainer = cvaMerge("inline-flex");
|
|
38812
|
-
const cvaTooltipPopover = cvaMerge("pointer-events-none origin-center");
|
|
38813
|
-
cvaMerge("pointer-events-none origin-center");
|
|
38814
|
-
const cvaTooltipContent = cvaMerge("p-2 rounded max-w-sm", {
|
|
38815
|
-
variants: {
|
|
38816
|
-
color: {
|
|
38817
|
-
light: "shadow-md bg-white",
|
|
38818
|
-
dark: "text-white bg-neutral-800",
|
|
38819
|
-
},
|
|
38820
|
-
},
|
|
38821
|
-
defaultVariants: {
|
|
38822
|
-
color: "light",
|
|
38823
|
-
},
|
|
38824
|
-
});
|
|
38825
|
-
|
|
38826
|
-
/**
|
|
38827
|
-
* The Tooltip component is used to show helpful tips or contextual information to the users.
|
|
38828
|
-
*
|
|
38829
|
-
* @param {TooltipProps} props - The props for the Tooltip component
|
|
38830
|
-
* @returns {JSX.Element} Tooltip component
|
|
38831
|
-
*/
|
|
38832
|
-
const Tooltip = (_a) => {
|
|
38833
|
-
var { children, dataTestId, disabled, className } = _a, rest = __rest$1(_a, ["children", "dataTestId", "disabled", "className"]);
|
|
38834
|
-
const wrappedChildren = (jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId && `${dataTestId}-parent`, children: children }));
|
|
38835
|
-
if (disabled) {
|
|
38836
|
-
return wrappedChildren;
|
|
38837
|
-
}
|
|
38838
|
-
return (jsx(TooltipContainer, Object.assign({ dataTestId: dataTestId }, rest, { children: wrappedChildren })));
|
|
38839
|
-
};
|
|
38840
|
-
const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxs(Popover, { className: cvaTooltipPopover(), placement: placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsx(PopoverTrigger, { children: children }), jsx(PopoverContent, { children: jsx("div", { className: cvaTooltipContent({ color: mode }), children: jsx(Text, { inverted: mode === "dark", type: contentTextType, children: label }) }) })] }));
|
|
38841
|
-
|
|
38842
38873
|
const cvaValueBar = cvaMerge(["w-full"], {
|
|
38843
38874
|
variants: {
|
|
38844
38875
|
size: {
|
|
@@ -38973,4 +39004,4 @@ const cvaClickable = cvaMerge([
|
|
|
38973
39004
|
},
|
|
38974
39005
|
});
|
|
38975
39006
|
|
|
38976
|
-
export { Alert, Badge, Button$1 as Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, Timeline, TimelineElement, Tip, Tooltip, ValueBar, cvaButton, cvaButtonSpinner, cvaClickable, cvaIconButtonContainer, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, useClickOutside, useContainerProps, useDebounce, useDevicePixelRatio, useHover, useIsFirstRender, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout };
|
|
39007
|
+
export { Alert, Badge, Button$1 as Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, Timeline, TimelineElement, Tip, Tooltip, ValueBar, cvaButton, cvaButtonSpinner, cvaClickable, cvaIconButtonContainer, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, setLocalStorage, useClickOutside, useContainerProps, useDebounce, useDevicePixelRatio, useHover, useIsFirstRender, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout, useVisibilityChange };
|
package/package.json
CHANGED
package/src/hooks/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./localStorage/setLocalStorage";
|
|
1
2
|
export * from "./localStorage/useLocalStorage";
|
|
2
3
|
export * from "./localStorage/useLocalStorageReducer";
|
|
3
4
|
export * from "./useClickOutside";
|
|
@@ -7,3 +8,4 @@ export * from "./useHover";
|
|
|
7
8
|
export * from "./useIsFirstRender";
|
|
8
9
|
export * from "./useResize";
|
|
9
10
|
export * from "./useTimeout";
|
|
11
|
+
export * from "./useVisibilityChange";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets a value in the local storage with the specified key.
|
|
3
|
+
* Thin wrapper around localStorage.setItem() that is slightly more type safe
|
|
4
|
+
* Stringifies value automatically.
|
|
5
|
+
* Useful if you for some reason can't use the useLocalStorage hook for React lifecycle reasons
|
|
6
|
+
*
|
|
7
|
+
* @template TValue - The type of value to be stored.
|
|
8
|
+
* @param {string} key - The key under which to store the value.
|
|
9
|
+
* @param {TValue} value - The value to store in the local storage.
|
|
10
|
+
*/
|
|
11
|
+
export declare const setLocalStorage: <TValue>(key: string, value: TValue) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type VisibilityState = "hidden" | "visible";
|
|
2
|
+
interface VisibilityChangeOptions {
|
|
3
|
+
onChange: () => void;
|
|
4
|
+
targetState: VisibilityState;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Returns a callback that will be called when the visibility state of the document changes.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useVisibilityChange: ({ onChange, targetState }: VisibilityChangeOptions) => void;
|
|
10
|
+
export default useVisibilityChange;
|