nice-elements 1.4.11 → 1.5.0

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.
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @ngdoc directive
5
+ * @name niceElements.directive:niceSvgs
6
+ * @description
7
+ * # niceSvgs
8
+ */
9
+ angular.module('niceElements')
10
+ .directive('niceSvgs', function () {
11
+ return {
12
+ templateUrl: 'src/components/nice-svgs/nice-svgs.html',
13
+ restrict: 'E',
14
+ transclude: true
15
+ };
16
+ });
@@ -0,0 +1,3 @@
1
+ <div class="nice-toasts" ng-class="position">
2
+ <div class="nice-toast" ng-class="toast.type" ng-repeat="toast in toasts">{{ toast.message }}</div>
3
+ </div>
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @ngdoc directive
5
+ * @name niceElements.directive:niceToast
6
+ * @description
7
+ * # niceToast
8
+ */
9
+ angular.module('niceElements')
10
+ .directive("niceToast", function () {
11
+ return {
12
+ restrict: "E",
13
+ templateUrl: "src/components/nice-toast/nice-toast.html",
14
+ scope: {
15
+ position: '@',
16
+ timeoutTime: '@',
17
+ },
18
+ controller: function ($scope, $timeout) {
19
+ if (!$scope.position) $scope.position = "bottom center";
20
+ if (!$scope.timeoutTime) $scope.timeoutTime = 2000;
21
+ $scope.toasts = [];
22
+
23
+ // -------------------------- Watch for events --------------------------
24
+ $scope.$on('toast', function (e, message, type) {
25
+ $scope.createToast(message, type);
26
+ });
27
+
28
+
29
+ // -------------------------- Create toast --------------------------
30
+ $scope.createToast = function (message, type) {
31
+ // Create new toast
32
+ var toast = {
33
+ id: Math.random().toString(36).replace(/[^a-z]+/g, '').substr(2, 10),
34
+ message: message,
35
+ type: type || "default"
36
+ };
37
+
38
+ // Append toast
39
+ $scope.toasts.push(toast);
40
+
41
+ // Remove after some time
42
+ $timeout(function () {
43
+ $scope.removeToast(toast);
44
+ }, $scope.timeoutTime);
45
+ };
46
+
47
+
48
+ // -------------------------- Remove toast --------------------------
49
+ $scope.removeToast = function (toast) {
50
+ var toastIndex = $scope.toasts.findIndex(function (a) { return a.id == toast.id })
51
+ if (toastIndex >= 0) {
52
+ $scope.toasts.splice(toastIndex, 1);
53
+ }
54
+ }
55
+ }
56
+ };
57
+ });
@@ -0,0 +1,75 @@
1
+ .nice-toasts {
2
+ z-index: 9999999;
3
+ position: fixed;
4
+
5
+ display: flex;
6
+ flex-direction: column;
7
+ align-items: center;
8
+
9
+ gap: 0.5rem;
10
+ padding: 1rem;
11
+
12
+ &.top {
13
+ top: $nice-navbar-height;
14
+ }
15
+
16
+ &.bottom {
17
+ bottom: 0;
18
+ flex-direction: column-reverse;
19
+ }
20
+
21
+ &.center {
22
+ right: 50%;
23
+ transform: translateX(50%);
24
+ }
25
+
26
+ &.left {
27
+ left: 0;
28
+ align-items: flex-start;
29
+ }
30
+
31
+ &.right {
32
+ right: 0;
33
+ align-items: flex-end;
34
+ }
35
+
36
+ .nice-toast {
37
+ background: $nice-hover-color;
38
+ padding: 0.3rem 1.2rem;
39
+ border-radius: 30px;
40
+ font-size: 0.8em;
41
+ font-weight: bold;
42
+ box-shadow: 0 0 30px rgba(0, 0, 0, 0.05);
43
+ max-width: 500px;
44
+
45
+ &.success {
46
+ color: white;
47
+ background: $nice-notification-success-bg;
48
+ }
49
+
50
+ &.error {
51
+ color: white;
52
+ background: $nice-notification-danger-color-bg;
53
+ }
54
+ }
55
+ }
56
+
57
+ .toast-enter-active {
58
+ animation: bounce-in .5s;
59
+ }
60
+
61
+ .toast-leave-active {
62
+ animation: bounce-in .5s reverse;
63
+ }
64
+
65
+ @keyframes bounce-in {
66
+ from {
67
+ transform: translateY(100%);
68
+ opacity: 1;
69
+ }
70
+
71
+ to {
72
+ transform: translateY(0);
73
+ opacity: 1;
74
+ }
75
+ }
@@ -7,14 +7,17 @@
7
7
  * # niceTooltip
8
8
  */
9
9
  angular.module('niceElements')
10
- .directive('niceTooltip', function() {
10
+ .directive('niceTooltip', function () {
11
11
  return {
12
12
  restrict: 'EA',
13
- link: function(scope, element, attrs) {
14
- var html = element.html();
13
+ link: function (scope, element, attrs) {
15
14
  element.addClass("nice-tooltip");
16
- html = html + "<span class='nice-tooltip-window'>" + attrs.niceTooltip + "</span>"
17
- element.html(html);
18
- }
15
+
16
+ var tooltipWindow = document.createElement('span')
17
+ tooltipWindow.className = 'nice-tooltip-window';
18
+ tooltipWindow.innerHTML = attrs.niceTooltip;
19
+
20
+ element.append(tooltipWindow);
21
+ }
19
22
  };
20
23
  });
@@ -10,7 +10,7 @@
10
10
  user-select: none;
11
11
  }
12
12
 
13
- .margin-bottom-0{
13
+ .margin-bottom-0 {
14
14
  margin-bottom: 0 !important;
15
15
  }
16
16
 
@@ -49,3 +49,6 @@
49
49
  @import "../components/nice-quantity/nice-quantity";
50
50
  @import "../components/nice-progress-bar/nice-progress-bar";
51
51
  @import "../components/nice-tooltip/nice-tooltip";
52
+ @import "../components/nice-popup/nice-popup";
53
+ @import "../components/nice-icon/nice-icon";
54
+ @import "../components/nice-toast/nice-toast";
@@ -1,5 +1,5 @@
1
1
  // ---------- Fonts ----------
2
- $nice-font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif !default;
2
+ $nice-font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif !default;
3
3
  $nice-font-weight: normal !default;
4
4
  $nice-font-color: #404040 !default;
5
5
 
@@ -15,86 +15,88 @@ $nice-warning-color: #ffc107 !default;
15
15
  // ---------- Border ----------
16
16
  $nice-border-color: #cbd4d9 !default;
17
17
  $nice-border-radius: 3px !default;
18
- $nice-border-radius-small: $nice-border-radius !default;
18
+ $nice-border-radius-small: $nice-border-radius !default;
19
19
 
20
20
  $border-radius-base: 3px;
21
21
 
22
22
 
23
23
  // ---------- Disabled ----------
24
24
  $nice-disabled-color: #EDEFF2 !default;
25
- $nice-disabled-border: #D2D9D9!default;
25
+ $nice-disabled-border: #D2D9D9 !default;
26
26
  $nice-disabled-bg: white !default;
27
27
 
28
28
 
29
29
  // ---------- Nice global settings ----------
30
30
  $nice-focus-bg: white !default;
31
- $nice-focus-border: $nice-base-color !default;
31
+ $nice-focus-border: $nice-base-color !default;
32
32
  $nice-focus-color: #474F52 !default;
33
33
 
34
34
  $nice-background: white !default;
35
35
  $nice-hover-color: #EDEDED !default;
36
36
  $nice-box-shadow: 0 0 10px rgba(0, 0, 0, 0.1) !default;
37
37
 
38
+ $nice-navbar-height: 50px;
39
+
38
40
 
39
41
  // ---------- Input colors override ----------
40
- $nice-label-color: $nice-font-color !default;
42
+ $nice-label-color: $nice-font-color !default;
41
43
  $nice-input-placeholder-color: #999999 !default;
42
- $nice-input-bg: $nice-background !default;
44
+ $nice-input-bg: $nice-background !default;
43
45
  $nice-input-disabled-bg: white !default;
44
- $nice-input-disabled-border: $nice-disabled-color !default;
45
- $nice-input-valid: $nice-base-color !default;
46
- $nice-input-invalid: $nice-danger-color !default;
46
+ $nice-input-disabled-border: $nice-disabled-color !default;
47
+ $nice-input-valid: $nice-base-color !default;
48
+ $nice-input-invalid: $nice-danger-color !default;
47
49
  $nice-addon-bg: #f3f3f3 !default;
48
50
 
49
51
 
50
52
  // ---------- Dropdown colors override ----------
51
- $nice-dropdown-bg: $nice-background !default;
52
- $nice-dropdown-border: $nice-border-color !default;
53
- $nice-dropdown-color: $nice-font-color !default;
53
+ $nice-dropdown-bg: $nice-background !default;
54
+ $nice-dropdown-border: $nice-border-color !default;
55
+ $nice-dropdown-color: $nice-font-color !default;
54
56
 
55
57
  $nice-dropdown-hover-bg: white !default;
56
- $nice-dropdown-hover-border: $nice-border-color !default;
58
+ $nice-dropdown-hover-border: $nice-border-color !default;
57
59
  $nice-dropdown-hover-color: #474F52 !default;
58
60
 
59
- $nice-dropdown-disabled-bg: $nice-disabled-bg !default;
60
- $nice-dropdown-disabled-border: $nice-disabled-color !default;
61
+ $nice-dropdown-disabled-bg: $nice-disabled-bg !default;
62
+ $nice-dropdown-disabled-border: $nice-disabled-color !default;
61
63
 
62
64
 
63
65
  // ---------- Yes no colors override ----------
64
- $nice-yesno-bg: $nice-background !default;
65
- $nice-yesno-slider-bg: $nice-base-color !default;
66
+ $nice-yesno-bg: $nice-background !default;
67
+ $nice-yesno-slider-bg: $nice-base-color !default;
66
68
 
67
- $nice-yesno-disabled-color: $nice-disabled-color !default;
68
- $nice-yesno-disabled-bg: $nice-disabled-bg !default;
69
- $nice-yesno-disabled-border: $nice-disabled-border !default;
69
+ $nice-yesno-disabled-color: $nice-disabled-color !default;
70
+ $nice-yesno-disabled-bg: $nice-disabled-bg !default;
71
+ $nice-yesno-disabled-border: $nice-disabled-border !default;
70
72
 
71
73
 
72
74
  // ---------- Choice colors override ----------
73
- $nice-choice-bg: $nice-background !default;
74
- $nice-choice-hover-border: $nice-base-color !default;
75
- $nice-choice-selected-bg: $nice-base-color !default;
75
+ $nice-choice-bg: $nice-background !default;
76
+ $nice-choice-hover-border: $nice-base-color !default;
77
+ $nice-choice-selected-bg: $nice-base-color !default;
76
78
  $nice-choice-selected-color: white !default;
77
79
 
78
80
 
79
81
  // ---------- Loader ----------
80
- $nice-loader-color: $nice-base-color !default;
82
+ $nice-loader-color: $nice-base-color !default;
81
83
 
82
84
 
83
85
  // ---------- Notifications ----------
84
86
  $nice-notification-color: white !default;
85
- $nice-notification-bg: $nice-base-color !default;
87
+ $nice-notification-bg: $nice-base-color !default;
86
88
 
87
- $nice-notification-warning-color: $nice-notification-color !default;
88
- $nice-notification-warning-bg: $nice-warning-color !default;
89
+ $nice-notification-warning-color: $nice-notification-color !default;
90
+ $nice-notification-warning-bg: $nice-warning-color !default;
89
91
 
90
- $nice-notification-danger-color: $nice-notification-color !default;
91
- $nice-notification-danger-color-bg: $nice-danger-color !default;
92
+ $nice-notification-danger-color: $nice-notification-color !default;
93
+ $nice-notification-danger-color-bg: $nice-danger-color !default;
92
94
 
93
- $nice-notification-success-color: $nice-notification-color !default;
94
- $nice-notification-success-bg: $nice-success-color !default;
95
+ $nice-notification-success-color: $nice-notification-color !default;
96
+ $nice-notification-success-bg: $nice-success-color !default;
95
97
 
96
- $nice-notification-info-color: $nice-notification-color !default;
97
- $nice-notification-info-bg: $nice-info-color !default;
98
+ $nice-notification-info-color: $nice-notification-color !default;
99
+ $nice-notification-info-bg: $nice-info-color !default;
98
100
 
99
101
 
100
102
  // ---------- Submenu ----------