@diffsome/react 1.2.3 → 1.2.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.
Files changed (2) hide show
  1. package/dist/chat.css +396 -0
  2. package/package.json +5 -3
package/dist/chat.css ADDED
@@ -0,0 +1,396 @@
1
+ /* Diffsome Chat - CSS Variables */
2
+ .diffsome-chat-bubble-container {
3
+ --diffsome-chat-primary: #6366f1;
4
+ --diffsome-chat-primary-dark: color-mix(in srgb, var(--diffsome-chat-primary) 85%, black);
5
+ --diffsome-chat-bg: #ffffff;
6
+ --diffsome-chat-text: #1f2937;
7
+ --diffsome-chat-text-muted: #6b7280;
8
+ --diffsome-chat-border: #e5e7eb;
9
+ --diffsome-chat-visitor-bg: var(--diffsome-chat-primary);
10
+ --diffsome-chat-visitor-text: #ffffff;
11
+ --diffsome-chat-agent-bg: #f3f4f6;
12
+ --diffsome-chat-agent-text: #1f2937;
13
+ --diffsome-chat-radius: 12px;
14
+ --diffsome-chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
15
+
16
+ position: fixed;
17
+ bottom: 20px;
18
+ display: flex;
19
+ flex-direction: column;
20
+ align-items: flex-end;
21
+ gap: 16px;
22
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
23
+ }
24
+
25
+ .diffsome-chat-bubble-right {
26
+ right: 20px;
27
+ }
28
+
29
+ .diffsome-chat-bubble-left {
30
+ left: 20px;
31
+ align-items: flex-start;
32
+ }
33
+
34
+ /* Floating Button */
35
+ .diffsome-chat-bubble-button {
36
+ width: 60px;
37
+ height: 60px;
38
+ border-radius: 50%;
39
+ border: none;
40
+ background: var(--diffsome-chat-primary);
41
+ color: white;
42
+ cursor: pointer;
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ box-shadow: var(--diffsome-chat-shadow);
47
+ transition: transform 0.2s ease, background-color 0.2s ease;
48
+ position: relative;
49
+ }
50
+
51
+ .diffsome-chat-bubble-button:hover {
52
+ transform: scale(1.05);
53
+ background: var(--diffsome-chat-primary-dark);
54
+ }
55
+
56
+ .diffsome-chat-bubble-button:active {
57
+ transform: scale(0.95);
58
+ }
59
+
60
+ .diffsome-chat-bubble-button-open {
61
+ background: #6b7280;
62
+ }
63
+
64
+ .diffsome-chat-bubble-button-open:hover {
65
+ background: #4b5563;
66
+ }
67
+
68
+ .diffsome-chat-bubble-badge {
69
+ position: absolute;
70
+ top: -5px;
71
+ right: -5px;
72
+ background: #ef4444;
73
+ color: white;
74
+ font-size: 12px;
75
+ font-weight: 600;
76
+ min-width: 20px;
77
+ height: 20px;
78
+ border-radius: 10px;
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+ padding: 0 6px;
83
+ }
84
+
85
+ /* Chat Widget */
86
+ .diffsome-chat-widget {
87
+ width: 380px;
88
+ max-width: calc(100vw - 40px);
89
+ height: 500px;
90
+ max-height: calc(100vh - 120px);
91
+ background: var(--diffsome-chat-bg);
92
+ border-radius: var(--diffsome-chat-radius);
93
+ box-shadow: var(--diffsome-chat-shadow);
94
+ display: flex;
95
+ flex-direction: column;
96
+ overflow: hidden;
97
+ animation: diffsome-chat-slide-up 0.3s ease;
98
+ }
99
+
100
+ @keyframes diffsome-chat-slide-up {
101
+ from {
102
+ opacity: 0;
103
+ transform: translateY(20px);
104
+ }
105
+ to {
106
+ opacity: 1;
107
+ transform: translateY(0);
108
+ }
109
+ }
110
+
111
+ /* Header */
112
+ .diffsome-chat-header {
113
+ background: var(--diffsome-chat-primary);
114
+ color: white;
115
+ padding: 16px 20px;
116
+ display: flex;
117
+ align-items: center;
118
+ justify-content: space-between;
119
+ }
120
+
121
+ .diffsome-chat-header-info {
122
+ flex: 1;
123
+ }
124
+
125
+ .diffsome-chat-header-title {
126
+ font-size: 16px;
127
+ font-weight: 600;
128
+ margin-bottom: 2px;
129
+ }
130
+
131
+ .diffsome-chat-header-subtitle {
132
+ font-size: 13px;
133
+ opacity: 0.9;
134
+ }
135
+
136
+ .diffsome-chat-header-close {
137
+ background: none;
138
+ border: none;
139
+ color: white;
140
+ cursor: pointer;
141
+ padding: 4px;
142
+ border-radius: 4px;
143
+ display: flex;
144
+ align-items: center;
145
+ justify-content: center;
146
+ opacity: 0.8;
147
+ transition: opacity 0.2s ease;
148
+ }
149
+
150
+ .diffsome-chat-header-close:hover {
151
+ opacity: 1;
152
+ }
153
+
154
+ /* Messages Container */
155
+ .diffsome-chat-messages {
156
+ flex: 1;
157
+ overflow-y: auto;
158
+ padding: 16px;
159
+ display: flex;
160
+ flex-direction: column;
161
+ gap: 12px;
162
+ }
163
+
164
+ .diffsome-chat-loading,
165
+ .diffsome-chat-empty {
166
+ display: flex;
167
+ flex-direction: column;
168
+ align-items: center;
169
+ justify-content: center;
170
+ height: 100%;
171
+ color: var(--diffsome-chat-text-muted);
172
+ font-size: 14px;
173
+ gap: 12px;
174
+ }
175
+
176
+ .diffsome-chat-loading-spinner {
177
+ width: 32px;
178
+ height: 32px;
179
+ border: 3px solid var(--diffsome-chat-border);
180
+ border-top-color: var(--diffsome-chat-primary);
181
+ border-radius: 50%;
182
+ animation: diffsome-chat-spin 0.8s linear infinite;
183
+ }
184
+
185
+ @keyframes diffsome-chat-spin {
186
+ to {
187
+ transform: rotate(360deg);
188
+ }
189
+ }
190
+
191
+ /* Message Bubbles */
192
+ .diffsome-chat-message {
193
+ display: flex;
194
+ flex-direction: column;
195
+ max-width: 80%;
196
+ }
197
+
198
+ .diffsome-chat-message-visitor {
199
+ align-self: flex-end;
200
+ align-items: flex-end;
201
+ }
202
+
203
+ .diffsome-chat-message-agent {
204
+ align-self: flex-start;
205
+ align-items: flex-start;
206
+ }
207
+
208
+ .diffsome-chat-message-sender {
209
+ font-size: 12px;
210
+ color: var(--diffsome-chat-text-muted);
211
+ margin-bottom: 4px;
212
+ padding-left: 12px;
213
+ }
214
+
215
+ .diffsome-chat-message-bubble {
216
+ padding: 10px 14px;
217
+ border-radius: 18px;
218
+ word-wrap: break-word;
219
+ }
220
+
221
+ .diffsome-chat-message-visitor .diffsome-chat-message-bubble {
222
+ background: var(--diffsome-chat-visitor-bg);
223
+ color: var(--diffsome-chat-visitor-text);
224
+ border-bottom-right-radius: 4px;
225
+ }
226
+
227
+ .diffsome-chat-message-agent .diffsome-chat-message-bubble {
228
+ background: var(--diffsome-chat-agent-bg);
229
+ color: var(--diffsome-chat-agent-text);
230
+ border-bottom-left-radius: 4px;
231
+ }
232
+
233
+ .diffsome-chat-message-content {
234
+ font-size: 14px;
235
+ line-height: 1.4;
236
+ white-space: pre-wrap;
237
+ }
238
+
239
+ .diffsome-chat-message-time {
240
+ font-size: 11px;
241
+ margin-top: 4px;
242
+ opacity: 0.7;
243
+ }
244
+
245
+ .diffsome-chat-message-read {
246
+ color: #10b981;
247
+ }
248
+
249
+ /* System Message */
250
+ .diffsome-chat-message-system {
251
+ align-self: center;
252
+ background: var(--diffsome-chat-border);
253
+ color: var(--diffsome-chat-text-muted);
254
+ font-size: 12px;
255
+ padding: 6px 12px;
256
+ border-radius: 12px;
257
+ }
258
+
259
+ /* Typing Indicator */
260
+ .diffsome-chat-typing {
261
+ display: flex;
262
+ align-items: center;
263
+ gap: 8px;
264
+ color: var(--diffsome-chat-text-muted);
265
+ font-size: 13px;
266
+ }
267
+
268
+ .diffsome-chat-typing-indicator {
269
+ display: flex;
270
+ gap: 4px;
271
+ }
272
+
273
+ .diffsome-chat-typing-indicator span {
274
+ width: 8px;
275
+ height: 8px;
276
+ background: var(--diffsome-chat-text-muted);
277
+ border-radius: 50%;
278
+ animation: diffsome-chat-typing-bounce 1.4s ease-in-out infinite;
279
+ }
280
+
281
+ .diffsome-chat-typing-indicator span:nth-child(1) {
282
+ animation-delay: 0s;
283
+ }
284
+
285
+ .diffsome-chat-typing-indicator span:nth-child(2) {
286
+ animation-delay: 0.2s;
287
+ }
288
+
289
+ .diffsome-chat-typing-indicator span:nth-child(3) {
290
+ animation-delay: 0.4s;
291
+ }
292
+
293
+ @keyframes diffsome-chat-typing-bounce {
294
+ 0%, 60%, 100% {
295
+ transform: translateY(0);
296
+ opacity: 0.4;
297
+ }
298
+ 30% {
299
+ transform: translateY(-4px);
300
+ opacity: 1;
301
+ }
302
+ }
303
+
304
+ /* Input */
305
+ .diffsome-chat-input {
306
+ display: flex;
307
+ align-items: flex-end;
308
+ gap: 8px;
309
+ padding: 12px 16px;
310
+ border-top: 1px solid var(--diffsome-chat-border);
311
+ background: var(--diffsome-chat-bg);
312
+ }
313
+
314
+ .diffsome-chat-input-field {
315
+ flex: 1;
316
+ border: 1px solid var(--diffsome-chat-border);
317
+ border-radius: 20px;
318
+ padding: 10px 16px;
319
+ font-size: 14px;
320
+ resize: none;
321
+ outline: none;
322
+ font-family: inherit;
323
+ line-height: 1.4;
324
+ max-height: 100px;
325
+ transition: border-color 0.2s ease;
326
+ }
327
+
328
+ .diffsome-chat-input-field:focus {
329
+ border-color: var(--diffsome-chat-primary);
330
+ }
331
+
332
+ .diffsome-chat-input-field::placeholder {
333
+ color: var(--diffsome-chat-text-muted);
334
+ }
335
+
336
+ .diffsome-chat-input-button {
337
+ width: 40px;
338
+ height: 40px;
339
+ border-radius: 50%;
340
+ border: none;
341
+ background: var(--diffsome-chat-primary);
342
+ color: white;
343
+ cursor: pointer;
344
+ display: flex;
345
+ align-items: center;
346
+ justify-content: center;
347
+ transition: background-color 0.2s ease, opacity 0.2s ease;
348
+ flex-shrink: 0;
349
+ }
350
+
351
+ .diffsome-chat-input-button:hover:not(:disabled) {
352
+ background: var(--diffsome-chat-primary-dark);
353
+ }
354
+
355
+ .diffsome-chat-input-button:disabled {
356
+ opacity: 0.5;
357
+ cursor: not-allowed;
358
+ }
359
+
360
+ /* Mobile Responsive */
361
+ @media (max-width: 480px) {
362
+ .diffsome-chat-widget {
363
+ width: 100vw;
364
+ height: 100vh;
365
+ max-width: 100vw;
366
+ max-height: 100vh;
367
+ border-radius: 0;
368
+ position: fixed;
369
+ top: 0;
370
+ left: 0;
371
+ right: 0;
372
+ bottom: 0;
373
+ }
374
+
375
+ .diffsome-chat-bubble-container {
376
+ bottom: 16px;
377
+ right: 16px;
378
+ }
379
+
380
+ .diffsome-chat-bubble-left {
381
+ left: 16px;
382
+ right: auto;
383
+ }
384
+ }
385
+
386
+ /* Dark mode support */
387
+ @media (prefers-color-scheme: dark) {
388
+ .diffsome-chat-bubble-container {
389
+ --diffsome-chat-bg: #1f2937;
390
+ --diffsome-chat-text: #f9fafb;
391
+ --diffsome-chat-text-muted: #9ca3af;
392
+ --diffsome-chat-border: #374151;
393
+ --diffsome-chat-agent-bg: #374151;
394
+ --diffsome-chat-agent-text: #f9fafb;
395
+ }
396
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diffsome/react",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "React hooks and providers for Diffsome SDK - Headless e-commerce & CMS",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -10,13 +10,15 @@
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.mjs",
12
12
  "require": "./dist/index.js"
13
- }
13
+ },
14
+ "./chat.css": "./dist/chat.css",
15
+ "./dist/chat.css": "./dist/chat.css"
14
16
  },
15
17
  "files": [
16
18
  "dist"
17
19
  ],
18
20
  "scripts": {
19
- "build": "tsup src/index.ts --format cjs,esm --dts --clean --external react",
21
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean --external react && cp src/components/chat/styles.css dist/chat.css",
20
22
  "dev": "tsup src/index.ts --format cjs,esm --dts --watch --external react",
21
23
  "typecheck": "tsc --noEmit",
22
24
  "prepublishOnly": "npm run build"