@@ -49,7 +49,6 @@ import {
49
49
ScrollStrategy ,
50
50
VerticalConnectionPos ,
51
51
} from '@angular/cdk/overlay' ;
52
- import { numbers } from '@material/tooltip' ;
53
52
import { ComponentPortal } from '@angular/cdk/portal' ;
54
53
import { Observable , Subject } from 'rxjs' ;
55
54
@@ -156,6 +155,13 @@ const passiveListenerOptions = normalizePassiveListenerOptions({passive: true});
156
155
*/
157
156
const LONGPRESS_DELAY = 500 ;
158
157
158
+ // These constants were taken from MDC's `numbers` object. We can't import them from MDC,
159
+ // because they have some top-level references to `window` which break during SSR.
160
+ const MIN_VIEWPORT_TOOLTIP_THRESHOLD = 8 ;
161
+ const UNBOUNDED_ANCHOR_GAP = 8 ;
162
+ const MIN_HEIGHT = 24 ;
163
+ const MAX_WIDTH = 200 ;
164
+
159
165
@Directive ( )
160
166
export abstract class _MatTooltipBase < T extends _TooltipComponentBase >
161
167
implements OnDestroy , AfterViewInit
@@ -880,11 +886,11 @@ export class MatTooltip extends _MatTooltipBase<TooltipComponent> {
880
886
defaultOptions ,
881
887
_document ,
882
888
) ;
883
- this . _viewportMargin = numbers . MIN_VIEWPORT_TOOLTIP_THRESHOLD ;
889
+ this . _viewportMargin = MIN_VIEWPORT_TOOLTIP_THRESHOLD ;
884
890
}
885
891
886
892
protected override _addOffset ( position : ConnectedPosition ) : ConnectedPosition {
887
- const offset = numbers . UNBOUNDED_ANCHOR_GAP ;
893
+ const offset = UNBOUNDED_ANCHOR_GAP ;
888
894
const isLtr = ! this . _dir || this . _dir . value == 'ltr' ;
889
895
890
896
if ( position . originY === 'top' ) {
@@ -1138,6 +1144,6 @@ export class TooltipComponent extends _TooltipComponentBase {
1138
1144
/** Whether the tooltip text has overflown to the next line */
1139
1145
private _isTooltipMultiline ( ) {
1140
1146
const rect = this . _elementRef . nativeElement . getBoundingClientRect ( ) ;
1141
- return rect . height > numbers . MIN_HEIGHT && rect . width >= numbers . MAX_WIDTH ;
1147
+ return rect . height > MIN_HEIGHT && rect . width >= MAX_WIDTH ;
1142
1148
}
1143
1149
}
0 commit comments