-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[components] Add new tooltip and popover components
- Loading branch information
1 parent
d9450b8
commit 1f9a64b
Showing
58 changed files
with
1,047 additions
and
556 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
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
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,102 @@ | ||
@import 'part:@sanity/base/theme/variables-style'; | ||
|
||
.root { | ||
position: absolute; | ||
pointer-events: none; | ||
width: 27px; | ||
height: 12px; | ||
transform-origin: 0 0; | ||
color: var(--component-bg); | ||
|
||
@nest & > svg { | ||
display: block; | ||
} | ||
|
||
@nest &[data-placement='top'] { | ||
transform-origin: left bottom; | ||
bottom: 1px; | ||
left: 50%; | ||
transform: rotate(180deg) translate(-50%); | ||
} | ||
|
||
@nest &[data-placement='top-end'] { | ||
transform-origin: left bottom; | ||
bottom: 1px; | ||
right: 3px; | ||
transform: rotate(180deg) translateX(-100%); | ||
} | ||
|
||
@nest &[data-placement='top-start'] { | ||
transform-origin: left bottom; | ||
bottom: 1px; | ||
left: 3px; | ||
transform: rotate(180deg) translateX(-100%); | ||
} | ||
|
||
@nest &[data-placement='right'] { | ||
transform-origin: left bottom; | ||
transform: rotate(-90deg) translateX(-50%); | ||
bottom: 50%; | ||
left: 1px; | ||
} | ||
|
||
@nest &[data-placement='right-end'] { | ||
transform-origin: left bottom; | ||
transform: rotate(-90deg); | ||
bottom: 3px; | ||
left: 1px; | ||
} | ||
|
||
@nest &[data-placement='right-start'] { | ||
transform-origin: left bottom; | ||
transform: rotate(-90deg) translateX(-50%); | ||
top: 3px; | ||
left: 1px; | ||
} | ||
|
||
@nest &[data-placement='left'] { | ||
transform-origin: right bottom; | ||
right: 1px; | ||
transform: rotate(90deg); | ||
top: 50%; | ||
} | ||
|
||
@nest &[data-placement='left-start'] { | ||
transform-origin: right bottom; | ||
right: 1px; | ||
transform: rotate(90deg) translateX(50%); | ||
top: 3px; | ||
} | ||
|
||
@nest &[data-placement='left-end'] { | ||
transform-origin: right bottom; | ||
right: 1px; | ||
transform: rotate(90deg); | ||
bottom: 3px; | ||
} | ||
|
||
@nest &[data-placement='bottom'] { | ||
top: 1px; | ||
left: 50%; | ||
transform: translate(-50%, -100%); | ||
} | ||
|
||
@nest &[data-placement='bottom-end'] { | ||
top: 1px; | ||
right: 3px; | ||
transform: translate(0, -100%); | ||
} | ||
|
||
@nest &[data-placement='bottom-start'] { | ||
top: 1px; | ||
left: 3px; | ||
transform: translateY(-100%); | ||
} | ||
} | ||
|
||
.arrowBorderGroup { | ||
& > path { | ||
fill: var(--hairline-color); | ||
/* fill: var(--card-shadow-outline-color); */ | ||
} | ||
} |
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,27 @@ | ||
import React, {forwardRef} from 'react' | ||
|
||
import styles from './arrow.css' | ||
|
||
export const PopoverArrow = forwardRef((props: React.HTMLProps<HTMLDivElement>, ref) => { | ||
return ( | ||
<div {...props} className={styles.root} ref={ref as any}> | ||
<svg | ||
width="27" | ||
height="11" | ||
viewBox="0 0 27 11" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<g className={styles.arrowBorderGroup}> | ||
<path d="M1.18359 10.0001C3.2959 10.0001 5.29525 9.04623 6.62431 7.40445L11.1684 1.79112C12.3691 0.307911 14.6312 0.307907 15.8319 1.79112L20.376 7.40445C21.7051 9.04622 23.7044 10.0001 25.8167 10.0001H21.9437C21.0534 9.50751 20.2547 8.84388 19.5988 8.03364L15.0547 2.42031C14.2542 1.43151 12.7461 1.43151 11.9457 2.42032L7.40155 8.03365C6.74565 8.84388 5.9469 9.50751 5.05659 10.0001H1.18359Z" /> | ||
</g> | ||
<path | ||
d="M19.5986 8.03365L15.0545 2.42031C14.254 1.43151 12.746 1.43151 11.9455 2.42031L7.40138 8.03365C5.88246 9.90996 3.59749 11.0001 1.18342 11.0001H0H27H25.8166C23.4025 11.0001 21.1175 9.90996 19.5986 8.03365Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
</div> | ||
) | ||
}) | ||
|
||
PopoverArrow.displayName = 'PopoverArrow' |
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 @@ | ||
export * from './popover' |
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,12 @@ | ||
@import 'part:@sanity/base/theme/variables-style'; | ||
|
||
.root { | ||
z-index: 9999; | ||
} | ||
|
||
.card { | ||
background: var(--component-bg); | ||
color: var(--component-text-color); | ||
border-radius: var(--border-radius-medium); | ||
box-shadow: 0 0 0 1px var(--hairline-color), 0 4px 8px color(var(--gray) alpha(30%)); | ||
} |
Oops, something went wrong.