@trackunit/react-components 0.1.110 → 0.1.112
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 +56 -22
- package/index.js +58 -25
- package/package.json +1 -1
- package/src/components/Collapse/Collapse.variants.d.ts +8 -0
- package/src/hooks/index.d.ts +1 -0
- package/src/hooks/useDebounce.d.ts +5 -1
- package/src/hooks/useHover.d.ts +24 -0
package/index.cjs
CHANGED
|
@@ -688,6 +688,35 @@ const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose,
|
|
|
688
688
|
return (jsxRuntime.jsx(DensityContainer, Object.assign({ dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density }, { children: jsxRuntime.jsxs("div", Object.assign({ className: cvaCardHeader() }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: cvaCardHeaderHeadingContainer() }, { children: [jsxRuntime.jsx(Heading$1, Object.assign({ className: "self-center", variant: headingVariant }, { children: heading })), accessories] })), subHeading && (jsxRuntime.jsx(Heading$1, Object.assign({ subtle: true, variant: "subtitle" }, { children: subHeading }))), children] })), onClose && (jsxRuntime.jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMarkIcon", size: "small" }), className: "!h-min" }))] })) })));
|
|
689
689
|
};
|
|
690
690
|
|
|
691
|
+
const cvaCollapse = cssClassVarianceUtilities.cvaMerge([
|
|
692
|
+
"block",
|
|
693
|
+
"w-full",
|
|
694
|
+
"border-b",
|
|
695
|
+
"border-solid",
|
|
696
|
+
"border-neutral-100",
|
|
697
|
+
"pb-3",
|
|
698
|
+
"mb-4",
|
|
699
|
+
"last:border-0",
|
|
700
|
+
"last:m-0",
|
|
701
|
+
"only:border-0",
|
|
702
|
+
"only:m-0",
|
|
703
|
+
]);
|
|
704
|
+
const cvaCollapseLabel = cssClassVarianceUtilities.cvaMerge(["block", "w-full", "cursor-pointer"]);
|
|
705
|
+
const cvaCollapseLabelContainer = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "justify-between"]);
|
|
706
|
+
cssClassVarianceUtilities.cvaMerge(["block", "relative", "w-full", "mt-1", "p-1"]);
|
|
707
|
+
const cvaCollapseAnimated = cssClassVarianceUtilities.cvaMerge(["overflow-y-hidden", "transition-all"]);
|
|
708
|
+
const cvaCollapseIcon = cssClassVarianceUtilities.cvaMerge(["ease-in-out", "duration-200"], {
|
|
709
|
+
variants: {
|
|
710
|
+
expanded: {
|
|
711
|
+
false: "",
|
|
712
|
+
true: "rotate-180",
|
|
713
|
+
},
|
|
714
|
+
},
|
|
715
|
+
defaultVariants: {
|
|
716
|
+
expanded: false,
|
|
717
|
+
},
|
|
718
|
+
});
|
|
719
|
+
|
|
691
720
|
/**
|
|
692
721
|
* The Collapse component is used to condense non-important information.
|
|
693
722
|
*
|
|
@@ -702,31 +731,12 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, clas
|
|
|
702
731
|
}
|
|
703
732
|
setExpanded(!expanded);
|
|
704
733
|
}, [expanded, onToggle]);
|
|
705
|
-
return (jsxRuntime.jsxs(
|
|
734
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: cvaCollapse({ className }), "data-testid": dataTestId }, { children: [jsxRuntime.jsx("div", Object.assign({ className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxRuntime.jsxs("div", Object.assign({ className: cvaCollapseLabelContainer() }, { children: [jsxRuntime.jsx(Text$1, Object.assign({ weight: "bold" }, { children: label })), jsxRuntime.jsx(IconButton, { icon: jsxRuntime.jsx(Icon, { className: cvaCollapseIcon({ expanded }), name: "ChevronDownIcon", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] })) })), jsxRuntime.jsx(Collapsible, Object.assign({ expanded: expanded, id: id }, { children: children }))] })));
|
|
706
735
|
};
|
|
707
|
-
const Rotate = tailwindStyledComponents.twx(Icon) `
|
|
708
|
-
${p => (p.$expanded ? tailwindStyledComponents.tws `tu-icon--animated-rotate-expanded` : null)}
|
|
709
|
-
tu-icon--animated-rotate
|
|
710
|
-
`;
|
|
711
|
-
const StyledCollapse = tailwindStyledComponents.tw.div `
|
|
712
|
-
tu-collapse
|
|
713
|
-
`;
|
|
714
|
-
const CollapseLabel = tailwindStyledComponents.tw.div `
|
|
715
|
-
tu-collapse__label
|
|
716
|
-
`;
|
|
717
|
-
const LabelContainer = tailwindStyledComponents.tw.div `
|
|
718
|
-
tu-collapse__label__container
|
|
719
|
-
`;
|
|
720
736
|
const Collapsible = ({ children, expanded, id }) => {
|
|
721
737
|
const [ref, { height }] = reactUse.useMeasure();
|
|
722
|
-
return (jsxRuntime.jsx(
|
|
723
|
-
};
|
|
724
|
-
const AnimatedCollapsible = tailwindStyledComponents.tw.div `
|
|
725
|
-
tu-collapsible--animated
|
|
726
|
-
`;
|
|
727
|
-
const StyledCollapsible = tailwindStyledComponents.tw.div `
|
|
728
|
-
tu-collapsible
|
|
729
|
-
`;
|
|
738
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: cvaCollapseAnimated(), id: id, style: { height: expanded ? height : "0" } }, { children: jsxRuntime.jsx("div", Object.assign({ className: cvaCollapse(), ref: ref }, { children: children })) })));
|
|
739
|
+
};
|
|
730
740
|
|
|
731
741
|
const cvaCopyableText = cssClassVarianceUtilities.cvaMerge([
|
|
732
742
|
"py-1",
|
|
@@ -1218,6 +1228,9 @@ const useClickOutside = (el, options = {}, onClick) => {
|
|
|
1218
1228
|
* @param {"in" | "out" | "both"} direction Considers truthiness of value. If set to "in", the value will only be debounced if it is truthy. If set to "out", the value will only be debounced if it is falsy. If set to "both" or if not defined, the value will be debounced regardless of truthiness.
|
|
1219
1229
|
* @returns {any} The latest value received
|
|
1220
1230
|
*/
|
|
1231
|
+
/**
|
|
1232
|
+
*
|
|
1233
|
+
*/
|
|
1221
1234
|
const useDebounce = (value, delay = 500, direction) => {
|
|
1222
1235
|
const [debouncedValue, setDebouncedValue] = React.useState(value);
|
|
1223
1236
|
React.useEffect(() => {
|
|
@@ -1291,6 +1304,26 @@ function getDevicePixelRatio(options) {
|
|
|
1291
1304
|
return rounded;
|
|
1292
1305
|
}
|
|
1293
1306
|
|
|
1307
|
+
/**
|
|
1308
|
+
* The useHover hook returns a onMouseEnter, onMouseLeave and a boolean indicating whether the element is being hovered.
|
|
1309
|
+
* The boolean will be true if the element is being hovered, and false if it is not.
|
|
1310
|
+
* Can be directionally debounced.
|
|
1311
|
+
*
|
|
1312
|
+
* @param {ConditionalUseHoverProps} param0 The options
|
|
1313
|
+
* @returns {Object} The object containing the onMouseEnter, onMouseLeave and hovering props
|
|
1314
|
+
*/
|
|
1315
|
+
const useHover = ({ debounced = false, delay = 100, direction = "out" } = { debounced: false }) => {
|
|
1316
|
+
const [hovering, setHovering] = React.useState(false);
|
|
1317
|
+
const debouncedHovering = useDebounce(hovering, delay, direction);
|
|
1318
|
+
const onMouseEnter = () => {
|
|
1319
|
+
setHovering(true);
|
|
1320
|
+
};
|
|
1321
|
+
const onMouseLeave = () => {
|
|
1322
|
+
setHovering(false);
|
|
1323
|
+
};
|
|
1324
|
+
return { onMouseEnter, onMouseLeave, hovering: debounced ? debouncedHovering : hovering };
|
|
1325
|
+
};
|
|
1326
|
+
|
|
1294
1327
|
/**
|
|
1295
1328
|
* Differentiate between the first and subsequent renders.
|
|
1296
1329
|
*
|
|
@@ -2386,6 +2419,7 @@ exports.useClickOutside = useClickOutside;
|
|
|
2386
2419
|
exports.useContainerProps = useContainerProps;
|
|
2387
2420
|
exports.useDebounce = useDebounce;
|
|
2388
2421
|
exports.useDevicePixelRatio = useDevicePixelRatio;
|
|
2422
|
+
exports.useHover = useHover;
|
|
2389
2423
|
exports.useIsFirstRender = useIsFirstRender;
|
|
2390
2424
|
exports.useLocalStorage = useLocalStorage;
|
|
2391
2425
|
exports.useLocalStorageReducer = useLocalStorageReducer;
|
package/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
|
7
7
|
import { useMeasure, useCopyToClipboard } from 'react-use';
|
|
8
8
|
import { DayPicker as DayPicker$1 } from 'react-day-picker';
|
|
9
9
|
import { enGB, enUS, da, de, cs, nl, fr, fi, hu, it, nb, pl, pt, ru, ro, es, sv, ja, th } from 'date-fns/locale';
|
|
10
|
-
import { useFloating, autoUpdate, offset, flip, shift, size, useClick, useDismiss, useHover, useRole, useInteractions, useMergeRefs, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
|
|
10
|
+
import { useFloating, autoUpdate, offset, flip, shift, size, useClick, useDismiss, useHover as useHover$1, useRole, useInteractions, useMergeRefs, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
|
|
11
11
|
import { isEqual } from 'lodash';
|
|
12
12
|
import usePortal from 'react-useportal';
|
|
13
13
|
import { UNSAFE_NavigationContext } from 'react-router-dom';
|
|
@@ -661,6 +661,35 @@ const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose,
|
|
|
661
661
|
return (jsx(DensityContainer, Object.assign({ dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density }, { children: jsxs("div", Object.assign({ className: cvaCardHeader() }, { children: [jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxs("div", Object.assign({ className: cvaCardHeaderHeadingContainer() }, { children: [jsx(Heading$1, Object.assign({ className: "self-center", variant: headingVariant }, { children: heading })), accessories] })), subHeading && (jsx(Heading$1, Object.assign({ subtle: true, variant: "subtitle" }, { children: subHeading }))), children] })), onClose && (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMarkIcon", size: "small" }), className: "!h-min" }))] })) })));
|
|
662
662
|
};
|
|
663
663
|
|
|
664
|
+
const cvaCollapse = cvaMerge([
|
|
665
|
+
"block",
|
|
666
|
+
"w-full",
|
|
667
|
+
"border-b",
|
|
668
|
+
"border-solid",
|
|
669
|
+
"border-neutral-100",
|
|
670
|
+
"pb-3",
|
|
671
|
+
"mb-4",
|
|
672
|
+
"last:border-0",
|
|
673
|
+
"last:m-0",
|
|
674
|
+
"only:border-0",
|
|
675
|
+
"only:m-0",
|
|
676
|
+
]);
|
|
677
|
+
const cvaCollapseLabel = cvaMerge(["block", "w-full", "cursor-pointer"]);
|
|
678
|
+
const cvaCollapseLabelContainer = cvaMerge(["flex", "items-center", "justify-between"]);
|
|
679
|
+
cvaMerge(["block", "relative", "w-full", "mt-1", "p-1"]);
|
|
680
|
+
const cvaCollapseAnimated = cvaMerge(["overflow-y-hidden", "transition-all"]);
|
|
681
|
+
const cvaCollapseIcon = cvaMerge(["ease-in-out", "duration-200"], {
|
|
682
|
+
variants: {
|
|
683
|
+
expanded: {
|
|
684
|
+
false: "",
|
|
685
|
+
true: "rotate-180",
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
defaultVariants: {
|
|
689
|
+
expanded: false,
|
|
690
|
+
},
|
|
691
|
+
});
|
|
692
|
+
|
|
664
693
|
/**
|
|
665
694
|
* The Collapse component is used to condense non-important information.
|
|
666
695
|
*
|
|
@@ -675,31 +704,12 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, clas
|
|
|
675
704
|
}
|
|
676
705
|
setExpanded(!expanded);
|
|
677
706
|
}, [expanded, onToggle]);
|
|
678
|
-
return (jsxs(
|
|
707
|
+
return (jsxs("div", Object.assign({ className: cvaCollapse({ className }), "data-testid": dataTestId }, { children: [jsx("div", Object.assign({ className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxs("div", Object.assign({ className: cvaCollapseLabelContainer() }, { children: [jsx(Text$1, Object.assign({ weight: "bold" }, { children: label })), jsx(IconButton, { icon: jsx(Icon, { className: cvaCollapseIcon({ expanded }), name: "ChevronDownIcon", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] })) })), jsx(Collapsible, Object.assign({ expanded: expanded, id: id }, { children: children }))] })));
|
|
679
708
|
};
|
|
680
|
-
const Rotate = twx(Icon) `
|
|
681
|
-
${p => (p.$expanded ? tws `tu-icon--animated-rotate-expanded` : null)}
|
|
682
|
-
tu-icon--animated-rotate
|
|
683
|
-
`;
|
|
684
|
-
const StyledCollapse = tw.div `
|
|
685
|
-
tu-collapse
|
|
686
|
-
`;
|
|
687
|
-
const CollapseLabel = tw.div `
|
|
688
|
-
tu-collapse__label
|
|
689
|
-
`;
|
|
690
|
-
const LabelContainer = tw.div `
|
|
691
|
-
tu-collapse__label__container
|
|
692
|
-
`;
|
|
693
709
|
const Collapsible = ({ children, expanded, id }) => {
|
|
694
710
|
const [ref, { height }] = useMeasure();
|
|
695
|
-
return (jsx(
|
|
696
|
-
};
|
|
697
|
-
const AnimatedCollapsible = tw.div `
|
|
698
|
-
tu-collapsible--animated
|
|
699
|
-
`;
|
|
700
|
-
const StyledCollapsible = tw.div `
|
|
701
|
-
tu-collapsible
|
|
702
|
-
`;
|
|
711
|
+
return (jsx("div", Object.assign({ className: cvaCollapseAnimated(), id: id, style: { height: expanded ? height : "0" } }, { children: jsx("div", Object.assign({ className: cvaCollapse(), ref: ref }, { children: children })) })));
|
|
712
|
+
};
|
|
703
713
|
|
|
704
714
|
const cvaCopyableText = cvaMerge([
|
|
705
715
|
"py-1",
|
|
@@ -823,7 +833,7 @@ const usePopover = (_a) => {
|
|
|
823
833
|
const popoverContext = popoverData.context;
|
|
824
834
|
const clickInteraction = useClick(popoverContext, { enabled: activation.click, ignoreMouse: activation.hover });
|
|
825
835
|
const dismissInteraction = useDismiss(popoverContext);
|
|
826
|
-
const hoverInteraction = useHover(popoverContext, { enabled: activation.hover });
|
|
836
|
+
const hoverInteraction = useHover$1(popoverContext, { enabled: activation.hover });
|
|
827
837
|
const roleInteraction = useRole(popoverContext);
|
|
828
838
|
const combinedInteractions = useInteractions([
|
|
829
839
|
clickInteraction,
|
|
@@ -1191,6 +1201,9 @@ const useClickOutside = (el, options = {}, onClick) => {
|
|
|
1191
1201
|
* @param {"in" | "out" | "both"} direction Considers truthiness of value. If set to "in", the value will only be debounced if it is truthy. If set to "out", the value will only be debounced if it is falsy. If set to "both" or if not defined, the value will be debounced regardless of truthiness.
|
|
1192
1202
|
* @returns {any} The latest value received
|
|
1193
1203
|
*/
|
|
1204
|
+
/**
|
|
1205
|
+
*
|
|
1206
|
+
*/
|
|
1194
1207
|
const useDebounce = (value, delay = 500, direction) => {
|
|
1195
1208
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
1196
1209
|
useEffect(() => {
|
|
@@ -1264,6 +1277,26 @@ function getDevicePixelRatio(options) {
|
|
|
1264
1277
|
return rounded;
|
|
1265
1278
|
}
|
|
1266
1279
|
|
|
1280
|
+
/**
|
|
1281
|
+
* The useHover hook returns a onMouseEnter, onMouseLeave and a boolean indicating whether the element is being hovered.
|
|
1282
|
+
* The boolean will be true if the element is being hovered, and false if it is not.
|
|
1283
|
+
* Can be directionally debounced.
|
|
1284
|
+
*
|
|
1285
|
+
* @param {ConditionalUseHoverProps} param0 The options
|
|
1286
|
+
* @returns {Object} The object containing the onMouseEnter, onMouseLeave and hovering props
|
|
1287
|
+
*/
|
|
1288
|
+
const useHover = ({ debounced = false, delay = 100, direction = "out" } = { debounced: false }) => {
|
|
1289
|
+
const [hovering, setHovering] = useState(false);
|
|
1290
|
+
const debouncedHovering = useDebounce(hovering, delay, direction);
|
|
1291
|
+
const onMouseEnter = () => {
|
|
1292
|
+
setHovering(true);
|
|
1293
|
+
};
|
|
1294
|
+
const onMouseLeave = () => {
|
|
1295
|
+
setHovering(false);
|
|
1296
|
+
};
|
|
1297
|
+
return { onMouseEnter, onMouseLeave, hovering: debounced ? debouncedHovering : hovering };
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1267
1300
|
/**
|
|
1268
1301
|
* Differentiate between the first and subsequent renders.
|
|
1269
1302
|
*
|
|
@@ -2296,4 +2329,4 @@ const Layout = tw.div `
|
|
|
2296
2329
|
tu-layout-TwoColumnLayout
|
|
2297
2330
|
`;
|
|
2298
2331
|
|
|
2299
|
-
export { Alert, Badge, Button, Card, CardBody, CardFooter, CardHeader, Collapse, ContentGridArea, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, ExternalLink, FilterListMapLayout, FullWidthRepeatingLayout, GridArea, Heading$1 as Heading, Icon, IconButton, Indicator, IntrinsicallyResponsiveGrid, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MoreMenu, NavGridArea, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, Timeline, TimelineElement, Tip, TitleGridArea, TitleNavContentLayout, Tooltip, TwoColumnLayout, ValueBar, cvaClickable, docs, getDevicePixelRatio, getValueBarColorByValue, useClickOutside, useContainerProps, useDebounce, useDevicePixelRatio, useIsFirstRender, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout };
|
|
2332
|
+
export { Alert, Badge, Button, Card, CardBody, CardFooter, CardHeader, Collapse, ContentGridArea, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, ExternalLink, FilterListMapLayout, FullWidthRepeatingLayout, GridArea, Heading$1 as Heading, Icon, IconButton, Indicator, IntrinsicallyResponsiveGrid, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MoreMenu, NavGridArea, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, Timeline, TimelineElement, Tip, TitleGridArea, TitleNavContentLayout, Tooltip, TwoColumnLayout, ValueBar, cvaClickable, docs, getDevicePixelRatio, getValueBarColorByValue, useClickOutside, useContainerProps, useDebounce, useDevicePixelRatio, useHover, useIsFirstRender, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout };
|
package/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const cvaCollapse: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaCollapseLabel: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const cvaCollapseLabelContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
4
|
+
export declare const cvaCollapsible: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
5
|
+
export declare const cvaCollapseAnimated: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
6
|
+
export declare const cvaCollapseIcon: (props?: ({
|
|
7
|
+
expanded?: boolean | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
package/src/hooks/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type DebounceDirection = "in" | "out" | "both";
|
|
1
2
|
/**
|
|
2
3
|
* The useDebounce hook works like useState, but adds a delay where previous values will be ignored.
|
|
3
4
|
*
|
|
@@ -6,4 +7,7 @@
|
|
|
6
7
|
* @param {"in" | "out" | "both"} direction Considers truthiness of value. If set to "in", the value will only be debounced if it is truthy. If set to "out", the value will only be debounced if it is falsy. If set to "both" or if not defined, the value will be debounced regardless of truthiness.
|
|
7
8
|
* @returns {any} The latest value received
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare const useDebounce: <T>(value: T, delay?: number, direction?: DebounceDirection) => T;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DebounceDirection } from "./useDebounce";
|
|
2
|
+
type ConditionalUseHoverProps = {
|
|
3
|
+
debounced: true;
|
|
4
|
+
delay?: number;
|
|
5
|
+
direction?: DebounceDirection;
|
|
6
|
+
} | {
|
|
7
|
+
debounced: false;
|
|
8
|
+
delay?: never;
|
|
9
|
+
direction?: never;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The useHover hook returns a onMouseEnter, onMouseLeave and a boolean indicating whether the element is being hovered.
|
|
13
|
+
* The boolean will be true if the element is being hovered, and false if it is not.
|
|
14
|
+
* Can be directionally debounced.
|
|
15
|
+
*
|
|
16
|
+
* @param {ConditionalUseHoverProps} param0 The options
|
|
17
|
+
* @returns {Object} The object containing the onMouseEnter, onMouseLeave and hovering props
|
|
18
|
+
*/
|
|
19
|
+
export declare const useHover: ({ debounced, delay, direction }?: ConditionalUseHoverProps) => {
|
|
20
|
+
onMouseEnter: () => void;
|
|
21
|
+
onMouseLeave: () => void;
|
|
22
|
+
hovering: boolean;
|
|
23
|
+
};
|
|
24
|
+
export {};
|