-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add pointer-arrow theme variant to vaadin-popover
- Loading branch information
1 parent
01919cf
commit 6c1453a
Showing
32 changed files
with
222 additions
and
8 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
Binary file added
BIN
+5.58 KB
...over/test/visual/lumo/screenshots/popover/baseline/bottom-end-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.56 KB
.../popover/test/visual/lumo/screenshots/popover/baseline/bottom-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.47 KB
...er/test/visual/lumo/screenshots/popover/baseline/bottom-start-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.42 KB
...over/test/visual/lumo/screenshots/popover/baseline/end-bottom-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.59 KB
...ges/popover/test/visual/lumo/screenshots/popover/baseline/end-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.52 KB
...popover/test/visual/lumo/screenshots/popover/baseline/end-top-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.56 KB
...er/test/visual/lumo/screenshots/popover/baseline/start-bottom-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.65 KB
...s/popover/test/visual/lumo/screenshots/popover/baseline/start-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.6 KB
...pover/test/visual/lumo/screenshots/popover/baseline/start-top-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.6 KB
...popover/test/visual/lumo/screenshots/popover/baseline/top-end-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.56 KB
...ges/popover/test/visual/lumo/screenshots/popover/baseline/top-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.56 KB
...pover/test/visual/lumo/screenshots/popover/baseline/top-start-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Binary file added
BIN
+3.48 KB
.../test/visual/material/screenshots/popover/baseline/bottom-end-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.46 KB
...over/test/visual/material/screenshots/popover/baseline/bottom-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.45 KB
...est/visual/material/screenshots/popover/baseline/bottom-start-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.49 KB
.../test/visual/material/screenshots/popover/baseline/end-bottom-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.5 KB
...popover/test/visual/material/screenshots/popover/baseline/end-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.48 KB
...ver/test/visual/material/screenshots/popover/baseline/end-top-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.44 KB
...est/visual/material/screenshots/popover/baseline/start-bottom-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.47 KB
...pover/test/visual/material/screenshots/popover/baseline/start-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.47 KB
...r/test/visual/material/screenshots/popover/baseline/start-top-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.54 KB
...ver/test/visual/material/screenshots/popover/baseline/top-end-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.53 KB
...popover/test/visual/material/screenshots/popover/baseline/top-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.51 KB
...r/test/visual/material/screenshots/popover/baseline/top-start-pointer-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,20 +1,103 @@ | ||
import '@vaadin/vaadin-lumo-styles/color.js'; | ||
import '@vaadin/vaadin-lumo-styles/spacing.js'; | ||
import '@vaadin/vaadin-lumo-styles/style.js'; | ||
import '@vaadin/vaadin-lumo-styles/typography.js'; | ||
import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js'; | ||
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
|
||
const popoverOverlay = css` | ||
:host { | ||
--vaadin-popover-offset-top: var(--lumo-space-xs); | ||
--vaadin-popover-offset-bottom: var(--lumo-space-xs); | ||
--vaadin-popover-offset-start: var(--lumo-space-xs); | ||
--vaadin-popover-offset-end: var(--lumo-space-xs); | ||
--vaadin-popover-offset-top: var(--_vaadin-popover-default-offset); | ||
--vaadin-popover-offset-bottom: var(--_vaadin-popover-default-offset); | ||
--vaadin-popover-offset-start: var(--_vaadin-popover-default-offset); | ||
--vaadin-popover-offset-end: var(--_vaadin-popover-default-offset); | ||
--vaadin-popover-arrow-size: 0.5rem; | ||
--_vaadin-popover-default-offset: var(--lumo-space-xs); | ||
} | ||
[part='content'] { | ||
padding: var(--lumo-space-xs) var(--lumo-space-s); | ||
} | ||
:host([theme~='pointer-arrow']) { | ||
--_vaadin-popover-default-offset: calc(var(--lumo-space-s) + var(--vaadin-popover-arrow-size) / 2); | ||
} | ||
/* top / bottom position */ | ||
:host([theme~='pointer-arrow'][position^='top']) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='bottom']) [part='arrow'] { | ||
border-left: var(--vaadin-popover-arrow-size) solid transparent; | ||
border-right: var(--vaadin-popover-arrow-size) solid transparent; | ||
} | ||
:host([theme~='pointer-arrow'][position^='bottom'][bottom-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='top'][bottom-aligned]) [part='arrow'] { | ||
bottom: calc(var(--vaadin-popover-arrow-size) * -1); | ||
border-top: var(--vaadin-popover-arrow-size) solid var(--lumo-base-color); | ||
filter: drop-shadow(0px 2px 1px var(--lumo-shade-10pct)); | ||
} | ||
:host([theme~='pointer-arrow'][position^='bottom'][top-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='top'][top-aligned]) [part='arrow'] { | ||
top: calc(var(--vaadin-popover-arrow-size) * -1); | ||
border-bottom: var(--vaadin-popover-arrow-size) solid var(--lumo-base-color); | ||
filter: drop-shadow(0px -2px 1px var(--lumo-shade-10pct)); | ||
} | ||
:host([theme~='pointer-arrow'][position^='bottom'][start-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='top'][start-aligned]) [part='arrow'] { | ||
transform: translateX(-50%); | ||
inset-inline-start: 1.5rem; | ||
} | ||
:host([theme~='pointer-arrow'][position^='bottom'][end-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='top'][end-aligned]) [part='arrow'] { | ||
transform: translateX(50%); | ||
inset-inline-end: 1.5rem; | ||
} | ||
:host([theme~='pointer-arrow'][position^='bottom'][arrow-centered]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='top'][arrow-centered]) [part='arrow'] { | ||
transform: translateX(-50%); | ||
inset-inline-start: 50%; | ||
} | ||
/* start / end position */ | ||
:host([theme~='pointer-arrow'][position^='start']) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='end']) [part='arrow'] { | ||
border-top: var(--vaadin-popover-arrow-size) solid transparent; | ||
border-bottom: var(--vaadin-popover-arrow-size) solid transparent; | ||
} | ||
:host([theme~='pointer-arrow'][position^='start'][start-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='end'][start-aligned]) [part='arrow'] { | ||
inset-inline-start: calc(var(--vaadin-popover-arrow-size) * -1); | ||
border-right: var(--vaadin-popover-arrow-size) solid var(--lumo-base-color); | ||
filter: drop-shadow(-2px 0 1px var(--lumo-shade-10pct)); | ||
} | ||
:host([theme~='pointer-arrow'][position^='start'][end-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='end'][end-aligned]) [part='arrow'] { | ||
inset-inline-end: calc(var(--vaadin-popover-arrow-size) * -1); | ||
border-left: var(--vaadin-popover-arrow-size) solid var(--lumo-base-color); | ||
filter: drop-shadow(2px 0 1px var(--lumo-shade-10pct)); | ||
} | ||
:host([theme~='pointer-arrow'][position^='start'][top-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='end'][top-aligned]) [part='arrow'] { | ||
top: 0.5rem; | ||
} | ||
:host([theme~='pointer-arrow'][position='start'][top-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position='end'][top-aligned]) [part='arrow'] { | ||
top: 50%; | ||
transform: translateY(-50%); | ||
} | ||
:host([theme~='pointer-arrow'][position^='start'][bottom-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='end'][bottom-aligned]) [part='arrow'] { | ||
bottom: 0.5rem; | ||
} | ||
`; | ||
|
||
registerStyles('vaadin-popover-overlay', [overlay, popoverOverlay], { moduleId: 'lumo-popover-overlay' }); |
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,17 +1,100 @@ | ||
import '@vaadin/vaadin-material-styles/color.js'; | ||
import { overlay } from '@vaadin/vaadin-material-styles/mixins/overlay.js'; | ||
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
|
||
const popoverOverlay = css` | ||
:host { | ||
--vaadin-popover-offset-top: 0.25rem; | ||
--vaadin-popover-offset-bottom: 0.25rem; | ||
--vaadin-popover-offset-start: 0.25rem; | ||
--vaadin-popover-offset-end: 0.25rem; | ||
--vaadin-popover-offset-top: var(--_vaadin-popover-default-offset); | ||
--vaadin-popover-offset-bottom: var(--_vaadin-popover-default-offset); | ||
--vaadin-popover-offset-start: var(--_vaadin-popover-default-offset); | ||
--vaadin-popover-offset-end: var(--_vaadin-popover-default-offset); | ||
--vaadin-popover-arrow-size: 0.5rem; | ||
--_vaadin-popover-default-offset: 0.25rem; | ||
} | ||
[part='content'] { | ||
padding: 0.25rem 0.5rem; | ||
} | ||
:host([theme~='pointer-arrow']) { | ||
--_vaadin-popover-default-offset: calc(0.25rem + var(--vaadin-popover-arrow-size) / 1.25); | ||
} | ||
/* top / bottom position */ | ||
:host([theme~='pointer-arrow'][position^='top']) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='bottom']) [part='arrow'] { | ||
border-left: var(--vaadin-popover-arrow-size) solid transparent; | ||
border-right: var(--vaadin-popover-arrow-size) solid transparent; | ||
} | ||
:host([theme~='pointer-arrow'][position^='bottom'][bottom-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='top'][bottom-aligned]) [part='arrow'] { | ||
bottom: calc(var(--vaadin-popover-arrow-size) * -1); | ||
border-top: var(--vaadin-popover-arrow-size) solid var(--material-background-color); | ||
filter: drop-shadow(0px 2px 1px rgba(0, 0, 0, 0.14)); | ||
} | ||
:host([theme~='pointer-arrow'][position^='bottom'][top-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='top'][top-aligned]) [part='arrow'] { | ||
top: calc(var(--vaadin-popover-arrow-size) * -1); | ||
border-bottom: var(--vaadin-popover-arrow-size) solid var(--material-background-color); | ||
filter: drop-shadow(0px -2px 1px rgba(0, 0, 0, 0.14)); | ||
} | ||
:host([theme~='pointer-arrow'][position^='bottom'][start-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='top'][start-aligned]) [part='arrow'] { | ||
transform: translateX(-50%); | ||
inset-inline-start: 1.5rem; | ||
} | ||
:host([theme~='pointer-arrow'][position^='bottom'][end-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='top'][end-aligned]) [part='arrow'] { | ||
transform: translateX(50%); | ||
inset-inline-end: 1.5rem; | ||
} | ||
:host([theme~='pointer-arrow'][position^='bottom'][arrow-centered]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='top'][arrow-centered]) [part='arrow'] { | ||
transform: translateX(-50%); | ||
inset-inline-start: 50%; | ||
} | ||
/* start / end position */ | ||
:host([theme~='pointer-arrow'][position^='start']) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='end']) [part='arrow'] { | ||
border-top: var(--vaadin-popover-arrow-size) solid transparent; | ||
border-bottom: var(--vaadin-popover-arrow-size) solid transparent; | ||
} | ||
:host([theme~='pointer-arrow'][position^='start'][start-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='end'][start-aligned]) [part='arrow'] { | ||
inset-inline-start: calc(var(--vaadin-popover-arrow-size) * -1); | ||
border-right: var(--vaadin-popover-arrow-size) solid var(--material-background-color); | ||
filter: drop-shadow(-2px 0 1px rgba(0, 0, 0, 0.14)); | ||
} | ||
:host([theme~='pointer-arrow'][position^='start'][end-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='end'][end-aligned]) [part='arrow'] { | ||
inset-inline-end: calc(var(--vaadin-popover-arrow-size) * -1); | ||
border-left: var(--vaadin-popover-arrow-size) solid var(--material-background-color); | ||
filter: drop-shadow(2px 0 1px rgba(0, 0, 0, 0.14)); | ||
} | ||
:host([theme~='pointer-arrow'][position^='start'][top-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='end'][top-aligned]) [part='arrow'] { | ||
top: 0.5rem; | ||
} | ||
:host([theme~='pointer-arrow'][position='start'][top-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position='end'][top-aligned]) [part='arrow'] { | ||
top: 50%; | ||
transform: translateY(-50%); | ||
} | ||
:host([theme~='pointer-arrow'][position^='start'][bottom-aligned]) [part='arrow'], | ||
:host([theme~='pointer-arrow'][position^='end'][bottom-aligned]) [part='arrow'] { | ||
bottom: 0.5rem; | ||
} | ||
`; | ||
|
||
registerStyles('vaadin-popover-overlay', [overlay, popoverOverlay], { moduleId: 'material-popover-overlay' }); |