nice-elements 1.4.9 → 1.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,7 @@
1
- <div class="nice-help">
2
- <i class="fa fa-question-circle"></i>
3
- <div class="help-window" ng-bind-html="text">{{ text }}</div>
4
- </div>
1
+ <div class="nice-help" ng-mouseover="onHover()">
2
+ <i class="fa fa-question-circle nice-help-button" aria-label=""></i>
3
+ <div class="nice-help-popup">
4
+ <span ng-bind-html="text">{{ text }}</span>
5
+ <div data-popper-arrow class="nice-help-arrow"></div>
6
+ </div>
7
+ </div>
@@ -13,6 +13,42 @@ angular.module('niceElements')
13
13
  restrict: 'E',
14
14
  scope: {
15
15
  text: '@'
16
+ },
17
+ controller: function ($scope, $element, $timeout) {
18
+ // Setup popper
19
+ // https://popper.js.org/docs/v2/constructors/
20
+ $scope.setupPopper = function () {
21
+ var button = $element[0].getElementsByClassName('nice-help-button')[0];
22
+ var tooltip = $element[0].getElementsByClassName('nice-help-popup')[0];
23
+ $scope.popper = Popper.createPopper(button, tooltip, {
24
+ strategy: 'fixed',
25
+ placement: 'top',
26
+ scroll: true,
27
+ resize: true,
28
+ modifiers: [
29
+ {
30
+ name: 'offset',
31
+ options: {
32
+ offset: [0, 5],
33
+ },
34
+ },
35
+ {
36
+ name: 'arrow',
37
+ options: {
38
+ padding: 2,
39
+ },
40
+ }
41
+ ],
42
+ });
43
+ };
44
+
45
+ // $timeout(function () {
46
+ // $scope.setupPopper();
47
+ // });
48
+
49
+ $scope.onHover = function () {
50
+ $scope.setupPopper();
51
+ }
16
52
  }
17
53
  };
18
54
  });
@@ -3,30 +3,26 @@
3
3
  position: relative;
4
4
  display: inline-block;
5
5
 
6
- i{
6
+ i {
7
7
  font-size: 14px;
8
8
  cursor: help;
9
9
  }
10
10
 
11
- &:hover{
12
- .help-window{
11
+ &:hover {
12
+ .nice-help-popup {
13
13
  display: block;
14
14
  }
15
15
  }
16
16
 
17
- .help-window{
17
+ .nice-help-popup {
18
18
  display: none;
19
- position: absolute;
19
+ z-index: 9999;
20
20
  background: $nice-help-popup-color;
21
21
  color: white;
22
22
  max-width: 200px;
23
23
  width: max-content;
24
- bottom: 100%;
25
- left: 50%;
26
24
  border-radius: $nice-border-radius;
27
25
  font-size: 12px;
28
- z-index: 99999;
29
- transform: translate(-50%, -3px);
30
26
  line-height: 1.3;
31
27
  padding: 7px 10px;
32
28
  font-weight: normal;
@@ -37,20 +33,40 @@
37
33
  text-transform: none;
38
34
  }
39
35
 
36
+ .nice-help-arrow,
37
+ .nice-help-arrow::before {
38
+ position: absolute;
39
+ width: 8px;
40
+ height: 8px;
41
+ background: inherit;
42
+ }
43
+
44
+ .nice-help-arrow {
45
+ visibility: hidden;
46
+ }
40
47
 
41
- &:before {
48
+ .nice-help-arrow::before {
49
+ visibility: visible;
42
50
  content: "";
43
- width: 0;
44
- height: 0;
45
- position: absolute;
46
- bottom: -3px;
47
- left: 50%;
48
- margin-left: -5px;
51
+ transform: rotate(45deg);
52
+ }
53
+
54
+ &[data-popper-placement^="top"]>.nice-help-arrow {
55
+ bottom: -2px;
56
+ margin-left: -4px;
57
+ }
58
+
59
+ &[data-popper-placement^="bottom"]>.nice-help-arrow {
60
+ top: -2px;
61
+ margin-left: -4px;
62
+ }
63
+
64
+ &[data-popper-placement^="left"]>.nice-help-arrow {
65
+ right: 1px;
66
+ }
49
67
 
50
- border-bottom: 0px solid transparent;
51
- border-left: 5px solid transparent;
52
- border-right: 5px solid transparent;
53
- border-top: 3px solid $nice-help-popup-color;
68
+ &[data-popper-placement^="right"]>.nice-help-arrow {
69
+ left: -6px;
54
70
  }
55
71
  }
56
- }
72
+ }