nice-elements 1.10.11 → 1.10.13

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.10.11",
3
+ "version": "1.10.13",
4
4
  "description": "Nice elements used in olaii angular 1.x webapps.",
5
5
  "main": "dist/nice.js",
6
6
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
 
45
45
  &.nice-component-inline {
46
46
  ul {
47
- margin-top: unset;
47
+ margin-top: 2px;
48
48
  }
49
49
  }
50
50
 
@@ -11,6 +11,9 @@ angular.module('niceElements')
11
11
  return {
12
12
  templateUrl: 'src/components/nice-svgs/nice-svgs.html',
13
13
  restrict: 'E',
14
- transclude: true
14
+ transclude: true,
15
+ controller: function ($scope, DEPLOY) {
16
+ $scope.DEPLOY = DEPLOY;
17
+ }
15
18
  };
16
19
  });
@@ -1,72 +1,55 @@
1
1
  .nice-tooltip {
2
- $nice-help-popup-color: #3e3e3e;
3
- position: relative;
4
- display: inline-block;
5
2
  cursor: help;
3
+ }
6
4
 
7
- &:hover{
8
- .nice-tooltip-window {
9
- display: block;
10
- }
5
+ .nice-tooltip-window {
6
+ display: none;
7
+ position: relative;
8
+ background: var(--nice-help-popup-bg);
9
+ color: var(--nice-help-popup-color);
10
+ max-width: 200px;
11
+ width: max-content;
12
+ border-radius: var(--nice-border-radius);
13
+ font-size: 12px;
14
+ padding: 5px 10px;
15
+ font-weight: normal;
16
+ text-transform: none;
11
17
 
12
- &:before {
13
- display: block;
14
- }
18
+ &[data-show] {
19
+ display: block;
15
20
  }
16
21
 
17
- // &:before {
18
- // content: attr(nice-tooltip) " ";
19
- // display: none;
20
- // position: absolute;
21
- // background: $nice-help-popup-color;
22
- // color: white;
23
- // max-width: 200px;
24
- // width: max-content;
25
- // bottom: 100%;
26
- // left: 50%;
27
- // border-radius: $nice-border-radius;
28
- // font-size: 12px;
29
- // z-index: 99999;
30
- // transform: translate(-50%, -5px);
31
- // line-height: 1.3;
32
- // padding: 7px 10px;
33
- // font-weight: normal;
34
- // text-align: center;
35
- // text-transform: none;
36
- // }
37
-
38
- .nice-tooltip-window {
39
- display: none;
22
+ .nice-tooltip-window-arrow,
23
+ .nice-tooltip-window-arrow::before {
40
24
  position: absolute;
41
- background: $nice-help-popup-color;
42
- color: white;
43
- max-width: 200px;
44
- width: max-content;
45
- bottom: 100%;
46
- left: 50%;
47
- border-radius: $nice-border-radius;
48
- font-size: 12px;
49
- z-index: 99999;
50
- transform: translate(-50%, -5px);
51
- line-height: 1.3;
52
- padding: 7px 10px;
53
- font-weight: normal;
54
- text-align: center;
55
- text-transform: none;
25
+ width: 8px;
26
+ height: 8px;
27
+ background: inherit;
28
+ }
56
29
 
57
- &:before {
58
- content: "";
59
- width: 0;
60
- height: 0;
61
- position: absolute;
62
- bottom: -3px;
63
- left: 50%;
64
- margin-left: -5px;
30
+ .nice-tooltip-window-arrow {
31
+ visibility: hidden;
65
32
 
66
- border-bottom: 0px solid transparent;
67
- border-left: 5px solid transparent;
68
- border-right: 5px solid transparent;
69
- border-top: 3px solid $nice-help-popup-color;
33
+ &::before {
34
+ visibility: visible;
35
+ content: "";
36
+ transform: rotate(45deg);
70
37
  }
71
38
  }
72
- }
39
+
40
+ &[data-popper-placement^="top"] > .nice-tooltip-window-arrow {
41
+ bottom: -4px;
42
+ }
43
+
44
+ &[data-popper-placement^="bottom"] > .nice-tooltip-window-arrow {
45
+ top: -4px;
46
+ }
47
+
48
+ &[data-popper-placement^="left"] > .nice-tooltip-window-arrow {
49
+ right: -4px;
50
+ }
51
+
52
+ &[data-popper-placement^="right"] > .nice-tooltip-window-arrow {
53
+ left: -4px;
54
+ }
55
+ }
@@ -9,15 +9,76 @@
9
9
  angular.module('niceElements')
10
10
  .directive('niceTooltip', function () {
11
11
  return {
12
- restrict: 'EA',
13
- link: function (scope, element, attrs) {
14
- element.addClass("nice-tooltip");
12
+ restrict: 'A',
13
+ controller: function ($scope, $element, $attrs) {
14
+ const id = Math.random().toString(36).substring(7);
15
+ const showEvents = ['mouseenter', 'focus'];
16
+ const hideEvents = ['mouseleave', 'blur'];
17
+ const placement = $attrs.niceTooltipPlacement || "top";
15
18
 
16
- var tooltipWindow = document.createElement('span')
19
+ // Create popper window
20
+ $element.addClass("nice-tooltip");
21
+ const tooltipWindow = document.createElement('div');
17
22
  tooltipWindow.className = 'nice-tooltip-window';
18
- tooltipWindow.innerHTML = attrs.niceTooltip;
23
+ tooltipWindow.id = 'nice-tooltip-window-' + id;
19
24
 
20
- element.append(tooltipWindow);
25
+ // Popper body
26
+ const tooltipWindowBody = document.createElement('div');
27
+ tooltipWindowBody.innerHTML = $attrs.niceTooltip;
28
+ tooltipWindow.append(tooltipWindowBody);
29
+
30
+ // Popper arrow
31
+ const tooltipWindowArrow = document.createElement('div');
32
+ tooltipWindowArrow.className = 'nice-tooltip-window-arrow';
33
+ tooltipWindowArrow.setAttribute("data-popper-arrow", "");
34
+ tooltipWindow.append(tooltipWindowArrow);
35
+
36
+ // Add to body
37
+ document.body.append(tooltipWindow);
38
+
39
+ // Setup popper
40
+ const popper = Popper.createPopper($element[0], tooltipWindow, {
41
+ placement: placement,
42
+ strategy: 'fixed',
43
+ modifiers: [
44
+ {
45
+ name: 'offset',
46
+ options: {
47
+ offset: [0, 8],
48
+ },
49
+ },
50
+ {
51
+ name: 'arrow',
52
+ options: {
53
+ element: tooltipWindowArrow,
54
+ padding: 3
55
+ },
56
+ },
57
+ ],
58
+ });
59
+
60
+ function show() {
61
+ tooltipWindow.setAttribute('data-show', '');
62
+ popper.update();
63
+ }
64
+
65
+ function hide() {
66
+ tooltipWindow.removeAttribute('data-show');
67
+ }
68
+
69
+ showEvents.forEach((event) => {
70
+ $element[0].addEventListener(event, show);
71
+ });
72
+
73
+ hideEvents.forEach((event) => {
74
+ $element[0].addEventListener(event, hide);
75
+ });
76
+
77
+ // On destroy
78
+ $scope.$on('$destroy', function () {
79
+ tooltipWindow.remove();
80
+ if (popper) popper.destroy();
81
+ });
21
82
  }
22
83
  };
23
84
  });
@@ -10,7 +10,7 @@ angular.module('niceElements')
10
10
  .service('NiceService', function ($rootScope) {
11
11
  var service = {
12
12
  name: "Nice elements",
13
- version: "1.10.11",
13
+ version: "1.10.13",
14
14
  getHeader: function () {
15
15
  return {};
16
16
  },
@@ -3,7 +3,6 @@ $nice-font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif !def
3
3
  $nice-font-weight: normal !default;
4
4
  $nice-font-color: #404040 !default;
5
5
 
6
-
7
6
  // ---------- Colors ----------
8
7
  $nice-base-color: #3189ff !default;
9
8
  $nice-base-color-lighter: lighten($nice-base-color, 10%) !default;
@@ -19,7 +18,7 @@ $nice-danger-color-lighter: lighten($nice-danger-color, 10%) !default;
19
18
  $nice-danger-color-darker: darken($nice-danger-color, 10%) !default;
20
19
  $nice-danger-color-plain: #ffe4e4 !default;
21
20
 
22
- $nice-success-color: #49AE50 !default;
21
+ $nice-success-color: #49ae50 !default;
23
22
  $nice-success-color-lighter: lighten($nice-success-color, 10%) !default;
24
23
  $nice-success-color-darker: darken($nice-success-color, 10%) !default;
25
24
  $nice-success-color-plain: #e2efe3 !default;
@@ -34,7 +33,6 @@ $nice-warning-color-lighter: lighten($nice-warning-color, 10%) !default;
34
33
  $nice-warning-color-darker: darken($nice-warning-color, 10%) !default;
35
34
  $nice-warning-color-plain: #fff9e8 !default;
36
35
 
37
-
38
36
  // ---------- Border ----------
39
37
  $nice-border-color: #cbd4d9 !default;
40
38
  $nice-border-radius: 3px !default;
@@ -42,25 +40,22 @@ $nice-border-radius-small: $nice-border-radius !default;
42
40
 
43
41
  $border-radius-base: 3px;
44
42
 
45
-
46
43
  // ---------- Disabled ----------
47
- $nice-disabled-color: #EDEFF2 !default;
48
- $nice-disabled-border: #D2D9D9 !default;
44
+ $nice-disabled-color: #edeff2 !default;
45
+ $nice-disabled-border: #d2d9d9 !default;
49
46
  $nice-disabled-bg: white !default;
50
47
 
51
-
52
48
  // ---------- Nice global settings ----------
53
49
  $nice-focus-bg: white !default;
54
50
  $nice-focus-border: $nice-base-color !default;
55
- $nice-focus-color: #474F52 !default;
51
+ $nice-focus-color: #474f52 !default;
56
52
 
57
53
  $nice-background: white !default;
58
- $nice-hover-color: #EDEDED !default;
54
+ $nice-hover-color: #ededed !default;
59
55
  $nice-box-shadow: 0 0 10px rgba(0, 0, 0, 0.1) !default;
60
56
 
61
57
  $nice-navbar-height: 50px;
62
58
 
63
-
64
59
  // ---------- Input colors override ----------
65
60
  $nice-label-color: $nice-font-color !default;
66
61
  $nice-input-placeholder-color: #999999 !default;
@@ -71,7 +66,6 @@ $nice-input-valid: $nice-base-color !default;
71
66
  $nice-input-invalid: $nice-danger-color !default;
72
67
  $nice-addon-bg: #f3f3f3 !default;
73
68
 
74
-
75
69
  // ---------- Dropdown colors override ----------
76
70
  $nice-dropdown-bg: $nice-background !default;
77
71
  $nice-dropdown-border: $nice-border-color !default;
@@ -79,12 +73,11 @@ $nice-dropdown-color: $nice-font-color !default;
79
73
 
80
74
  $nice-dropdown-hover-bg: white !default;
81
75
  $nice-dropdown-hover-border: $nice-border-color !default;
82
- $nice-dropdown-hover-color: #474F52 !default;
76
+ $nice-dropdown-hover-color: #474f52 !default;
83
77
 
84
78
  $nice-dropdown-disabled-bg: $nice-disabled-bg !default;
85
79
  $nice-dropdown-disabled-border: $nice-disabled-color !default;
86
80
 
87
-
88
81
  // ---------- Yes no colors override ----------
89
82
  $nice-yesno-bg: $nice-background !default;
90
83
  $nice-yesno-slider-bg: $nice-base-color !default;
@@ -93,18 +86,15 @@ $nice-yesno-disabled-color: $nice-disabled-color !default;
93
86
  $nice-yesno-disabled-bg: $nice-disabled-bg !default;
94
87
  $nice-yesno-disabled-border: $nice-disabled-border !default;
95
88
 
96
-
97
89
  // ---------- Choice colors override ----------
98
90
  $nice-choice-bg: $nice-background !default;
99
91
  $nice-choice-hover-border: $nice-base-color !default;
100
92
  $nice-choice-selected-bg: $nice-base-color !default;
101
93
  $nice-choice-selected-color: white !default;
102
94
 
103
-
104
95
  // ---------- Loader ----------
105
96
  $nice-loader-color: $nice-base-color !default;
106
97
 
107
-
108
98
  // ---------- Notifications ----------
109
99
  $nice-notification-color: white !default;
110
100
  $nice-notification-bg: $nice-base-color !default;
@@ -121,17 +111,14 @@ $nice-notification-success-bg: $nice-success-color !default;
121
111
  $nice-notification-info-color: $nice-notification-color !default;
122
112
  $nice-notification-info-bg: $nice-info-color !default;
123
113
 
124
-
125
114
  // ---------- Submenu ----------
126
115
  $nice-submenu-bg-color: #e1e5e8 !default;
127
116
  $nice-submenu-gray-color: #b0bec5 !default;
128
117
 
129
-
130
118
  // ---------- Table ----------
131
119
  $nice-table-bg-hover: #f5f5f5 !default;
132
120
  $nice-table-bg-active: #f5f5f5 !default;
133
121
 
134
-
135
122
  :root {
136
123
  // ---------- Fonts ----------
137
124
  --nice-font-family: #{$nice-font-family};
@@ -196,4 +183,8 @@ $nice-table-bg-active: #f5f5f5 !default;
196
183
  // ---------- Input ----------
197
184
  --nice-input-bg: #{$nice-input-bg};
198
185
  --nice-input-bg-hover: #f7f7f7;
199
- }
186
+
187
+ // ---------- Tooltip ----------
188
+ --nice-help-popup-bg: #3e3e3e;
189
+ --nice-help-popup-color: white;
190
+ }