Summary Files Commits Branches @commit @diff @stats
path: root / src / tooltips.less
blob: 02dc201e3791063a58a15c2e380cd6f8d909247d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Tooltips
.tooltip {
  position: relative;
  &::after {
    background: fade(@dark-color, 90%);
    border-radius: @border-radius;
    bottom: 100%;
    color: @light-color;
    content: attr(data-tooltip);
    display: block;
    font-size: @font-size-sm;
    left: 50%;
    max-width: @control-max-width;
    opacity: 0;
    overflow: hidden;
    padding: @unit-1 @unit-2;
    pointer-events: none;
    position: absolute;
    text-overflow: ellipsis;
    transform: translate(-50%, @unit-2);
    transition: all .2s ease;
    white-space: nowrap;
    z-index: @zindex-3;
  }
  &:focus,
  &:hover {
    &::after {
      opacity: 1;
      transform: translate(-50%, -@unit-1);
    }
  }
  &[disabled],
  &.disabled {
    pointer-events: auto;
  }

  &.tooltip-right {
    &::after {
      bottom: 50%;
      left: 100%;
      transform: translate(-@unit-1, 50%);
    }
    &:focus,
    &:hover {
      &::after {
        transform: translate(@unit-1, 50%);
      }
    }
  }
  &.tooltip-bottom {
    &::after {
      bottom: auto;
      top: 100%;
      transform: translate(-50%, -@unit-2);
    }
    &:focus,
    &:hover {
      &::after {
        transform: translate(-50%, @unit-1);
      }
    }
  }
  &.tooltip-left {
    &::after {
      bottom: 50%;
      left: auto;
      right: 100%;
      transform: translate(@unit-2, 50%);
    }
    &:focus,
    &:hover {
      &::after {
        transform: translate(-@unit-1, 50%);
      }
    }
  }
}