vgapp 0.7.3 → 0.7.4

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.
@@ -31,6 +31,8 @@ const NAME_KEY = 'vg.fs';
31
31
  /**
32
32
  * Constants Events
33
33
  */
34
+ const CLASS_NAME_ALERT = 'vg-form-sender-alert';
35
+
34
36
  const EVENT_KEY_SUCCESS = 'vg.fs.success';
35
37
  const EVENT_KEY_ERROR = 'vg.fs.error';
36
38
  const EVENT_KEY_BEFORE = 'vg.fs.before';
@@ -297,7 +299,7 @@ class VGFormSender extends BaseModule {
297
299
  }
298
300
  } else {
299
301
  if ('errors' in response && normalizeData(response.errors)) {
300
- status = normalizeData(response.errors) ? 'error' : 'success';
302
+ status = normalizeData(response.errors) ? 'danger' : 'success';
301
303
  }
302
304
  }
303
305
  }
@@ -388,7 +390,9 @@ class VGFormSender extends BaseModule {
388
390
  }
389
391
 
390
392
  setDataRelationStatus($element, status, data, type) {
391
- let $alert = Selectors.find('.vg-alert-' + status, $element);
393
+ if (status === 'error') status = 'danger';
394
+
395
+ let $alert = Selectors.find('.'+ CLASS_NAME_ALERT +'-' + status, $element);
392
396
 
393
397
  if (isObject(data)) {
394
398
  if (status === 'error') {
@@ -435,11 +439,11 @@ class VGFormSender extends BaseModule {
435
439
  code = ' ' + data.text + ' (' + data.code + ')';
436
440
  }
437
441
 
438
- if (!title) txt += '<h4 class="vg-alert-content--title">' + code + '</h4>';
439
- else txt += '<h4 class="vg-alert-content--title">' + title + '</h4>';
442
+ if (!title) txt += '<h4 class="'+ CLASS_NAME_ALERT +'-content--title">' + code + '</h4>';
443
+ else txt += '<h4 class="'+ CLASS_NAME_ALERT +'-content--title">' + title + '</h4>';
440
444
 
441
445
  if ('message' in response) {
442
- txt += '<div class="vg-alert-content--message">' + response.message + '</div>'
446
+ txt += '<div class="'+ CLASS_NAME_ALERT +'-content--message">' + response.message + '</div>'
443
447
  }
444
448
 
445
449
  if ('errors' in response && this._params.alert.errors) {
@@ -469,13 +473,13 @@ class VGFormSender extends BaseModule {
469
473
 
470
474
  if (!$alert) {
471
475
  $alert = document.createElement('div');
472
- $alert.classList.add('vg-alert', 'vg-alert-' + status, 'vg-alert-' + type);
476
+ $alert.classList.add(CLASS_NAME_ALERT, CLASS_NAME_ALERT + '-' + status, CLASS_NAME_ALERT + '-' + type);
473
477
 
474
478
  let content = document.createElement('div');
475
- content.classList.add('vg-alert-content');
479
+ content.classList.add(CLASS_NAME_ALERT + '-content');
476
480
 
477
481
  let icon = document.createElement('div');
478
- icon.classList.add('vg-alert-content--icon');
482
+ icon.classList.add(CLASS_NAME_ALERT + '-content--icon');
479
483
 
480
484
  let i = document.createElement('i');
481
485
  i.innerHTML = getSVG(status);
@@ -484,13 +488,13 @@ class VGFormSender extends BaseModule {
484
488
  content.append(icon);
485
489
 
486
490
  let text = document.createElement('div');
487
- text.classList.add('vg-alert-content--text');
491
+ text.classList.add(CLASS_NAME_ALERT + '-content--text');
488
492
  text.innerHTML = data.view;
489
493
 
490
494
  content.append(text);
491
495
  $alert.append(content);
492
496
  } else {
493
- let text = Selectors.find('.vg-alert-content--text', $alert);
497
+ let text = Selectors.find('.'+ CLASS_NAME_ALERT +'-content--text', $alert);
494
498
  text.innerHTML = data.view;
495
499
  }
496
500
 
@@ -1,3 +1,3 @@
1
1
  $form-sender-map: (
2
2
  'eye-color': $color
3
- );
3
+ );
@@ -6,10 +6,10 @@
6
6
  *--------------------------------------------------------------------------
7
7
  **/
8
8
 
9
- @import "../../../utils/scss/functions";
10
- @import "../../../utils/scss/mixin";
11
- @import "../../../utils/scss/variables";
12
- @import "variables";
9
+ @import '../../../utils/scss/functions';
10
+ @import '../../../utils/scss/mixin';
11
+ @import '../../../utils/scss/variables';
12
+ @import 'variables';
13
13
 
14
14
  .vg-form-sender {
15
15
  @include mix-vars('form-sender', $form-sender-map);
@@ -45,4 +45,53 @@
45
45
  right: 34px;
46
46
  }
47
47
  }
48
+ }
49
+
50
+ .vg-form-sender-alert {
51
+ @include mix-alert-color-mode($class: vg-form-sender-alert);
52
+
53
+ background-color: var(--vg-form-sender-alert-background-color);
54
+ border: 1px solid var(--vg-form-sender-alert-border-color) ;
55
+ border-radius: var(--vg-border-radius);
56
+
57
+ &.vg-form-sender-alert-modal {
58
+ height: 260px;
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+
63
+ .vg-form-sender-alert-content {
64
+ display: flex;
65
+ flex-direction: column;
66
+ align-items: center;
67
+ gap: 1.5rem;
68
+ }
69
+
70
+ .vg-form-sender-alert-content--text {
71
+ text-align: center;
72
+ }
73
+ }
74
+
75
+ &.vg-form-sender-alert-collapse {
76
+ margin-bottom: 2rem;
77
+ padding: 2rem;
78
+
79
+ .vg-form-sender-alert-content {
80
+ display: flex;
81
+ gap: 2rem;
82
+ }
83
+ }
84
+ }
85
+
86
+ .vg-form-sender-alert-content--icon {
87
+ svg {
88
+ path {
89
+ fill: var(--vg-form-sender-alert-icon);
90
+ }
91
+ }
92
+ }
93
+
94
+ .vg-form-sender-alert-content--text {
95
+ font-size: 1.25rem;
96
+ color: var(--vg-form-sender-alert-color);
48
97
  }
@@ -70,12 +70,12 @@ class VGLoadMore extends BaseModule{
70
70
  buttonParams = normalizeData(el.dataset.button);
71
71
 
72
72
  if (!isObject(buttonParams)) {
73
- console.log('Дата атрибут data-button должен быть в формате json и передавать объект');
73
+ console.error('Дата атрибут data-button должен быть в формате json и передавать объект');
74
74
  return;
75
75
  }
76
76
 
77
77
  if (limit < offset) {
78
- console.log('Параметр offset должен быть меньше или равен параметру limit');
78
+ console.error('Параметр offset должен быть меньше или равен параметру limit');
79
79
  return;
80
80
  }
81
81
 
@@ -167,7 +167,7 @@ class VGRollup extends BaseModule {
167
167
  element.classList.add(_this.classes.ellipsis);
168
168
  element.style.webkitLineClamp = line;
169
169
  } else {
170
- console.log("Переменная [data-line] или параметр[line] не должны быть пустыми");
170
+ console.error("Переменная [data-line] или параметр[line] не должны быть пустыми");
171
171
  }
172
172
  }
173
173
  }
@@ -308,7 +308,6 @@ class VGSelect extends BaseModule {
308
308
  let observer = new MutationObserver(() => {
309
309
  clearTimeout(observerTimout);
310
310
  observerTimout = setTimeout(() => {
311
- console.log('asdas')
312
311
  VGSelect.build(select, true);
313
312
  }, 10);
314
313
  });
@@ -51,7 +51,6 @@ class VGSpy extends BaseModule {
51
51
  parentScrollTop: 0
52
52
  }
53
53
  this._params = this._configAfterMerge(this._params);
54
- console.log(this._params)
55
54
 
56
55
  this.refresh();
57
56
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Animation Loader
3
+ */
4
+ @keyframes vgLoader {
5
+ 0% {
6
+ transform: rotate(0deg);
7
+ }
8
+ 100% {
9
+ transform: rotate(360deg);
10
+ }
11
+ }
@@ -1,6 +1,7 @@
1
1
  @import "../../utils/scss/functions";
2
- @import "../../utils/scss/mixin";
3
2
  @import "../../utils/scss/variables";
3
+ @import "../../utils/scss/mixin";
4
+ @import "../../utils/scss/animation";
4
5
 
5
6
  .vg-backdrop {
6
7
  @include mix-vars('backdrop', $backdrop-map);
@@ -60,6 +61,7 @@
60
61
  width: 7em;
61
62
  height: 7em;
62
63
  }
64
+
63
65
  .vg-loader {
64
66
  @include mix-vars('loader', $loader-map);
65
67
  margin: var(--vg-loader-margin);
@@ -72,144 +74,4 @@
72
74
  border-left: var(--vg-loader-border-width) var(--vg-loader-border-style) var(--vg-loader-color);
73
75
  transform: var(--vg-loader-transform);
74
76
  animation: var(--vg-loader-animation);
75
- }
76
-
77
- /**
78
- * UI before Animation
79
- */
80
- .ui-success {
81
- &-circle {
82
- stroke-dasharray: 260.75219024795285px, 260.75219024795285px;
83
- stroke-dashoffset: 270.75219024795285px;
84
- transform: rotate(0);
85
- transform-origin: center center;
86
- stroke-linecap: round;
87
- animation: ani-success-circle 1s ease-in both;
88
- }
89
- &-path {
90
- stroke-dasharray: 60px 64px;
91
- stroke-dashoffset: 62px;
92
- stroke-linecap: round;
93
- animation: ani-success-path 0.4s 1s ease-in both;
94
- }
95
- }
96
-
97
- .ui-error {
98
- &-circle {
99
- stroke-dasharray: 260.75219024795285px, 260.75219024795285px;
100
- stroke-dashoffset: 260.75219024795285px;
101
- animation: ani-error-circle 1.2s linear;
102
- }
103
- &-line1 {
104
- stroke-dasharray: 54px 55px;
105
- stroke-dashoffset: 55px;
106
- stroke-linecap: round;
107
- animation: ani-error-line 0.15s 1.2s linear both;
108
- }
109
- &-line2 {
110
- stroke-dasharray: 54px 55px;
111
- stroke-dashoffset: 55px;
112
- stroke-linecap: round;
113
- animation: ani-error-line 0.2s 0.9s linear both;
114
- }
115
- }
116
-
117
- .ui-waiting {
118
- &-circle {
119
- stroke-dasharray: 260.75219024795285px, 260.75219024795285px;
120
- stroke-dashoffset: 260.75219024795285px;
121
- animation: ani-waiting-circle 1.2s linear;
122
- }
123
- &-line1 {
124
- stroke-dasharray: 280.75219024795285px, 200.75219024795285px;
125
- stroke-dashoffset: 280.75219024795285px;
126
- animation: ani-waiting-line 0.8s 0.3s linear both;
127
- transform: rotate(0);
128
- transform-origin: center center;
129
- }
130
- &-line2 {
131
- stroke-dasharray: 54px 55px;
132
- stroke-dashoffset: 55px;
133
- animation: ani-waiting-line2 0.85s .6s ease-in both;
134
- transform: rotate(0) scale(0.9);
135
- transform-origin: center center;
136
- }
137
- }
138
-
139
- /**
140
- * Animation Loader
141
- */
142
- @keyframes vgLoader {
143
- 0% {
144
- transform: rotate(0deg);
145
- }
146
- 100% {
147
- transform: rotate(360deg);
148
- }
149
- }
150
-
151
- // success animation
152
- @keyframes ani-success-circle {
153
- to {
154
- stroke-dashoffset: 782.2565707438586px;
155
- }
156
- }
157
-
158
- @keyframes ani-success-path {
159
- 0% {
160
- stroke-dashoffset: 62px;
161
- }
162
- 65% {
163
- stroke-dashoffset: -5px;
164
- }
165
- 84% {
166
- stroke-dashoffset: 4px;
167
- }
168
- 100% {
169
- stroke-dashoffset: -2px;
170
- }
171
- }
172
-
173
- // error animation
174
- @keyframes ani-error-line {
175
- to {
176
- stroke-dashoffset: 0;
177
- }
178
- }
179
-
180
- @keyframes ani-error-circle {
181
- 0% {
182
- stroke-dasharray: 0, 260.75219024795285px;
183
- stroke-dashoffset: 0;
184
- }
185
- 35% {
186
- stroke-dasharray: 120px, 120px;
187
- stroke-dashoffset: -120px;
188
- }
189
- 70% {
190
- stroke-dasharray: 0, 260.75219024795285px;
191
- stroke-dashoffset: -260.75219024795285px;
192
- }
193
- 100% {
194
- stroke-dasharray: 260.75219024795285px, 0;
195
- stroke-dashoffset: -260.75219024795285px;
196
- }
197
- }
198
-
199
- // waiting animation
200
- @keyframes ani-waiting-circle {
201
- to {
202
- stroke-dashoffset: 782.2565707438586px;
203
- }
204
- }
205
- @keyframes ani-waiting-line {
206
- to {
207
- stroke-dashoffset: 0;
208
- }
209
- }
210
- @keyframes ani-waiting-line2 {
211
- to {
212
- stroke-dashoffset: 0;
213
- transform: rotate(360deg) scale(1);
214
- }
215
77
  }
@@ -19,4 +19,22 @@
19
19
 
20
20
  @function tint-color($color, $weight) {
21
21
  @return mix(white, $color, $weight);
22
+ }
23
+
24
+ @function get-alert-color($type) {
25
+ @if $type == success {
26
+ @return $success-map;
27
+ }
28
+
29
+ @if $type == danger {
30
+ @return $danger-map;
31
+ }
32
+
33
+ @if $type == warning {
34
+ @return $warning-map;
35
+ }
36
+
37
+ @if $type == info {
38
+ @return $info-map;
39
+ }
22
40
  }
@@ -8,4 +8,16 @@
8
8
  --vg-#{$module}-#{$key}: #{$value}
9
9
  }
10
10
  }
11
+ }
12
+
13
+ @mixin mix-alert-color-mode($class) {
14
+ $colors: ['success', 'info', 'warning', 'danger'];
15
+
16
+ @each $value in $colors {
17
+ &.#{$class}-#{$value} {
18
+ @each $property, $val in get-alert-color($value) {
19
+ --#{$class}-#{$property}: #{$val};
20
+ }
21
+ }
22
+ }
11
23
  }
@@ -54,25 +54,25 @@ $loader-map: (
54
54
  );
55
55
 
56
56
  // Colors Status
57
- $danger: #dc3545 !default;
58
- $danger-border: tint-color($danger, 60%) !default;
59
- $danger-text: shade-color($danger, 60%) !default;
60
- $danger-bg: tint-color($danger, 80%) !default;
57
+ $danger: #FF2A2C !default;
58
+ $danger-border: #FFCCC7 !default;
59
+ $danger-text: #DF0306 !default;
60
+ $danger-bg: #FFF2F0 !default;
61
61
 
62
- $success: #198754;
63
- $success-border: tint-color($success, 60%) !default;
64
- $success-text: shade-color($success, 60%) !default;
65
- $success-bg: tint-color($success, 80%) !default;
62
+ $success: #4FD90B;
63
+ $success-border: #BAF98A !default;
64
+ $success-text: #40BE02 !default;
65
+ $success-bg: #F6FFED !default;
66
66
 
67
67
  $warning: #FFC107;
68
- $warning-border: tint-color($warning, 60%) !default;
69
- $warning-text: shade-color($warning, 60%) !default;
70
- $warning-bg: tint-color($warning, 80%) !default;
68
+ $warning-border: #FFDE79 !default;
69
+ $warning-text: #FFC107 !default;
70
+ $warning-bg: #FFF6DA !default;
71
71
 
72
- $info: #0DCAF0;
73
- $info-border: tint-color($info, 60%) !default;
74
- $info-text: shade-color($info, 60%) !default;
75
- $info-bg: tint-color($info, 80%) !default;
72
+ $info: #1F8BFF;
73
+ $info-border: #F0FAFF !default;
74
+ $info-text: #0471E5 !default;
75
+ $info-bg: #ADDDFF !default;
76
76
 
77
77
  $dark: #232323;
78
78
  $dark-border: shade-color($dark, 60%) !default;
@@ -80,24 +80,28 @@ $dark-text: tint-color($dark, 60%) !default;
80
80
  $dark-bg: shade-color($dark, 80%) !default;
81
81
 
82
82
  $success-map: (
83
+ icon: $success,
83
84
  color: $success-text,
84
85
  border-color: $success-border,
85
86
  background-color: $success-bg
86
87
  );
87
88
 
88
89
  $danger-map: (
90
+ icon: $danger,
89
91
  color: $danger-text,
90
92
  border-color: $danger-border,
91
93
  background-color: $danger-bg
92
94
  );
93
95
 
94
96
  $warning-map: (
97
+ icon: $warning,
95
98
  color: $warning-text,
96
99
  border-color: $warning-border,
97
100
  background-color: $warning-bg
98
101
  );
99
102
 
100
103
  $info-map: (
104
+ icon: $info,
101
105
  color: $info-text,
102
106
  border-color: $info-border,
103
107
  background-color: $info-bg