123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- @mixin drop-theme($themeName, $theme-bg, $theme-color, $border-color: $theme-bg) {
- .drop-element.drop-#{$themeName} {
- max-width: 100%;
- max-height: 100%;
- .drop-content {
- border-radius: $border-radius-lg;
- position: relative;
- font-weight: $font-weight-semi-bold;
- background: $theme-bg;
- color: $theme-color;
- padding: $space-sm;
- word-wrap: break-word;
- max-width: 280px;
- border: 1px solid $border-color;
- &:before {
- content: '';
- display: block;
- position: absolute;
- width: 0;
- height: 0;
- border-color: transparent;
- border-width: $popover-arrow-size;
- border-style: solid;
- pointer-events: null;
- }
- }
- &.drop-wide {
- .drop-content {
- max-width: 560px;
- }
- }
- // Centers and middles
- &.drop-element-attached-bottom.drop-element-attached-center .drop-content {
- margin-bottom: $popover-arrow-size;
- &:before {
- top: 100%;
- left: 50%;
- margin-left: -$popover-arrow-size;
- border-top-color: $border-color;
- }
- }
- &.drop-element-attached-top.drop-element-attached-center .drop-content {
- margin-top: $popover-arrow-size;
- &:before {
- bottom: 100%;
- left: 50%;
- margin-left: -$popover-arrow-size;
- border-bottom-color: $border-color;
- }
- }
- &.drop-element-attached-right.drop-element-attached-middle .drop-content {
- margin-right: $popover-arrow-size;
- &:before {
- left: 100%;
- top: 50%;
- margin-top: -$popover-arrow-size;
- border-left-color: $border-color;
- }
- }
- &.drop-element-attached-left.drop-element-attached-middle .drop-content {
- margin-left: $popover-arrow-size;
- &:before {
- right: 100%;
- top: 50%;
- margin-top: -$popover-arrow-size;
- border-right-color: $border-color;
- }
- }
- // Target middle/center, element corner
- &.drop-element-attached-left.drop-target-attached-center .drop-content {
- left: -$popover-arrow-size * 2;
- }
- &.drop-element-attached-right.drop-target-attached-center .drop-content {
- left: $popover-arrow-size * 2;
- }
- &.drop-element-attached-top.drop-element-attached-left.drop-target-attached-middle .drop-content {
- margin-top: $popover-arrow-size;
- &:before {
- bottom: 100%;
- left: $popover-arrow-size;
- border-bottom-color: $border-color;
- }
- }
- &.drop-element-attached-top.drop-element-attached-right.drop-target-attached-middle .drop-content {
- margin-top: $popover-arrow-size;
- &:before {
- bottom: 100%;
- right: $popover-arrow-size;
- border-bottom-color: $border-color;
- }
- }
- &.drop-element-attached-bottom.drop-element-attached-left.drop-target-attached-middle .drop-content {
- margin-bottom: $popover-arrow-size;
- &:before {
- top: 100%;
- left: $popover-arrow-size;
- border-top-color: $border-color;
- }
- }
- &.drop-element-attached-bottom.drop-element-attached-right.drop-target-attached-middle .drop-content {
- margin-bottom: $popover-arrow-size;
- &:before {
- top: 100%;
- right: $popover-arrow-size;
- border-top-color: $border-color;
- }
- }
- // Top and bottom corners
- &.drop-element-attached-top.drop-element-attached-left.drop-target-attached-bottom .drop-content {
- margin-top: $popover-arrow-size;
- &:before {
- bottom: 100%;
- left: $popover-arrow-size;
- border-bottom-color: $border-color;
- }
- }
- &.drop-element-attached-top.drop-element-attached-right.drop-target-attached-bottom .drop-content {
- margin-top: $popover-arrow-size;
- &:before {
- bottom: 100%;
- right: $popover-arrow-size;
- border-bottom-color: $border-color;
- }
- }
- &.drop-element-attached-bottom.drop-element-attached-left.drop-target-attached-top .drop-content {
- margin-bottom: $popover-arrow-size;
- &:before {
- top: 100%;
- left: $popover-arrow-size;
- border-top-color: $border-color;
- }
- }
- &.drop-element-attached-bottom.drop-element-attached-right.drop-target-attached-top .drop-content {
- margin-bottom: $popover-arrow-size;
- &:before {
- top: 100%;
- right: $popover-arrow-size;
- border-top-color: $border-color;
- }
- }
- // Side corners
- &.drop-element-attached-top.drop-element-attached-right.drop-target-attached-left .drop-content {
- margin-right: $popover-arrow-size;
- &:before {
- top: $popover-arrow-size;
- left: 100%;
- border-left-color: $border-color;
- }
- }
- &.drop-element-attached-top.drop-element-attached-left.drop-target-attached-right .drop-content {
- margin-left: $popover-arrow-size;
- &:before {
- top: $popover-arrow-size;
- right: 100%;
- border-right-color: $border-color;
- }
- }
- &.drop-element-attached-bottom.drop-element-attached-right.drop-target-attached-left .drop-content {
- margin-right: $popover-arrow-size;
- &:before {
- bottom: $popover-arrow-size;
- left: 100%;
- border-left-color: $border-color;
- }
- }
- &.drop-element-attached-bottom.drop-element-attached-left.drop-target-attached-right .drop-content {
- margin-left: $popover-arrow-size;
- &:before {
- bottom: $popover-arrow-size;
- right: 100%;
- border-right-color: $border-color;
- }
- }
- }
- }
- @mixin drop-animation-scale($themePrefix: 'drop', $themeName: 'default', $attachmentOffset: 0, $easing: 'linear') {
- .#{$themePrefix}-element.#{$themePrefix}-#{$themeName} {
- transform: translateZ(0);
- transition: opacity 100ms;
- opacity: 0;
- .#{$themePrefix}-content {
- transition: transform 0.2s $easing;
- transform: scale(0.8) translateZ(0);
- }
- &.#{$themePrefix}-open {
- display: none;
- }
- &.#{$themePrefix}-open-transitionend {
- display: block;
- }
- &.#{$themePrefix}-after-open {
- transition: none;
- opacity: 1;
- .#{$themePrefix}-content {
- transform: scale(1) translateZ(0);
- }
- }
- // Centers and middles
- &.#{$themePrefix}-element-attached-bottom.#{$themePrefix}-element-attached-center .#{$themePrefix}-content {
- transform-origin: 50% calc(100% + #{$attachmentOffset});
- }
- &.#{$themePrefix}-element-attached-top.#{$themePrefix}-element-attached-center .#{$themePrefix}-content {
- transform-origin: 50% (-$attachmentOffset);
- }
- &.#{$themePrefix}-element-attached-right.#{$themePrefix}-element-attached-middle .#{$themePrefix}-content {
- transform-origin: calc(100% + #{$attachmentOffset}) 50%;
- }
- &.#{$themePrefix}-element-attached-left.#{$themePrefix}-element-attached-middle .#{$themePrefix}-content {
- transform-origin: -($attachmentOffset 50%);
- }
- // Top and bottom corners
- &.#{$themePrefix}-element-attached-top.#{$themePrefix}-element-attached-left.#{$themePrefix}-target-attached-bottom
- .#{$themePrefix}-content {
- transform-origin: 0 (-$attachmentOffset);
- }
- &.#{$themePrefix}-element-attached-top.#{$themePrefix}-element-attached-right.#{$themePrefix}-target-attached-bottom
- .#{$themePrefix}-content {
- transform-origin: 100% (-$attachmentOffset);
- }
- &.#{$themePrefix}-element-attached-bottom.#{$themePrefix}-element-attached-left.#{$themePrefix}-target-attached-top
- .#{$themePrefix}-content {
- transform-origin: 0 calc(100% + #{$attachmentOffset});
- }
- &.#{$themePrefix}-element-attached-bottom.#{$themePrefix}-element-attached-right.#{$themePrefix}-target-attached-top
- .#{$themePrefix}-content {
- transform-origin: 100% calc(100% + #{$attachmentOffset});
- }
- // Side corners
- &.#{$themePrefix}-element-attached-top.#{$themePrefix}-element-attached-right.#{$themePrefix}-target-attached-left
- .#{$themePrefix}-content {
- transform-origin: calc(100% + #{$attachmentOffset}) 0;
- }
- &.#{$themePrefix}-element-attached-top.#{$themePrefix}-element-attached-left.#{$themePrefix}-target-attached-right
- .#{$themePrefix}-content {
- transform-origin: (-$attachmentOffset) 0;
- }
- &.#{$themePrefix}-element-attached-bottom.#{$themePrefix}-element-attached-right.#{$themePrefix}-target-attached-left
- .#{$themePrefix}-content {
- transform-origin: calc(100% + #{$attachmentOffset}) 100%;
- }
- &.#{$themePrefix}-element-attached-bottom.#{$themePrefix}-element-attached-left.#{$themePrefix}-target-attached-right
- .#{$themePrefix}-content {
- transform-origin: (-$attachmentOffset) 100%;
- }
- }
- }
|