-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tooltip): use core positioning utils (#227)
- Loading branch information
1 parent
1bc4910
commit a1497a7
Showing
25 changed files
with
282 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 19 additions & 26 deletions
45
...imitives/tooltip/src/tooltip.constants.ts → ...mitives/core/src/positioning/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,84 @@ | ||
import { ConnectionPositionPair } from '@angular/cdk/overlay'; | ||
import { RdxTooltipAlign, RdxTooltipSide } from './tooltip.types'; | ||
import { RdxPositionAlign, RdxPositions, RdxPositionSide } from './types'; | ||
|
||
type TooltipPositions = { | ||
[key in RdxTooltipSide]: { | ||
[key in RdxTooltipAlign]: ConnectionPositionPair; | ||
}; | ||
}; | ||
|
||
export const TOOLTIP_POSITIONS: TooltipPositions = { | ||
[RdxTooltipSide.Top]: { | ||
[RdxTooltipAlign.Center]: { | ||
export const RDX_POSITIONS: RdxPositions = { | ||
[RdxPositionSide.Top]: { | ||
[RdxPositionAlign.Center]: { | ||
originX: 'center', | ||
originY: 'top', | ||
overlayX: 'center', | ||
overlayY: 'bottom' | ||
}, | ||
[RdxTooltipAlign.Start]: { | ||
[RdxPositionAlign.Start]: { | ||
originX: 'start', | ||
originY: 'top', | ||
overlayX: 'start', | ||
overlayY: 'bottom' | ||
}, | ||
[RdxTooltipAlign.End]: { | ||
[RdxPositionAlign.End]: { | ||
originX: 'end', | ||
originY: 'top', | ||
overlayX: 'end', | ||
overlayY: 'bottom' | ||
} | ||
}, | ||
[RdxTooltipSide.Right]: { | ||
[RdxTooltipAlign.Center]: { | ||
[RdxPositionSide.Right]: { | ||
[RdxPositionAlign.Center]: { | ||
originX: 'end', | ||
originY: 'center', | ||
overlayX: 'start', | ||
overlayY: 'center' | ||
}, | ||
[RdxTooltipAlign.Start]: { | ||
[RdxPositionAlign.Start]: { | ||
originX: 'end', | ||
originY: 'top', | ||
overlayX: 'start', | ||
overlayY: 'top' | ||
}, | ||
[RdxTooltipAlign.End]: { | ||
[RdxPositionAlign.End]: { | ||
originX: 'end', | ||
originY: 'bottom', | ||
overlayX: 'start', | ||
overlayY: 'bottom' | ||
} | ||
}, | ||
[RdxTooltipSide.Bottom]: { | ||
[RdxTooltipAlign.Center]: { | ||
[RdxPositionSide.Bottom]: { | ||
[RdxPositionAlign.Center]: { | ||
originX: 'center', | ||
originY: 'bottom', | ||
overlayX: 'center', | ||
overlayY: 'top' | ||
}, | ||
[RdxTooltipAlign.Start]: { | ||
[RdxPositionAlign.Start]: { | ||
originX: 'start', | ||
originY: 'bottom', | ||
overlayX: 'start', | ||
overlayY: 'top' | ||
}, | ||
[RdxTooltipAlign.End]: { | ||
[RdxPositionAlign.End]: { | ||
originX: 'end', | ||
originY: 'bottom', | ||
overlayX: 'end', | ||
overlayY: 'top' | ||
} | ||
}, | ||
[RdxTooltipSide.Left]: { | ||
[RdxTooltipAlign.Center]: { | ||
[RdxPositionSide.Left]: { | ||
[RdxPositionAlign.Center]: { | ||
originX: 'start', | ||
originY: 'center', | ||
overlayX: 'end', | ||
overlayY: 'center' | ||
}, | ||
[RdxTooltipAlign.Start]: { | ||
[RdxPositionAlign.Start]: { | ||
originX: 'start', | ||
originY: 'top', | ||
overlayX: 'end', | ||
overlayY: 'top' | ||
}, | ||
[RdxTooltipAlign.End]: { | ||
[RdxPositionAlign.End]: { | ||
originX: 'start', | ||
originY: 'bottom', | ||
overlayX: 'end', | ||
overlayY: 'bottom' | ||
} | ||
} | ||
}; | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { ConnectionPositionPair } from '@angular/cdk/overlay'; | ||
|
||
export enum RdxPositionSide { | ||
Top = 'top', | ||
Right = 'right', | ||
Bottom = 'bottom', | ||
Left = 'left' | ||
} | ||
|
||
export enum RdxPositionAlign { | ||
Start = 'start', | ||
Center = 'center', | ||
End = 'end' | ||
} | ||
|
||
export type RdxPositionSideAndAlign = { side: RdxPositionSide; align: RdxPositionAlign }; | ||
export type RdxPositionSideAndAlignOffsets = { sideOffset: number; alignOffset: number }; | ||
|
||
export type RdxPositions = { | ||
[key in RdxPositionSide]: { | ||
[key in RdxPositionAlign]: ConnectionPositionPair; | ||
}; | ||
}; | ||
|
||
export type RdxAllPossibleConnectedPositions = ReadonlyMap< | ||
`${RdxPositionSide}|${RdxPositionAlign}`, | ||
ConnectionPositionPair | ||
>; | ||
export type RdxArrowPositionParams = { | ||
top: string; | ||
left: string; | ||
transform: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.