@vettly/react 0.1.12
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/README.md +90 -0
- package/dist/index.cjs +878 -0
- package/dist/index.d.cts +125 -0
- package/dist/index.d.ts +125 -0
- package/dist/index.js +848 -0
- package/dist/styles.css +305 -0
- package/package.json +69 -0
package/dist/styles.css
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default styles for @vettly/react components
|
|
3
|
+
* These can be overridden or replaced with custom styles
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* ModeratedTextarea */
|
|
7
|
+
.moderated-textarea-wrapper {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: 0.5rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.moderated-textarea {
|
|
14
|
+
width: 100%;
|
|
15
|
+
padding: 0.75rem;
|
|
16
|
+
border: 2px solid #e5e7eb;
|
|
17
|
+
border-radius: 0.5rem;
|
|
18
|
+
font-size: 1rem;
|
|
19
|
+
font-family: inherit;
|
|
20
|
+
transition: border-color 0.2s;
|
|
21
|
+
resize: vertical;
|
|
22
|
+
min-height: 100px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.moderated-textarea:focus {
|
|
26
|
+
outline: none;
|
|
27
|
+
border-color: #3b82f6;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.moderated-textarea.border-blue-300 {
|
|
31
|
+
border-color: #93c5fd;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.moderated-textarea.border-green-400 {
|
|
35
|
+
border-color: #4ade80;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.moderated-textarea.border-yellow-400 {
|
|
39
|
+
border-color: #facc15;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.moderated-textarea.border-orange-400 {
|
|
43
|
+
border-color: #fb923c;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.moderated-textarea.border-red-400 {
|
|
47
|
+
border-color: #f87171;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.moderation-feedback {
|
|
51
|
+
font-size: 0.875rem;
|
|
52
|
+
padding: 0.5rem;
|
|
53
|
+
border-radius: 0.375rem;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
gap: 0.5rem;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.feedback-checking {
|
|
60
|
+
background-color: #dbeafe;
|
|
61
|
+
color: #1e40af;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.feedback-error {
|
|
65
|
+
background-color: #fee2e2;
|
|
66
|
+
color: #991b1b;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.feedback-block {
|
|
70
|
+
background-color: #fee2e2;
|
|
71
|
+
color: #991b1b;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.feedback-flag {
|
|
75
|
+
background-color: #fef3c7;
|
|
76
|
+
color: #92400e;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.feedback-warn {
|
|
80
|
+
background-color: #fed7aa;
|
|
81
|
+
color: #9a3412;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.feedback-safe {
|
|
85
|
+
background-color: #d1fae5;
|
|
86
|
+
color: #065f46;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Image & Video Upload */
|
|
90
|
+
.moderated-image-upload,
|
|
91
|
+
.moderated-video-upload {
|
|
92
|
+
width: 100%;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.upload-area {
|
|
96
|
+
border: 2px dashed #d1d5db;
|
|
97
|
+
border-radius: 0.5rem;
|
|
98
|
+
padding: 3rem 1rem;
|
|
99
|
+
min-height: 200px; /* Better touch area on mobile */
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
text-align: center;
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
transition: all 0.2s;
|
|
107
|
+
background-color: #f9fafb;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@media (max-width: 640px) {
|
|
111
|
+
.upload-area {
|
|
112
|
+
padding: 2rem 1rem;
|
|
113
|
+
min-height: 160px;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.upload-area:hover {
|
|
118
|
+
border-color: #3b82f6;
|
|
119
|
+
background-color: #eff6ff;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.upload-icon {
|
|
123
|
+
font-size: 3rem;
|
|
124
|
+
margin-bottom: 1rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.upload-text {
|
|
128
|
+
font-size: 1rem;
|
|
129
|
+
font-weight: 600;
|
|
130
|
+
color: #374151;
|
|
131
|
+
margin-bottom: 0.5rem;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.upload-hint {
|
|
135
|
+
font-size: 0.875rem;
|
|
136
|
+
color: #6b7280;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.upload-error {
|
|
140
|
+
margin-top: 1rem;
|
|
141
|
+
padding: 0.75rem;
|
|
142
|
+
background-color: #fee2e2;
|
|
143
|
+
color: #991b1b;
|
|
144
|
+
border-radius: 0.375rem;
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
gap: 0.5rem;
|
|
148
|
+
justify-content: center;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Preview */
|
|
152
|
+
.image-preview,
|
|
153
|
+
.video-preview {
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
gap: 1rem;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.preview-container {
|
|
160
|
+
position: relative;
|
|
161
|
+
border-radius: 0.5rem;
|
|
162
|
+
overflow: hidden;
|
|
163
|
+
background-color: #000;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.preview-image,
|
|
167
|
+
.preview-video {
|
|
168
|
+
width: 100%;
|
|
169
|
+
height: auto;
|
|
170
|
+
display: block;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.preview-overlay {
|
|
174
|
+
position: absolute;
|
|
175
|
+
top: 0;
|
|
176
|
+
left: 0;
|
|
177
|
+
right: 0;
|
|
178
|
+
bottom: 0;
|
|
179
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
180
|
+
display: flex;
|
|
181
|
+
flex-direction: column;
|
|
182
|
+
align-items: center;
|
|
183
|
+
justify-content: center;
|
|
184
|
+
color: white;
|
|
185
|
+
gap: 1rem;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.preview-info {
|
|
189
|
+
display: flex;
|
|
190
|
+
justify-content: space-between;
|
|
191
|
+
align-items: center;
|
|
192
|
+
padding: 0.5rem 0;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.file-name {
|
|
196
|
+
font-size: 0.875rem;
|
|
197
|
+
font-weight: 600;
|
|
198
|
+
color: #374151;
|
|
199
|
+
overflow: hidden;
|
|
200
|
+
text-overflow: ellipsis;
|
|
201
|
+
white-space: nowrap;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.file-size,
|
|
205
|
+
.file-meta {
|
|
206
|
+
font-size: 0.75rem;
|
|
207
|
+
color: #6b7280;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.moderation-error {
|
|
211
|
+
padding: 0.75rem;
|
|
212
|
+
background-color: #fee2e2;
|
|
213
|
+
color: #991b1b;
|
|
214
|
+
border-radius: 0.375rem;
|
|
215
|
+
display: flex;
|
|
216
|
+
align-items: center;
|
|
217
|
+
gap: 0.5rem;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.moderation-status {
|
|
221
|
+
padding: 0.75rem;
|
|
222
|
+
border-radius: 0.375rem;
|
|
223
|
+
display: flex;
|
|
224
|
+
align-items: center;
|
|
225
|
+
gap: 0.5rem;
|
|
226
|
+
font-size: 0.875rem;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.status-block {
|
|
230
|
+
background-color: #fee2e2;
|
|
231
|
+
color: #991b1b;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.status-flag {
|
|
235
|
+
background-color: #fef3c7;
|
|
236
|
+
color: #92400e;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.status-warn {
|
|
240
|
+
background-color: #fed7aa;
|
|
241
|
+
color: #9a3412;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.status-allow {
|
|
245
|
+
background-color: #d1fae5;
|
|
246
|
+
color: #065f46;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.preview-actions {
|
|
250
|
+
display: flex;
|
|
251
|
+
gap: 0.75rem;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.btn-remove,
|
|
255
|
+
.btn-confirm {
|
|
256
|
+
flex: 1;
|
|
257
|
+
padding: 0.75rem 1.5rem;
|
|
258
|
+
min-height: 44px; /* Ensure minimum touch target for mobile */
|
|
259
|
+
border-radius: 0.375rem;
|
|
260
|
+
font-size: 0.875rem;
|
|
261
|
+
font-weight: 600;
|
|
262
|
+
border: none;
|
|
263
|
+
cursor: pointer;
|
|
264
|
+
transition: all 0.2s;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.btn-remove {
|
|
268
|
+
background-color: #f3f4f6;
|
|
269
|
+
color: #374151;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.btn-remove:hover {
|
|
273
|
+
background-color: #e5e7eb;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.btn-confirm {
|
|
277
|
+
background-color: #3b82f6;
|
|
278
|
+
color: white;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.btn-confirm:hover:not(:disabled) {
|
|
282
|
+
background-color: #2563eb;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.btn-confirm:disabled {
|
|
286
|
+
background-color: #d1d5db;
|
|
287
|
+
color: #9ca3af;
|
|
288
|
+
cursor: not-allowed;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/* Spinner animation */
|
|
292
|
+
.spinner {
|
|
293
|
+
width: 1.5rem;
|
|
294
|
+
height: 1.5rem;
|
|
295
|
+
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
296
|
+
border-top-color: white;
|
|
297
|
+
border-radius: 50%;
|
|
298
|
+
animation: spin 0.6s linear infinite;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
@keyframes spin {
|
|
302
|
+
to {
|
|
303
|
+
transform: rotate(360deg);
|
|
304
|
+
}
|
|
305
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vettly/react",
|
|
3
|
+
"version": "0.1.12",
|
|
4
|
+
"description": "Protect your users from harmful content. React components with real-time feedback.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./styles.css": "./dist/styles.css"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean --external react --external react-dom && cp src/styles.css dist/styles.css",
|
|
22
|
+
"dev": "tsup src/index.ts --format esm,cjs --dts --watch --external react --external react-dom",
|
|
23
|
+
"test": "bun test",
|
|
24
|
+
"prepublishOnly": "bun run build"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"react",
|
|
28
|
+
"moderation",
|
|
29
|
+
"content",
|
|
30
|
+
"safety",
|
|
31
|
+
"protection",
|
|
32
|
+
"toxic",
|
|
33
|
+
"harmful",
|
|
34
|
+
"components",
|
|
35
|
+
"ui",
|
|
36
|
+
"textarea",
|
|
37
|
+
"upload"
|
|
38
|
+
],
|
|
39
|
+
"author": "Vettly",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "https://github.com/brian-nextaura/vettly-docs.git",
|
|
44
|
+
"directory": "packages/react"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://vettly.dev",
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public",
|
|
49
|
+
"name": "@nextauralabs/vettly-react"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/brian-nextaura/vettly-docs/issues"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"react": "^18.0.0",
|
|
56
|
+
"react-dom": "^18.0.0"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@vettly/sdk": "workspace:*",
|
|
60
|
+
"@vettly/shared": "workspace:*"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@types/bun": "latest",
|
|
64
|
+
"@types/react": "^18.2.0",
|
|
65
|
+
"@types/react-dom": "^18.2.0",
|
|
66
|
+
"tsup": "^8.0.0",
|
|
67
|
+
"typescript": "^5"
|
|
68
|
+
}
|
|
69
|
+
}
|