-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plasma-new-hope): Tooltip added
- Loading branch information
Showing
35 changed files
with
1,533 additions
and
135 deletions.
There are no files selected for viewing
9 changes: 1 addition & 8 deletions
9
packages/plasma-new-hope/src/components/Dropdown/Dropdown.styles.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
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
95 changes: 95 additions & 0 deletions
95
packages/plasma-new-hope/src/components/Popover/Popover.styles.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 |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import { styled } from '@linaria/react'; | ||
|
||
import { DEFAULT_Z_INDEX } from '../Popup/utils'; | ||
|
||
import { tokens } from './Popover.tokens'; | ||
import { PopoverProps } from './Popover.types'; | ||
|
||
export const StyledRoot = styled.div` | ||
position: relative; | ||
box-sizing: border-box; | ||
display: inline-flex; | ||
`; | ||
|
||
export const StyledArrow = styled.div` | ||
visibility: hidden; | ||
&, | ||
&::before { | ||
position: absolute; | ||
width: var(${String(tokens.arrowMaskWidth)}); | ||
height: var(${String(tokens.arrowMaskHeight)}); | ||
mask-image: var(${String(tokens.arrowMaskImage)}); | ||
background: var(${String(tokens.arrowBackground)}); | ||
} | ||
&::before { | ||
visibility: visible; | ||
content: ''; | ||
transform: rotate(0deg); | ||
} | ||
`; | ||
|
||
export const StyledPopover = styled.div<Pick<PopoverProps, 'zIndex'>>` | ||
position: absolute; | ||
z-index: ${({ zIndex }) => zIndex || DEFAULT_Z_INDEX}; | ||
&[data-popper-placement^='top'] > .popover-arrow { | ||
bottom: calc(0px - var(${String(tokens.arrowHeight)})); | ||
} | ||
&[data-popper-placement^='bottom'] > .popover-arrow { | ||
top: calc(0px - var(${String(tokens.arrowHeight)})); | ||
&::before { | ||
transform: rotate(180deg); | ||
} | ||
} | ||
&[data-popper-placement^='left'] > .popover-arrow { | ||
right: calc(0px - var(${String(tokens.arrowHeight)})); | ||
&::before { | ||
transform: rotate(-90deg); | ||
} | ||
} | ||
&[data-popper-placement^='right'] > .popover-arrow { | ||
left: calc(0px - var(${String(tokens.arrowHeight)})); | ||
&::before { | ||
transform: rotate(90deg); | ||
} | ||
} | ||
&[data-popper-placement^='top-start'] > .popover-arrow { | ||
bottom: calc(0px - var(${String(tokens.arrowHeight)})); | ||
left: var(${String(tokens.arrowEdgeMargin)}) !important; | ||
transform: unset !important; | ||
} | ||
&[data-popper-placement^='top-end'] > .popover-arrow { | ||
bottom: calc(0px - var(${String(tokens.arrowHeight)})); | ||
left: unset !important; | ||
right: var(${String(tokens.arrowEdgeMargin)}) !important; | ||
transform: unset !important; | ||
} | ||
&[data-popper-placement^='bottom-start'] > .popover-arrow { | ||
top: calc(0px - var(${String(tokens.arrowHeight)})); | ||
left: var(${String(tokens.arrowEdgeMargin)}) !important; | ||
transform: unset !important; | ||
&::before { | ||
transform: rotate(180deg); | ||
} | ||
} | ||
&[data-popper-placement^='bottom-end'] > .popover-arrow { | ||
top: calc(0px - var(${String(tokens.arrowHeight)})); | ||
left: unset !important; | ||
right: var(${String(tokens.arrowEdgeMargin)}) !important; | ||
transform: unset !important; | ||
&::before { | ||
transform: rotate(180deg); | ||
} | ||
} | ||
`; |
14 changes: 14 additions & 0 deletions
14
packages/plasma-new-hope/src/components/Popover/Popover.tokens.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const classes = { | ||
root: 'popover-root', | ||
target: 'popover-target', | ||
arrow: 'popover-arrow', | ||
}; | ||
|
||
export const tokens = { | ||
arrowMaskWidth: '--plasma-popover-arrow-mask-width', | ||
arrowMaskHeight: '--plasma-popover-arrow-mask-height', | ||
arrowMaskImage: '--plasma-popover-arrow-mask-image', | ||
arrowBackground: '--plasma-popover-arrow-background', | ||
arrowHeight: '--plasma-popover-arrow-height', | ||
arrowEdgeMargin: '--plasma-popover-arrow-edge-margin', | ||
}; |
Oops, something went wrong.