@product7/feedback-sdk 1.2.1 → 1.2.2
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,5 +1,4 @@
|
|
|
1
1
|
import { BaseWidget } from './BaseWidget.js';
|
|
2
|
-
|
|
3
2
|
export class ButtonWidget extends BaseWidget {
|
|
4
3
|
constructor(options) {
|
|
5
4
|
super({ ...options, type: 'button' });
|
|
@@ -17,13 +16,13 @@ export class ButtonWidget extends BaseWidget {
|
|
|
17
16
|
<span class="feedback-text">Feedback</span>
|
|
18
17
|
|
|
19
18
|
<div class="feedback-minimize-icon">
|
|
20
|
-
<svg viewBox="0 0 256 256"
|
|
19
|
+
<svg viewBox="0 0 256 256">
|
|
21
20
|
<path d="M213.66,53.66,163.31,104H192a8,8,0,0,1,0,16H144a8,8,0,0,1-8-8V64a8,8,0,0,1,16,0V92.69l50.34-50.35a8,8,0,0,1,11.32,11.32ZM112,136H64a8,8,0,0,0,0,16H92.69L42.34,202.34a8,8,0,0,0,11.32,11.32L104,163.31V192a8,8,0,0,0,16,0V144A8,8,0,0,0,112,136Z"/>
|
|
22
21
|
</svg>
|
|
23
22
|
</div>
|
|
24
23
|
|
|
25
24
|
<div class="feedback-expand-icon">
|
|
26
|
-
<svg viewBox="0 0 256 256"
|
|
25
|
+
<svg viewBox="0 0 256 256">
|
|
27
26
|
<path d="M112,40V64.69L61.66,14.34A8,8,0,0,0,50.34,25.66L100.69,76H72a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V36A8,8,0,0,0,112,40Zm131.06,70.61a8,8,0,0,0-8.72,1.73L184,162.69V136a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8h48a8,8,0,0,0,0-16H195.31l50.35-50.34A8,8,0,0,0,243.06,110.61Z"/>
|
|
28
27
|
</svg>
|
|
29
28
|
</div>
|
|
@@ -43,22 +42,22 @@ export class ButtonWidget extends BaseWidget {
|
|
|
43
42
|
const expandIcon = this.element.querySelector('.feedback-expand-icon');
|
|
44
43
|
|
|
45
44
|
button.addEventListener('click', (e) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const clickedMinimize = e.target.closest('.feedback-minimize-icon');
|
|
46
|
+
const clickedExpand = e.target.closest('.feedback-expand-icon');
|
|
47
|
+
|
|
48
|
+
if (clickedMinimize) {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
this.minimize();
|
|
51
|
+
} else if (clickedExpand) {
|
|
52
|
+
e.stopPropagation();
|
|
53
|
+
this.restore();
|
|
54
|
+
} else {
|
|
55
|
+
if (!this.isMinimized) {
|
|
56
|
+
this.openPanel();
|
|
57
|
+
}
|
|
49
58
|
}
|
|
50
59
|
});
|
|
51
60
|
|
|
52
|
-
minimizeIcon.addEventListener('click', (e) => {
|
|
53
|
-
e.stopPropagation();
|
|
54
|
-
this.minimize();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
expandIcon.addEventListener('click', (e) => {
|
|
58
|
-
e.stopPropagation();
|
|
59
|
-
this.restore();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
61
|
button.addEventListener('mouseenter', () => {
|
|
63
62
|
if (!this.state.isSubmitting && !this.isMinimized) {
|
|
64
63
|
button.style.transform = 'translateY(-2px)';
|
|
@@ -66,7 +65,9 @@ export class ButtonWidget extends BaseWidget {
|
|
|
66
65
|
});
|
|
67
66
|
|
|
68
67
|
button.addEventListener('mouseleave', () => {
|
|
69
|
-
|
|
68
|
+
if (!this.isMinimized) {
|
|
69
|
+
button.style.transform = 'translateY(0)';
|
|
70
|
+
}
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
|