react-visual-feedback 1.0.0 → 1.1.1
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/LICENSE +2 -2
- package/README.md +65 -34
- package/dist/index.esm.js +21 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 Murali
|
|
3
|
+
Copyright (c) 2025 Murali Vvrsn Gurajapu
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# React Visual Feedback
|
|
2
2
|
|
|
3
3
|
A powerful, visual feedback collection tool for React applications. Users can select any element on your page, and the widget automatically captures a screenshot and context information.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- 🎯 Visual element selection with hover highlighting
|
|
8
|
-
- 📸 Automatic screenshot capture of selected elements
|
|
8
|
+
- 📸 Automatic screenshot capture of selected elements with perfect CSS rendering
|
|
9
9
|
- 📝 Feedback form with rich context
|
|
10
10
|
- ⚡ Lightweight and performant
|
|
11
|
-
- 🎨
|
|
12
|
-
- ⌨️ Keyboard shortcuts (Ctrl+Q to activate, Esc to cancel)
|
|
11
|
+
- 🎨 Works with any CSS framework (Tailwind, Bootstrap, Material-UI, etc.)
|
|
12
|
+
- ⌨️ Keyboard shortcuts (Ctrl+Q to activate, Esc to cancel, Ctrl+Enter to submit)
|
|
13
|
+
- 🌓 Dark mode support
|
|
13
14
|
|
|
14
15
|
## Installation
|
|
15
16
|
|
|
16
17
|
```bash
|
|
17
|
-
npm install
|
|
18
|
+
npm install react-visual-feedback
|
|
18
19
|
```
|
|
19
20
|
|
|
20
21
|
**Important:** Import the CSS file in your application:
|
|
21
22
|
|
|
22
23
|
```jsx
|
|
23
|
-
import '
|
|
24
|
+
import 'react-visual-feedback/dist/index.css';
|
|
24
25
|
```
|
|
25
26
|
|
|
26
27
|
## Quick Start
|
|
@@ -29,8 +30,8 @@ import 'murali-feedback-widget-react/dist/index.css';
|
|
|
29
30
|
|
|
30
31
|
```jsx
|
|
31
32
|
import React from 'react';
|
|
32
|
-
import { FeedbackProvider } from '
|
|
33
|
-
import '
|
|
33
|
+
import { FeedbackProvider } from 'react-visual-feedback';
|
|
34
|
+
import 'react-visual-feedback/dist/index.css';
|
|
34
35
|
|
|
35
36
|
function App() {
|
|
36
37
|
const handleFeedbackSubmit = async (feedbackData) => {
|
|
@@ -56,7 +57,7 @@ export default App;
|
|
|
56
57
|
### 2. Add a feedback trigger button (optional)
|
|
57
58
|
|
|
58
59
|
```jsx
|
|
59
|
-
import { useFeedback } from '
|
|
60
|
+
import { useFeedback } from 'react-visual-feedback';
|
|
60
61
|
|
|
61
62
|
function FeedbackButton() {
|
|
62
63
|
const { setIsActive } = useFeedback();
|
|
@@ -71,14 +72,16 @@ function FeedbackButton() {
|
|
|
71
72
|
|
|
72
73
|
## Usage
|
|
73
74
|
|
|
74
|
-
### Keyboard
|
|
75
|
-
|
|
75
|
+
### Keyboard Shortcuts
|
|
76
|
+
- **Ctrl+Q** - Activate feedback mode
|
|
77
|
+
- **Esc** - Cancel/deactivate
|
|
78
|
+
- **Ctrl+Enter** - Submit feedback (when form is open)
|
|
76
79
|
|
|
77
80
|
### Programmatic Activation (Uncontrolled Mode)
|
|
78
81
|
Use the `useFeedback` hook to control the widget programmatically:
|
|
79
82
|
|
|
80
83
|
```jsx
|
|
81
|
-
import { useFeedback } from '
|
|
84
|
+
import { useFeedback } from 'react-visual-feedback';
|
|
82
85
|
|
|
83
86
|
function MyComponent() {
|
|
84
87
|
const { isActive, setIsActive } = useFeedback();
|
|
@@ -96,7 +99,7 @@ You can control the widget's active state from the parent component:
|
|
|
96
99
|
|
|
97
100
|
```jsx
|
|
98
101
|
import React, { useState } from 'react';
|
|
99
|
-
import { FeedbackProvider } from '
|
|
102
|
+
import { FeedbackProvider } from 'react-visual-feedback';
|
|
100
103
|
|
|
101
104
|
function App() {
|
|
102
105
|
const [isFeedbackActive, setIsFeedbackActive] = useState(false);
|
|
@@ -144,9 +147,20 @@ The main provider component that wraps your application.
|
|
|
144
147
|
tagName: "div",
|
|
145
148
|
id: "element-id",
|
|
146
149
|
className: "element-classes",
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
selector: "div.card > button.primary",
|
|
151
|
+
textContent: "Element text content",
|
|
152
|
+
position: {
|
|
153
|
+
x: 100,
|
|
154
|
+
y: 200,
|
|
155
|
+
width: 300,
|
|
156
|
+
height: 50
|
|
157
|
+
},
|
|
158
|
+
styles: {
|
|
159
|
+
backgroundColor: "rgb(255, 255, 255)",
|
|
160
|
+
color: "rgb(0, 0, 0)",
|
|
161
|
+
fontSize: "16px",
|
|
162
|
+
fontFamily: "Arial, sans-serif"
|
|
163
|
+
}
|
|
150
164
|
},
|
|
151
165
|
screenshot: "data:image/png;base64,...", // Base64 encoded screenshot
|
|
152
166
|
url: "https://yourapp.com/current-page",
|
|
@@ -173,13 +187,16 @@ The widget comes with default styles, but you can customize them by targeting th
|
|
|
173
187
|
.feedback-tooltip { /* Element info tooltip */ }
|
|
174
188
|
.feedback-modal { /* Feedback form modal */ }
|
|
175
189
|
.feedback-backdrop { /* Modal backdrop */ }
|
|
190
|
+
.feedback-modal-content { /* Modal content container */ }
|
|
191
|
+
.feedback-screenshot { /* Screenshot preview */ }
|
|
176
192
|
```
|
|
177
193
|
|
|
178
194
|
## Example Implementation
|
|
179
195
|
|
|
180
196
|
```jsx
|
|
181
197
|
import React from 'react';
|
|
182
|
-
import { FeedbackProvider, useFeedback } from '
|
|
198
|
+
import { FeedbackProvider, useFeedback } from 'react-visual-feedback';
|
|
199
|
+
import 'react-visual-feedback/dist/index.css';
|
|
183
200
|
|
|
184
201
|
function FeedbackButton() {
|
|
185
202
|
const { isActive, setIsActive } = useFeedback();
|
|
@@ -191,15 +208,17 @@ function FeedbackButton() {
|
|
|
191
208
|
position: 'fixed',
|
|
192
209
|
bottom: '20px',
|
|
193
210
|
right: '20px',
|
|
194
|
-
padding: '
|
|
195
|
-
background: '#
|
|
211
|
+
padding: '12px 24px',
|
|
212
|
+
background: isActive ? '#ef4444' : '#3b82f6',
|
|
196
213
|
color: 'white',
|
|
197
214
|
border: 'none',
|
|
198
|
-
borderRadius: '
|
|
199
|
-
cursor: 'pointer'
|
|
215
|
+
borderRadius: '8px',
|
|
216
|
+
cursor: 'pointer',
|
|
217
|
+
fontWeight: 'bold',
|
|
218
|
+
boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)'
|
|
200
219
|
}}
|
|
201
220
|
>
|
|
202
|
-
{isActive ? '
|
|
221
|
+
{isActive ? '✕ Cancel' : '💬 Report Issue'}
|
|
203
222
|
</button>
|
|
204
223
|
);
|
|
205
224
|
}
|
|
@@ -217,7 +236,6 @@ function App() {
|
|
|
217
236
|
alert('Thank you for your feedback!');
|
|
218
237
|
}
|
|
219
238
|
} catch (error) {
|
|
220
|
-
console.error('Failed to submit feedback:', error);
|
|
221
239
|
alert('Failed to submit feedback. Please try again.');
|
|
222
240
|
}
|
|
223
241
|
};
|
|
@@ -241,9 +259,9 @@ export default App;
|
|
|
241
259
|
1. User activates the widget (Ctrl+Q or button click)
|
|
242
260
|
2. User hovers over elements to see them highlighted
|
|
243
261
|
3. User clicks on the problematic element
|
|
244
|
-
4. Widget captures a screenshot of the selected element
|
|
245
|
-
5. Feedback form appears with element context pre-filled
|
|
246
|
-
6. User enters their feedback and submits
|
|
262
|
+
4. Widget captures a pixel-perfect screenshot of the selected element
|
|
263
|
+
5. Feedback form appears with element context pre-filled and large screenshot preview
|
|
264
|
+
6. User enters their feedback and submits (or presses Ctrl+Enter)
|
|
247
265
|
7. Your `onSubmit` handler receives all the data
|
|
248
266
|
|
|
249
267
|
## Browser Support
|
|
@@ -253,13 +271,20 @@ export default App;
|
|
|
253
271
|
- Safari: ✅
|
|
254
272
|
- Opera: ✅
|
|
255
273
|
|
|
256
|
-
|
|
274
|
+
## Screenshot Capture
|
|
275
|
+
|
|
276
|
+
The widget uses `html-to-image` library for accurate screenshot capture with fallback to `html2canvas`. This ensures:
|
|
277
|
+
- Perfect CSS rendering including Tailwind, Bootstrap, and custom styles
|
|
278
|
+
- Accurate colors, fonts, and layout
|
|
279
|
+
- Support for gradients, shadows, and modern CSS features
|
|
280
|
+
- High-resolution screenshots (2x pixel ratio)
|
|
257
281
|
|
|
258
282
|
## Dependencies
|
|
259
283
|
|
|
260
284
|
- React ^16.8.0 || ^17.0.0 || ^18.0.0
|
|
261
285
|
- react-dom ^16.8.0 || ^17.0.0 || ^18.0.0
|
|
262
|
-
-
|
|
286
|
+
- html-to-image ^1.11.13
|
|
287
|
+
- html2canvas ^1.4.1 (fallback)
|
|
263
288
|
- lucide-react ^0.263.1
|
|
264
289
|
|
|
265
290
|
## Local Development & Testing
|
|
@@ -285,13 +310,14 @@ npm install
|
|
|
285
310
|
npm run dev
|
|
286
311
|
```
|
|
287
312
|
|
|
288
|
-
The example app will open at `http://localhost:
|
|
313
|
+
The example app will open at `http://localhost:8080` with a fully working demo!
|
|
289
314
|
|
|
290
315
|
### What's Included
|
|
291
316
|
|
|
292
|
-
- ✅ Complete working example with
|
|
293
|
-
- ✅ Both
|
|
294
|
-
- ✅
|
|
317
|
+
- ✅ Complete working example with Tailwind CSS
|
|
318
|
+
- ✅ Both light and dark mode support
|
|
319
|
+
- ✅ Controlled and uncontrolled mode examples
|
|
320
|
+
- ✅ Interactive test elements (buttons, forms, cards, gradients)
|
|
295
321
|
- ✅ Console logging to see feedback data
|
|
296
322
|
- ✅ Hot reload for fast development
|
|
297
323
|
|
|
@@ -305,7 +331,7 @@ See `example/README.md` for more details.
|
|
|
305
331
|
|
|
306
332
|
## License
|
|
307
333
|
|
|
308
|
-
MIT © Murali
|
|
334
|
+
MIT © 2025 Murali
|
|
309
335
|
|
|
310
336
|
## Contributing
|
|
311
337
|
|
|
@@ -318,4 +344,9 @@ https://github.com/Murali1889/react-feedback-widget/issues
|
|
|
318
344
|
|
|
319
345
|
## Author
|
|
320
346
|
|
|
321
|
-
Murali
|
|
347
|
+
**Murali**
|
|
348
|
+
Email: murali.g@hyperverge.co
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
Made with ❤️ for better user feedback collection
|