@aktarulrahul/floater-chatbot 1.0.8 → 1.0.9

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.
@@ -1,169 +1,241 @@
1
+ :root {
2
+ --cw-primary: #007bff;
3
+ --cw-primary-gradient: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
4
+ --cw-bg: #ffffff;
5
+ --cw-bg-secondary: #f8f9fa;
6
+ --cw-text: #212529;
7
+ --cw-text-secondary: #6c757d;
8
+ --cw-border: #e9ecef;
9
+ --cw-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
10
+ --cw-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
11
+ --cw-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.18);
12
+ --cw-radius-lg: 16px;
13
+ --cw-radius-md: 12px;
14
+ --cw-radius-sm: 8px;
15
+ --cw-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
16
+ --cw-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
17
+ }
18
+
1
19
  .chat-widget-container {
2
20
  position: fixed;
3
21
  z-index: 9999;
4
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
5
- "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
6
- sans-serif;
22
+ font-family: var(--cw-font-family);
7
23
  font-size: 14px;
24
+ line-height: 1.5;
8
25
  }
9
26
 
10
27
  /* Position variants */
11
- .chat-widget-bottom-right {
12
- bottom: 20px;
13
- right: 20px;
14
- }
15
-
16
- .chat-widget-bottom-left {
17
- bottom: 20px;
18
- left: 20px;
19
- }
20
-
21
- .chat-widget-top-right {
22
- top: 20px;
23
- right: 20px;
24
- }
25
-
26
- .chat-widget-top-left {
27
- top: 20px;
28
- left: 20px;
29
- }
28
+ .chat-widget-bottom-right { bottom: 24px; right: 24px; }
29
+ .chat-widget-bottom-left { bottom: 24px; left: 24px; }
30
+ .chat-widget-top-right { top: 24px; right: 24px; }
31
+ .chat-widget-top-left { top: 24px; left: 24px; }
30
32
 
31
33
  /* Chat Button */
32
34
  .chat-widget-button {
33
- width: 60px;
34
- height: 60px;
35
+ width: 64px;
36
+ height: 64px;
35
37
  border-radius: 50%;
36
38
  border: none;
37
39
  color: white;
38
40
  cursor: pointer;
39
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
41
+ box-shadow: var(--cw-shadow-md);
40
42
  display: flex;
41
43
  align-items: center;
42
44
  justify-content: center;
43
- transition: transform 0.2s, box-shadow 0.2s;
45
+ transition: var(--cw-transition);
46
+ background: var(--cw-primary-gradient);
47
+ position: relative;
48
+ overflow: hidden;
49
+ }
50
+
51
+ .chat-widget-button::after {
52
+ content: '';
53
+ position: absolute;
54
+ top: 0;
55
+ left: 0;
56
+ right: 0;
57
+ bottom: 0;
58
+ background: linear-gradient(rgba(255,255,255,0.2), transparent);
59
+ opacity: 0;
60
+ transition: opacity 0.3s;
44
61
  }
45
62
 
46
63
  .chat-widget-button:hover {
47
- transform: scale(1.05);
48
- box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
64
+ transform: translateY(-4px) scale(1.05);
65
+ box-shadow: var(--cw-shadow-lg);
66
+ }
67
+
68
+ .chat-widget-button:hover::after {
69
+ opacity: 1;
49
70
  }
50
71
 
51
72
  .chat-widget-button:active {
52
- transform: scale(0.95);
73
+ transform: translateY(0) scale(0.95);
53
74
  }
54
75
 
55
76
  /* Chat Window */
56
77
  .chat-widget-window {
57
78
  width: 380px;
58
- height: 600px;
59
- background: white;
60
- border-radius: 12px;
61
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
79
+ height: 650px;
80
+ max-height: calc(100vh - 100px);
81
+ background: rgba(255, 255, 255, 0.95);
82
+ backdrop-filter: blur(10px);
83
+ -webkit-backdrop-filter: blur(10px);
84
+ border-radius: var(--cw-radius-lg);
85
+ box-shadow: var(--cw-shadow-lg);
62
86
  display: flex;
63
87
  flex-direction: column;
64
88
  overflow: hidden;
65
- animation: slideUp 0.3s ease-out;
89
+ border: 1px solid rgba(255, 255, 255, 0.5);
90
+ animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
91
+ transform-origin: bottom right;
66
92
  }
67
93
 
68
- @keyframes slideUp {
69
- from {
70
- opacity: 0;
71
- transform: translateY(20px);
72
- }
73
- to {
74
- opacity: 1;
75
- transform: translateY(0);
76
- }
94
+ .chat-widget-bottom-left .chat-widget-window { transform-origin: bottom left; }
95
+ .chat-widget-top-right .chat-widget-window { transform-origin: top right; }
96
+ .chat-widget-top-left .chat-widget-window { transform-origin: top left; }
97
+
98
+ @keyframes slideIn {
99
+ from { opacity: 0; transform: scale(0.9) translateY(20px); }
100
+ to { opacity: 1; transform: scale(1) translateY(0); }
77
101
  }
78
102
 
79
103
  /* Header */
80
104
  .chat-widget-header {
81
- padding: 16px 20px;
105
+ padding: 20px;
106
+ background: var(--cw-primary-gradient);
82
107
  color: white;
83
108
  display: flex;
84
109
  align-items: center;
85
110
  justify-content: space-between;
86
111
  flex-shrink: 0;
112
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
87
113
  }
88
114
 
89
115
  .chat-widget-header-content {
90
116
  display: flex;
91
117
  align-items: center;
92
- gap: 12px;
118
+ gap: 16px;
93
119
  flex: 1;
94
120
  }
95
121
 
122
+ .chat-widget-avatar-container {
123
+ position: relative;
124
+ }
125
+
96
126
  .chat-widget-avatar {
97
- width: 40px;
98
- height: 40px;
127
+ width: 44px;
128
+ height: 44px;
99
129
  border-radius: 50%;
100
130
  object-fit: cover;
131
+ border: 2px solid rgba(255, 255, 255, 0.8);
132
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
133
+ }
134
+
135
+ .chat-widget-status-dot {
136
+ position: absolute;
137
+ bottom: 2px;
138
+ right: 2px;
139
+ width: 10px;
140
+ height: 10px;
141
+ background: #2ecc71;
142
+ border: 2px solid white;
143
+ border-radius: 50%;
101
144
  }
102
145
 
103
146
  .chat-widget-header-text {
104
147
  flex: 1;
148
+ display: flex;
149
+ flex-direction: column;
150
+ gap: 2px;
105
151
  }
106
152
 
107
153
  .chat-widget-title {
108
- font-weight: 600;
154
+ font-weight: 700;
109
155
  font-size: 16px;
110
- margin-bottom: 2px;
156
+ letter-spacing: -0.01em;
111
157
  }
112
158
 
113
159
  .chat-widget-subtitle {
114
- font-size: 12px;
160
+ font-size: 13px;
115
161
  opacity: 0.9;
162
+ font-weight: 400;
116
163
  }
117
164
 
118
165
  .chat-widget-close {
119
- background: rgba(255, 255, 255, 0.2);
166
+ background: rgba(255, 255, 255, 0.15);
120
167
  border: none;
121
168
  color: white;
122
- width: 32px;
123
- height: 32px;
169
+ width: 36px;
170
+ height: 36px;
124
171
  border-radius: 50%;
125
172
  cursor: pointer;
126
173
  display: flex;
127
174
  align-items: center;
128
175
  justify-content: center;
129
- transition: background 0.2s;
176
+ transition: all 0.2s;
177
+ backdrop-filter: blur(4px);
130
178
  }
131
179
 
132
180
  .chat-widget-close:hover {
133
181
  background: rgba(255, 255, 255, 0.3);
182
+ transform: rotate(90deg);
134
183
  }
135
184
 
136
185
  /* Messages */
137
186
  .chat-widget-messages {
138
187
  flex: 1;
139
188
  overflow-y: auto;
140
- padding: 20px;
189
+ padding: 24px;
141
190
  display: flex;
142
191
  flex-direction: column;
143
- gap: 12px;
144
- background: #f8f9fa;
192
+ gap: 16px;
193
+ background: var(--cw-bg-secondary);
194
+ scroll-behavior: smooth;
145
195
  }
146
196
 
147
197
  .chat-widget-empty {
148
198
  display: flex;
199
+ flex-direction: column;
149
200
  align-items: center;
150
201
  justify-content: center;
151
202
  height: 100%;
152
- color: #6c757d;
203
+ color: var(--cw-text-secondary);
153
204
  text-align: center;
205
+ gap: 16px;
206
+ opacity: 0;
207
+ animation: fadeIn 0.5s ease-out 0.2s forwards;
208
+ }
209
+
210
+ .chat-widget-empty-icon {
211
+ width: 64px;
212
+ height: 64px;
213
+ background: rgba(0, 123, 255, 0.1);
214
+ border-radius: 50%;
215
+ display: flex;
216
+ align-items: center;
217
+ justify-content: center;
218
+ color: var(--cw-primary);
219
+ margin-bottom: 8px;
154
220
  }
155
221
 
156
222
  .chat-widget-message {
157
223
  display: flex;
158
- gap: 8px;
159
- align-items: flex-start;
160
- max-width: 80%;
224
+ gap: 12px;
225
+ align-items: flex-end;
226
+ max-width: 85%;
227
+ opacity: 0;
228
+ animation: messageSlideIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
229
+ }
230
+
231
+ @keyframes messageSlideIn {
232
+ from { opacity: 0; transform: translateY(10px); }
233
+ to { opacity: 1; transform: translateY(0); }
161
234
  }
162
235
 
163
236
  .chat-widget-message-user {
164
237
  align-self: flex-end;
165
238
  flex-direction: row-reverse;
166
- margin-left: auto;
167
239
  }
168
240
 
169
241
  .chat-widget-message-bot {
@@ -176,6 +248,8 @@
176
248
  border-radius: 50%;
177
249
  object-fit: cover;
178
250
  flex-shrink: 0;
251
+ box-shadow: var(--cw-shadow-sm);
252
+ border: 2px solid white;
179
253
  }
180
254
 
181
255
  .chat-widget-message-content {
@@ -188,185 +262,116 @@
188
262
  align-items: flex-end;
189
263
  }
190
264
 
191
- .chat-widget-message-bot .chat-widget-message-content {
192
- align-items: flex-start;
193
- }
194
-
195
265
  .chat-widget-message-text {
196
- padding: 10px 14px;
266
+ padding: 12px 18px;
197
267
  border-radius: 18px;
268
+ font-size: 14px;
269
+ line-height: 1.5;
270
+ position: relative;
271
+ box-shadow: var(--cw-shadow-sm);
198
272
  word-wrap: break-word;
199
- line-height: 1.4;
200
- white-space: pre-wrap;
201
- }
202
-
203
- .chat-widget-message-text strong {
204
- font-weight: 600;
205
- }
206
-
207
- .chat-widget-message-text em {
208
- font-style: italic;
209
- }
210
-
211
- .chat-widget-message-text code {
212
- background: rgba(0, 0, 0, 0.05);
213
- padding: 2px 6px;
214
- border-radius: 4px;
215
- font-family: "Courier New", monospace;
216
- font-size: 0.9em;
217
- }
218
-
219
- .chat-widget-message-bot .chat-widget-message-text code {
220
- background: rgba(0, 0, 0, 0.08);
221
- }
222
-
223
- .chat-widget-message-user .chat-widget-message-text code {
224
- background: rgba(255, 255, 255, 0.2);
225
- }
226
-
227
- .chat-widget-list-item {
228
- margin: 4px 0;
229
- padding-left: 8px;
230
273
  }
231
274
 
232
275
  .chat-widget-message-user .chat-widget-message-text {
233
- background: #007bff;
276
+ background: var(--cw-primary-gradient);
234
277
  color: white;
235
278
  border-bottom-right-radius: 4px;
236
279
  }
237
280
 
238
281
  .chat-widget-message-bot .chat-widget-message-text {
239
282
  background: white;
240
- color: #333;
283
+ color: var(--cw-text);
241
284
  border-bottom-left-radius: 4px;
242
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
285
+ border: 1px solid var(--cw-border);
243
286
  }
244
287
 
245
288
  .chat-widget-message-time {
246
289
  font-size: 11px;
247
- color: #6c757d;
248
- padding: 0 4px;
290
+ color: var(--cw-text-secondary);
291
+ margin: 0 4px;
292
+ opacity: 0.8;
249
293
  }
250
294
 
251
- /* References */
252
- .chat-widget-references {
253
- margin-top: 8px;
254
- padding: 8px 12px;
255
- background: #f8f9fa;
256
- border-radius: 8px;
257
- border-left: 3px solid #007bff;
258
- }
259
-
260
- .chat-widget-references-title {
261
- font-size: 11px;
262
- font-weight: 600;
263
- color: #6c757d;
264
- margin-bottom: 6px;
265
- text-transform: uppercase;
266
- letter-spacing: 0.5px;
267
- }
268
-
269
- .chat-widget-references-list {
270
- display: flex;
271
- flex-direction: column;
272
- gap: 4px;
273
- }
274
-
275
- .chat-widget-reference {
276
- display: flex;
277
- align-items: center;
278
- justify-content: space-between;
279
- font-size: 12px;
280
- color: #495057;
281
- padding: 4px 0;
295
+ /* Typography in messages */
296
+ .chat-widget-message-text strong { font-weight: 600; }
297
+ .chat-widget-message-text em { font-style: italic; }
298
+ .chat-widget-message-text code {
299
+ font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
300
+ font-size: 0.9em;
301
+ padding: 2px 6px;
302
+ border-radius: 4px;
282
303
  }
283
304
 
284
- .chat-widget-reference-name {
285
- font-weight: 500;
286
- color: #007bff;
287
- flex: 1;
288
- overflow: hidden;
289
- text-overflow: ellipsis;
290
- white-space: nowrap;
291
- margin-right: 8px;
305
+ .chat-widget-message-bot .chat-widget-message-text code {
306
+ background: rgba(0,0,0,0.06);
307
+ color: #e83e8c;
292
308
  }
293
309
 
294
- .chat-widget-reference-page {
295
- font-size: 11px;
296
- color: #6c757d;
297
- white-space: nowrap;
310
+ .chat-widget-message-user .chat-widget-message-text code {
311
+ background: rgba(255,255,255,0.2);
312
+ color: white;
298
313
  }
299
314
 
315
+ /* Typing Indicator */
300
316
  .chat-widget-typing {
301
317
  display: flex;
302
- gap: 4px;
303
- padding: 10px 14px;
318
+ gap: 6px;
319
+ padding: 16px 20px;
304
320
  background: white;
305
321
  border-radius: 18px;
306
322
  border-bottom-left-radius: 4px;
323
+ box-shadow: var(--cw-shadow-sm);
324
+ border: 1px solid var(--cw-border);
325
+ width: fit-content;
307
326
  }
308
327
 
309
328
  .chat-widget-typing span {
310
329
  width: 8px;
311
330
  height: 8px;
312
331
  border-radius: 50%;
313
- background: #6c757d;
314
- animation: typing 1.4s infinite;
315
- }
316
-
317
- .chat-widget-typing span:nth-child(2) {
318
- animation-delay: 0.2s;
332
+ background: #adb5bd;
333
+ animation: typingBounce 1.4s infinite ease-in-out both;
319
334
  }
320
335
 
321
- .chat-widget-typing span:nth-child(3) {
322
- animation-delay: 0.4s;
323
- }
336
+ .chat-widget-typing span:nth-child(1) { animation-delay: -0.32s; }
337
+ .chat-widget-typing span:nth-child(2) { animation-delay: -0.16s; }
324
338
 
325
- @keyframes typing {
326
- 0%,
327
- 60%,
328
- 100% {
329
- transform: translateY(0);
330
- opacity: 0.7;
331
- }
332
- 30% {
333
- transform: translateY(-10px);
334
- opacity: 1;
335
- }
339
+ @keyframes typingBounce {
340
+ 0%, 80%, 100% { transform: scale(0); }
341
+ 40% { transform: scale(1); }
336
342
  }
337
343
 
338
- /* Input */
344
+ /* Input Area */
339
345
  .chat-widget-input-container {
340
- padding: 16px;
346
+ padding: 16px 20px;
341
347
  background: white;
342
- border-top: 1px solid #e9ecef;
348
+ border-top: 1px solid var(--cw-border);
343
349
  display: flex;
344
- gap: 8px;
350
+ gap: 12px;
351
+ align-items: center;
345
352
  flex-shrink: 0;
346
353
  }
347
354
 
348
355
  .chat-widget-input {
349
356
  flex: 1;
350
- padding: 10px 14px;
351
- border: 1px solid #e9ecef;
352
- border-radius: 20px;
357
+ padding: 12px 16px;
358
+ border: 2px solid var(--cw-border);
359
+ border-radius: 24px;
353
360
  outline: none;
354
361
  font-size: 14px;
355
- transition: border-color 0.2s;
362
+ transition: all 0.2s;
363
+ background: var(--cw-bg-secondary);
356
364
  }
357
365
 
358
366
  .chat-widget-input:focus {
359
- border-color: #007bff;
360
- }
361
-
362
- .chat-widget-input:disabled {
363
- background: #f8f9fa;
364
- cursor: not-allowed;
367
+ border-color: var(--cw-primary);
368
+ background: white;
369
+ box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.1);
365
370
  }
366
371
 
367
372
  .chat-widget-send {
368
- width: 40px;
369
- height: 40px;
373
+ width: 48px;
374
+ height: 48px;
370
375
  border-radius: 50%;
371
376
  border: none;
372
377
  color: white;
@@ -374,42 +379,59 @@
374
379
  display: flex;
375
380
  align-items: center;
376
381
  justify-content: center;
377
- transition: transform 0.2s, opacity 0.2s;
382
+ transition: all 0.2s;
383
+ background: var(--cw-primary-gradient);
384
+ box-shadow: var(--cw-shadow-sm);
378
385
  flex-shrink: 0;
379
386
  }
380
387
 
381
388
  .chat-widget-send:hover:not(:disabled) {
382
- transform: scale(1.05);
389
+ transform: scale(1.1);
390
+ box-shadow: var(--cw-shadow-md);
383
391
  }
384
392
 
385
393
  .chat-widget-send:disabled {
386
- opacity: 0.5;
394
+ background: #e9ecef;
395
+ color: #adb5bd;
387
396
  cursor: not-allowed;
397
+ box-shadow: none;
388
398
  }
389
399
 
390
400
  /* Scrollbar */
391
- .chat-widget-messages::-webkit-scrollbar {
392
- width: 6px;
393
- }
394
-
395
- .chat-widget-messages::-webkit-scrollbar-track {
396
- background: transparent;
397
- }
398
-
401
+ .chat-widget-messages::-webkit-scrollbar { width: 6px; }
402
+ .chat-widget-messages::-webkit-scrollbar-track { background: transparent; }
399
403
  .chat-widget-messages::-webkit-scrollbar-thumb {
400
- background: #ced4da;
404
+ background: rgba(0,0,0,0.2);
401
405
  border-radius: 3px;
402
406
  }
407
+ .chat-widget-messages::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); }
403
408
 
404
- .chat-widget-messages::-webkit-scrollbar-thumb:hover {
405
- background: #adb5bd;
406
- }
407
-
408
- /* Responsive */
409
+ /* Mobile Responsive */
409
410
  @media (max-width: 480px) {
410
411
  .chat-widget-window {
411
- width: calc(100vw - 40px);
412
- height: calc(100vh - 40px);
413
- max-height: 600px;
412
+ position: fixed;
413
+ top: 0;
414
+ left: 0;
415
+ right: 0;
416
+ bottom: 0;
417
+ width: 100%;
418
+ height: 100%;
419
+ max-height: 100vh;
420
+ border-radius: 0;
421
+ transform: none !important;
422
+ }
423
+
424
+ .chat-widget-bottom-right, .chat-widget-bottom-left,
425
+ .chat-widget-top-right, .chat-widget-top-left {
426
+ bottom: 0;
427
+ right: 0;
428
+ left: 0;
429
+ top: 0;
430
+ z-index: 10000;
431
+ }
432
+
433
+ .chat-widget-close {
434
+ width: 40px;
435
+ height: 40px;
414
436
  }
415
437
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ChatWidget.d.ts","sourceRoot":"","sources":["../../src/components/ChatWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAe,MAAM,UAAU,CAAC;AAEzD,OAAO,kBAAkB,CAAC;AAE1B,UAAU,eAAe;IACvB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,MAAM,CAAC,EAAE,OAAO,CACd,IAAI,CACF,gBAAgB,EAChB,QAAQ,GAAG,WAAW,GAAG,aAAa,GAAG,aAAa,GAAG,YAAY,CACtE,CACF,CAAC;CACH;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA4ShD,CAAC"}
1
+ {"version":3,"file":"ChatWidget.d.ts","sourceRoot":"","sources":["../../src/components/ChatWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAe,MAAM,UAAU,CAAC;AAEzD,OAAO,kBAAkB,CAAC;AAE1B,UAAU,eAAe;IACvB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,MAAM,CAAC,EAAE,OAAO,CACd,IAAI,CACF,gBAAgB,EAChB,QAAQ,GAAG,WAAW,GAAG,aAAa,GAAG,aAAa,GAAG,YAAY,CACtE,CACF,CAAC;CACH;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA6ThD,CAAC"}