Skip to content

Commit 357f2bf

Browse files
committed
refactor(layout): Updated Configuration to use new HoverModeProvider
1 parent 386f47b commit 357f2bf

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

packages/layout/src/Configuration.tsx

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ import {
88
StatesConfig,
99
StatesConfigProps,
1010
} from "@react-md/states";
11-
import {
12-
DEFAULT_TOOLTIP_DELAY,
13-
TooltipHoverModeConfig,
14-
} from "@react-md/tooltip";
1511
import {
1612
AppSizeListener,
1713
AppSizeListenerProps,
@@ -24,30 +20,41 @@ import {
2420
DEFAULT_TABLET_MAX_WIDTH,
2521
DEFAULT_TABLET_MIN_WIDTH,
2622
Dir,
23+
HoverModeConfiguration,
24+
HoverModeProvider,
2725
UserInteractionModeListener,
2826
WritingDirection,
2927
} from "@react-md/utils";
3028

3129
export interface ConfigurationProps extends AppSizeOptions, StatesConfigProps {
3230
/**
3331
* An optional function to call when the app gets resized based on media
34-
* queries. This is useful if you want to store the current app state in
35-
* redux if you can't always access this state with the `useAppSize` hook.
32+
* queries. This is useful if you want to store the current app state in redux
33+
* if you can't always access this state with the `useAppSize` hook.
3634
*/
3735
onAppResize?: AppSizeListenerProps["onChange"];
3836

3937
/**
4038
* Boolean if the default tooltip hover mode should be disabled.
39+
*
40+
* @deprecated \@since 2.8.0 Use the {@link ConfigurationProps#hoverMode}
41+
* configuration object instead.
4142
*/
4243
disableTooltipHoverMode?: boolean;
4344

4445
/**
4546
* The default delay before the tooltip hover mode is enabled.
47+
*
48+
* @deprecated \@since 2.8.0 Use the {@link ConfigurationProps#hoverMode}
49+
* configuration object instead.
4650
*/
4751
tooltipDefaultDelay?: number;
4852

4953
/**
5054
* The delay before the tooltip should become visible.
55+
*
56+
* @deprecated \@since 2.8.0 Use the {@link ConfigurationProps#hoverMode}
57+
* configuration object instead.
5158
*/
5259
tooltipDelayTimeout?: number;
5360

@@ -77,6 +84,12 @@ export interface ConfigurationProps extends AppSizeOptions, StatesConfigProps {
7784
* @remarks \@since 2.3.0
7885
*/
7986
defaultDir?: WritingDirection | (() => WritingDirection);
87+
88+
/**
89+
* @see {@link HoverModeConfiguration}
90+
* @remarks \@since 2.8.0
91+
*/
92+
hoverMode?: HoverModeConfiguration;
8093
}
8194

8295
/**
@@ -99,9 +112,10 @@ export function Configuration({
99112
rippleClassNames = DEFAULT_RIPPLE_CLASSNAMES,
100113
disableRipple = false,
101114
disableProgrammaticRipple = false,
102-
disableTooltipHoverMode = false,
103-
tooltipDefaultDelay = DEFAULT_TOOLTIP_DELAY,
104-
tooltipDelayTimeout = DEFAULT_TOOLTIP_DELAY,
115+
disableTooltipHoverMode,
116+
tooltipDefaultDelay,
117+
tooltipDelayTimeout,
118+
hoverMode,
105119
}: ConfigurationProps): ReactElement {
106120
return (
107121
<Dir defaultDir={defaultDir}>
@@ -122,17 +136,18 @@ export function Configuration({
122136
rippleTimeout={rippleTimeout}
123137
rippleClassNames={rippleClassNames}
124138
>
125-
<TooltipHoverModeConfig
126-
enabled={!disableTooltipHoverMode}
127-
defaultDelay={tooltipDefaultDelay}
128-
delayTimeout={tooltipDelayTimeout}
139+
<HoverModeProvider
140+
disabled={disableTooltipHoverMode}
141+
defaultVisibleInTime={tooltipDefaultDelay}
142+
deactivateTime={tooltipDelayTimeout}
143+
{...hoverMode}
129144
>
130145
<IconProvider {...icons}>
131146
<FormThemeProvider {...formTheme}>
132147
{children}
133148
</FormThemeProvider>
134149
</IconProvider>
135-
</TooltipHoverModeConfig>
150+
</HoverModeProvider>
136151
</StatesConfig>
137152
</UserInteractionModeListener>
138153
</NestedDialogContextProvider>

0 commit comments

Comments
 (0)