@pindai-ai/chat-widget 2.0.0

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/src/style.css ADDED
@@ -0,0 +1,747 @@
1
+ /* ================================
2
+ Pindai Chat Widget Styles
3
+ Modern, Accessible, Mobile-First
4
+ ================================ */
5
+
6
+ /* CSS Variables - Design System */
7
+ :root {
8
+ /* Primary Brand Colors (Pindai.ai) */
9
+ --pindai-primary: #0066FF;
10
+ --pindai-primary-dark: #0052CC;
11
+ --pindai-primary-light: #E6F0FF;
12
+
13
+ /* Accent Colors */
14
+ --pindai-accent: #00C896;
15
+ --pindai-accent-light: #E6FAF5;
16
+
17
+ /* Neutral Palette */
18
+ --pindai-gray-900: #1A1A1A;
19
+ --pindai-gray-700: #4A4A4A;
20
+ --pindai-gray-500: #9E9E9E;
21
+ --pindai-gray-300: #E0E0E0;
22
+ --pindai-gray-100: #F5F5F5;
23
+ --pindai-gray-50: #FAFAFA;
24
+
25
+ /* Semantic Colors */
26
+ --pindai-error: #F44336;
27
+ --pindai-success: #00C896;
28
+ --pindai-warning: #FF9800;
29
+ --pindai-info: #0066FF;
30
+
31
+ /* Text Colors (WCAG AA Compliant) */
32
+ --text-on-primary: #FFFFFF;
33
+ --text-on-light: #1A1A1A;
34
+ --text-on-dark: #FFFFFF;
35
+
36
+ /* Spacing (8px base unit) */
37
+ --space-xs: 4px;
38
+ --space-sm: 8px;
39
+ --space-md: 16px;
40
+ --space-lg: 24px;
41
+ --space-xl: 32px;
42
+
43
+ /* Typography */
44
+ --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
45
+ --font-size-xs: 0.6875rem; /* 11px */
46
+ --font-size-sm: 0.875rem; /* 14px */
47
+ --font-size-base: 0.9375rem; /* 15px */
48
+ --font-size-lg: 1.125rem; /* 18px */
49
+ --font-size-xl: 1.5rem; /* 24px */
50
+
51
+ /* Transitions */
52
+ --transition-fast: 0.15s ease-in-out;
53
+ --transition-base: 0.3s ease-in-out;
54
+ --transition-slow: 0.5s ease-in-out;
55
+
56
+ /* Shadows */
57
+ --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
58
+ --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
59
+ --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
60
+
61
+ /* Border Radius */
62
+ --radius-sm: 8px;
63
+ --radius-md: 12px;
64
+ --radius-lg: 16px;
65
+ --radius-xl: 20px;
66
+ --radius-full: 50%;
67
+ }
68
+
69
+ /* Global Box Sizing */
70
+ * {
71
+ box-sizing: border-box;
72
+ }
73
+
74
+ /* ================================
75
+ Chat Launcher Button
76
+ ================================ */
77
+
78
+ .n8n-chat-launcher {
79
+ position: fixed;
80
+ bottom: 16px;
81
+ right: 16px;
82
+ width: 56px;
83
+ height: 56px;
84
+ background-color: var(--pindai-primary);
85
+ border-radius: var(--radius-full);
86
+ display: flex;
87
+ justify-content: center;
88
+ align-items: center;
89
+ box-shadow: var(--shadow-lg);
90
+ cursor: pointer;
91
+ transition: transform var(--transition-base),
92
+ opacity var(--transition-base),
93
+ box-shadow var(--transition-base);
94
+ z-index: 9998;
95
+ border: none;
96
+ outline: none;
97
+ }
98
+
99
+ .n8n-chat-launcher:hover {
100
+ transform: scale(1.05);
101
+ box-shadow: 0 8px 28px rgba(0, 102, 255, 0.4);
102
+ }
103
+
104
+ .n8n-chat-launcher:focus-visible {
105
+ outline: 3px solid var(--pindai-primary);
106
+ outline-offset: 4px;
107
+ }
108
+
109
+ .n8n-chat-launcher img {
110
+ width: 28px;
111
+ height: 28px;
112
+ filter: invert(1);
113
+ }
114
+
115
+ .n8n-chat-launcher--hidden {
116
+ transform: scale(0);
117
+ opacity: 0;
118
+ pointer-events: none;
119
+ }
120
+
121
+ /* Unread Badge */
122
+ .n8n-chat-unread-badge {
123
+ position: absolute;
124
+ top: -4px;
125
+ right: -4px;
126
+ min-width: 20px;
127
+ height: 20px;
128
+ background-color: var(--pindai-error);
129
+ color: var(--text-on-dark);
130
+ font-size: 12px;
131
+ font-weight: 700;
132
+ border-radius: 10px;
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: center;
136
+ padding: 0 6px;
137
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
138
+ z-index: 1;
139
+ }
140
+
141
+ /* ================================
142
+ Chat Widget Container
143
+ Mobile-First (Base Styles)
144
+ ================================ */
145
+
146
+ .n8n-chat-widget {
147
+ position: fixed;
148
+ bottom: 0;
149
+ right: 0;
150
+ width: 100vw;
151
+ height: 100vh;
152
+ max-height: 100vh;
153
+ border-radius: 0;
154
+ box-shadow: var(--shadow-lg);
155
+ background-color: #ffffff;
156
+ display: flex;
157
+ flex-direction: column;
158
+ overflow: hidden;
159
+ font-family: var(--font-family);
160
+ font-size: var(--font-size-base);
161
+ transform: translateY(20px) scale(0.95);
162
+ opacity: 0;
163
+ visibility: hidden;
164
+ transition: all var(--transition-base);
165
+ z-index: 9999;
166
+ }
167
+
168
+ .n8n-chat-widget--open {
169
+ transform: translateY(0) scale(1);
170
+ opacity: 1;
171
+ visibility: visible;
172
+ }
173
+
174
+ .n8n-chat-widget--fullscreen {
175
+ width: 100%;
176
+ height: 100%;
177
+ bottom: 0;
178
+ right: 0;
179
+ border-radius: 0;
180
+ max-height: 100vh;
181
+ transform: none;
182
+ opacity: 1;
183
+ visibility: visible;
184
+ }
185
+
186
+ /* ================================
187
+ Chat Header
188
+ ================================ */
189
+
190
+ .n8n-chat-header {
191
+ padding: var(--space-md);
192
+ background-color: var(--pindai-gray-900);
193
+ color: var(--text-on-dark);
194
+ font-weight: 700;
195
+ font-size: var(--font-size-xl);
196
+ letter-spacing: -0.02em;
197
+ display: flex;
198
+ justify-content: space-between;
199
+ align-items: center;
200
+ flex-shrink: 0;
201
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
202
+ }
203
+
204
+ .n8n-chat-header-content {
205
+ display: flex;
206
+ align-items: center;
207
+ gap: 12px;
208
+ flex: 1;
209
+ }
210
+
211
+ .n8n-chat-logo {
212
+ width: 32px;
213
+ height: 32px;
214
+ object-fit: contain;
215
+ flex-shrink: 0;
216
+ }
217
+
218
+ .n8n-chat-title {
219
+ font-size: var(--font-size-lg);
220
+ flex: 1;
221
+ }
222
+
223
+ .n8n-chat-close-btn {
224
+ background: none;
225
+ border: none;
226
+ color: var(--text-on-dark);
227
+ font-size: 32px;
228
+ cursor: pointer;
229
+ line-height: 1;
230
+ padding: 0 8px;
231
+ transition: opacity var(--transition-fast);
232
+ flex-shrink: 0;
233
+ }
234
+
235
+ .n8n-chat-close-btn:hover {
236
+ opacity: 0.8;
237
+ }
238
+
239
+ .n8n-chat-close-btn:focus-visible {
240
+ outline: 2px solid var(--pindai-primary);
241
+ outline-offset: 2px;
242
+ border-radius: 4px;
243
+ }
244
+
245
+ /* ================================
246
+ Messages Area
247
+ ================================ */
248
+
249
+ .n8n-chat-messages {
250
+ flex-grow: 1;
251
+ padding: var(--space-lg);
252
+ overflow-y: auto;
253
+ display: flex;
254
+ flex-direction: column;
255
+ gap: var(--space-md);
256
+ background-color: var(--pindai-gray-50);
257
+ -webkit-overflow-scrolling: touch;
258
+ overscroll-behavior: contain;
259
+ }
260
+
261
+ /* Custom scrollbar */
262
+ .n8n-chat-messages::-webkit-scrollbar {
263
+ width: 6px;
264
+ }
265
+
266
+ .n8n-chat-messages::-webkit-scrollbar-track {
267
+ background: transparent;
268
+ }
269
+
270
+ .n8n-chat-messages::-webkit-scrollbar-thumb {
271
+ background: var(--pindai-gray-300);
272
+ border-radius: 3px;
273
+ }
274
+
275
+ .n8n-chat-messages::-webkit-scrollbar-thumb:hover {
276
+ background: var(--pindai-gray-500);
277
+ }
278
+
279
+ /* ================================
280
+ Message Bubbles
281
+ ================================ */
282
+
283
+ .n8n-chat-bubble {
284
+ padding: 12px 16px;
285
+ border-radius: var(--radius-xl);
286
+ max-width: 75%;
287
+ line-height: 1.5;
288
+ font-size: var(--font-size-base);
289
+ word-wrap: break-word;
290
+ animation: fadeInSlide 0.3s ease-out;
291
+ }
292
+
293
+ @keyframes fadeInSlide {
294
+ from {
295
+ opacity: 0;
296
+ transform: translateY(10px);
297
+ }
298
+ to {
299
+ opacity: 1;
300
+ transform: translateY(0);
301
+ }
302
+ }
303
+
304
+ .n8n-chat-user-message {
305
+ background-color: var(--pindai-primary);
306
+ color: var(--text-on-primary);
307
+ align-self: flex-end;
308
+ border-bottom-right-radius: 4px;
309
+ }
310
+
311
+ .n8n-chat-ai-message {
312
+ background-color: var(--pindai-gray-100);
313
+ color: var(--text-on-light);
314
+ align-self: flex-start;
315
+ border-bottom-left-radius: 4px;
316
+ }
317
+
318
+ /* Message content structure */
319
+ .n8n-chat-message-text {
320
+ margin-bottom: 4px;
321
+ }
322
+
323
+ .n8n-chat-message-timestamp {
324
+ font-size: var(--font-size-xs);
325
+ opacity: 0.6;
326
+ margin-top: 4px;
327
+ display: block;
328
+ }
329
+
330
+ .n8n-chat-user-message .n8n-chat-message-timestamp {
331
+ text-align: right;
332
+ color: rgba(255, 255, 255, 0.8);
333
+ }
334
+
335
+ .n8n-chat-ai-message .n8n-chat-message-timestamp {
336
+ color: rgba(0, 0, 0, 0.5);
337
+ }
338
+
339
+ /* ================================
340
+ Quick Reply Buttons
341
+ ================================ */
342
+
343
+ .n8n-chat-quick-replies {
344
+ display: flex;
345
+ flex-wrap: wrap;
346
+ gap: var(--space-sm);
347
+ padding: var(--space-md) 0;
348
+ align-self: flex-start;
349
+ max-width: 90%;
350
+ animation: fadeInSlide 0.4s ease-out;
351
+ }
352
+
353
+ .n8n-chat-quick-reply-btn {
354
+ padding: 10px 16px;
355
+ background: white;
356
+ border: 1.5px solid var(--pindai-primary);
357
+ border-radius: var(--radius-xl);
358
+ color: var(--pindai-primary);
359
+ font-size: var(--font-size-sm);
360
+ font-weight: 500;
361
+ cursor: pointer;
362
+ transition: all var(--transition-fast);
363
+ white-space: nowrap;
364
+ min-height: 44px; /* Touch target */
365
+ }
366
+
367
+ .n8n-chat-quick-reply-btn:hover {
368
+ background: var(--pindai-primary);
369
+ color: white;
370
+ transform: translateY(-1px);
371
+ box-shadow: 0 2px 8px rgba(0, 102, 255, 0.3);
372
+ }
373
+
374
+ .n8n-chat-quick-reply-btn:focus-visible {
375
+ outline: 2px solid var(--pindai-primary);
376
+ outline-offset: 2px;
377
+ }
378
+
379
+ /* ================================
380
+ Typing Indicator
381
+ ================================ */
382
+
383
+ .n8n-chat-typing-indicator {
384
+ display: flex;
385
+ align-items: center;
386
+ gap: 4px;
387
+ padding: 12px 16px;
388
+ }
389
+
390
+ .n8n-chat-typing-indicator span {
391
+ height: 8px;
392
+ width: 8px;
393
+ background-color: var(--pindai-gray-500);
394
+ border-radius: 50%;
395
+ display: inline-block;
396
+ animation: bounce 1.4s infinite ease-in-out both;
397
+ }
398
+
399
+ .n8n-chat-typing-indicator span:nth-child(1) {
400
+ animation-delay: -0.32s;
401
+ }
402
+
403
+ .n8n-chat-typing-indicator span:nth-child(2) {
404
+ animation-delay: -0.16s;
405
+ }
406
+
407
+ @keyframes bounce {
408
+ 0%, 80%, 100% {
409
+ transform: scale(0);
410
+ }
411
+ 40% {
412
+ transform: scale(1.0);
413
+ }
414
+ }
415
+
416
+ /* ================================
417
+ File Upload & Preview
418
+ ================================ */
419
+
420
+ .n8n-chat-file-preview {
421
+ padding: var(--space-sm) var(--space-md);
422
+ display: flex;
423
+ flex-wrap: wrap;
424
+ gap: var(--space-sm);
425
+ border-top: 1px solid var(--pindai-gray-300);
426
+ background: var(--pindai-gray-50);
427
+ }
428
+
429
+ .n8n-chat-file-item {
430
+ display: flex;
431
+ align-items: center;
432
+ gap: var(--space-sm);
433
+ padding: 6px 12px;
434
+ background: white;
435
+ border: 1px solid var(--pindai-gray-300);
436
+ border-radius: var(--radius-lg);
437
+ font-size: var(--font-size-sm);
438
+ max-width: 200px;
439
+ }
440
+
441
+ .n8n-chat-file-name {
442
+ flex: 1;
443
+ overflow: hidden;
444
+ text-overflow: ellipsis;
445
+ white-space: nowrap;
446
+ color: var(--pindai-gray-700);
447
+ }
448
+
449
+ .n8n-chat-file-remove {
450
+ background: none;
451
+ border: none;
452
+ cursor: pointer;
453
+ font-size: 18px;
454
+ line-height: 1;
455
+ color: var(--pindai-gray-500);
456
+ padding: 0;
457
+ width: 20px;
458
+ height: 20px;
459
+ display: flex;
460
+ align-items: center;
461
+ justify-content: center;
462
+ transition: color var(--transition-fast);
463
+ }
464
+
465
+ .n8n-chat-file-remove:hover {
466
+ color: var(--pindai-error);
467
+ }
468
+
469
+ /* ================================
470
+ Watermark
471
+ ================================ */
472
+
473
+ .n8n-chat-watermark {
474
+ padding: 8px 16px;
475
+ text-align: center;
476
+ font-size: 12px;
477
+ color: var(--pindai-gray-500);
478
+ background-color: var(--pindai-gray-100);
479
+ border-top: 1px solid var(--pindai-gray-300);
480
+ flex-shrink: 0;
481
+ }
482
+
483
+ .n8n-chat-watermark span {
484
+ margin-right: 4px;
485
+ }
486
+
487
+ .n8n-chat-watermark a {
488
+ color: var(--pindai-primary);
489
+ text-decoration: none;
490
+ font-weight: 600;
491
+ transition: color 0.2s ease;
492
+ }
493
+
494
+ .n8n-chat-watermark a:hover {
495
+ color: var(--pindai-primary-dark);
496
+ text-decoration: underline;
497
+ }
498
+
499
+ .n8n-chat-watermark a:focus-visible {
500
+ outline: 2px solid var(--pindai-primary);
501
+ outline-offset: 2px;
502
+ border-radius: 2px;
503
+ }
504
+
505
+ /* ================================
506
+ Input Area
507
+ ================================ */
508
+
509
+ .n8n-chat-input-area {
510
+ display: flex;
511
+ align-items: center;
512
+ padding: var(--space-md);
513
+ border-top: 1px solid var(--pindai-gray-300);
514
+ background-color: #ffffff;
515
+ flex-shrink: 0;
516
+ gap: var(--space-sm);
517
+ }
518
+
519
+ .n8n-chat-file-upload-btn {
520
+ width: 44px;
521
+ height: 44px;
522
+ display: flex;
523
+ align-items: center;
524
+ justify-content: center;
525
+ cursor: pointer;
526
+ border-radius: var(--radius-full);
527
+ transition: background-color var(--transition-fast);
528
+ flex-shrink: 0;
529
+ border: none;
530
+ background: none;
531
+ color: var(--pindai-gray-700);
532
+ }
533
+
534
+ .n8n-chat-file-upload-btn:hover {
535
+ background-color: var(--pindai-gray-100);
536
+ }
537
+
538
+ .n8n-chat-file-upload-btn:focus-visible {
539
+ outline: 2px solid var(--pindai-primary);
540
+ outline-offset: 2px;
541
+ }
542
+
543
+ .n8n-chat-input-area input {
544
+ flex-grow: 1;
545
+ padding: 12px 16px;
546
+ border: 1px solid var(--pindai-gray-300);
547
+ border-radius: var(--radius-xl);
548
+ font-size: 16px; /* Prevents iOS zoom */
549
+ font-family: var(--font-family);
550
+ outline: none;
551
+ transition: border-color var(--transition-fast);
552
+ min-height: 44px; /* Touch target */
553
+ }
554
+
555
+ .n8n-chat-input-area input:focus {
556
+ border-color: var(--pindai-primary);
557
+ box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
558
+ }
559
+
560
+ .n8n-chat-input-area input::placeholder {
561
+ color: #757575;
562
+ }
563
+
564
+ .n8n-chat-input-area button.n8n-chat-send-btn {
565
+ width: 44px;
566
+ height: 44px;
567
+ padding: 0;
568
+ border: none;
569
+ border-radius: var(--radius-full);
570
+ display: flex;
571
+ align-items: center;
572
+ justify-content: center;
573
+ cursor: pointer;
574
+ transition: all var(--transition-fast);
575
+ background-color: var(--send-button-color, var(--pindai-primary));
576
+ color: white;
577
+ flex-shrink: 0;
578
+ }
579
+
580
+ .n8n-chat-input-area button.n8n-chat-send-btn:hover:not(:disabled) {
581
+ transform: scale(1.05);
582
+ filter: brightness(1.1);
583
+ box-shadow: 0 2px 8px rgba(0, 102, 255, 0.4);
584
+ }
585
+
586
+ .n8n-chat-input-area button.n8n-chat-send-btn:focus-visible {
587
+ outline: 2px solid var(--pindai-primary);
588
+ outline-offset: 2px;
589
+ }
590
+
591
+ .n8n-chat-input-area button svg {
592
+ width: 18px;
593
+ height: 18px;
594
+ color: white;
595
+ }
596
+
597
+ .n8n-chat-input-area button:disabled {
598
+ background-color: var(--pindai-gray-300);
599
+ cursor: not-allowed;
600
+ transform: none;
601
+ opacity: 0.6;
602
+ }
603
+
604
+ /* ================================
605
+ Offline Indicator
606
+ ================================ */
607
+
608
+ .n8n-chat-offline-indicator {
609
+ display: flex;
610
+ align-items: center;
611
+ gap: var(--space-sm);
612
+ padding: var(--space-md);
613
+ background-color: #FFF3CD;
614
+ color: #856404;
615
+ font-size: var(--font-size-sm);
616
+ border-bottom: 1px solid #FFE69C;
617
+ flex-shrink: 0;
618
+ }
619
+
620
+ .n8n-chat-offline-indicator svg {
621
+ flex-shrink: 0;
622
+ }
623
+
624
+ /* ================================
625
+ Loading States
626
+ ================================ */
627
+
628
+ .n8n-chat-loading-message {
629
+ display: flex;
630
+ align-items: center;
631
+ gap: var(--space-sm);
632
+ padding: var(--space-sm) 0;
633
+ font-size: var(--font-size-sm);
634
+ color: var(--pindai-gray-700);
635
+ }
636
+
637
+ .n8n-chat-spinner {
638
+ width: 16px;
639
+ height: 16px;
640
+ border: 2px solid var(--pindai-gray-300);
641
+ border-top-color: var(--pindai-primary);
642
+ border-radius: 50%;
643
+ animation: spin 0.8s linear infinite;
644
+ }
645
+
646
+ @keyframes spin {
647
+ to { transform: rotate(360deg); }
648
+ }
649
+
650
+ /* ================================
651
+ Accessibility
652
+ ================================ */
653
+
654
+ .sr-only {
655
+ position: absolute;
656
+ width: 1px;
657
+ height: 1px;
658
+ padding: 0;
659
+ margin: -1px;
660
+ overflow: hidden;
661
+ clip: rect(0, 0, 0, 0);
662
+ white-space: nowrap;
663
+ border-width: 0;
664
+ }
665
+
666
+ /* Focus indicators for keyboard navigation */
667
+ button:focus-visible,
668
+ input:focus-visible,
669
+ a:focus-visible {
670
+ outline: 3px solid var(--pindai-primary);
671
+ outline-offset: 2px;
672
+ }
673
+
674
+ /* Reduced motion for accessibility */
675
+ @media (prefers-reduced-motion: reduce) {
676
+ *,
677
+ *::before,
678
+ *::after {
679
+ animation-duration: 0.01ms !important;
680
+ animation-iteration-count: 1 !important;
681
+ transition-duration: 0.01ms !important;
682
+ }
683
+ }
684
+
685
+ /* ================================
686
+ Responsive Design
687
+ Tablet (640px+)
688
+ ================================ */
689
+
690
+ @media (min-width: 640px) {
691
+ .n8n-chat-widget {
692
+ width: 400px;
693
+ height: 85vh;
694
+ max-height: 700px;
695
+ bottom: 20px;
696
+ right: 20px;
697
+ border-radius: var(--radius-lg);
698
+ }
699
+
700
+ .n8n-chat-launcher {
701
+ bottom: 20px;
702
+ right: 20px;
703
+ width: 60px;
704
+ height: 60px;
705
+ }
706
+
707
+ .n8n-chat-launcher img {
708
+ width: 32px;
709
+ height: 32px;
710
+ }
711
+ }
712
+
713
+ /* ================================
714
+ Responsive Design
715
+ Desktop (1024px+)
716
+ ================================ */
717
+
718
+ @media (min-width: 1024px) {
719
+ .n8n-chat-widget {
720
+ width: 420px;
721
+ height: 80vh;
722
+ }
723
+
724
+ .n8n-chat-messages {
725
+ padding: var(--space-xl);
726
+ }
727
+ }
728
+
729
+ /* ================================
730
+ iOS Safe Area Support
731
+ ================================ */
732
+
733
+ @supports (padding: env(safe-area-inset-bottom)) {
734
+ .n8n-chat-widget {
735
+ padding-bottom: env(safe-area-inset-bottom);
736
+ }
737
+
738
+ .n8n-chat-launcher {
739
+ bottom: calc(16px + env(safe-area-inset-bottom));
740
+ }
741
+
742
+ @media (min-width: 640px) {
743
+ .n8n-chat-launcher {
744
+ bottom: calc(20px + env(safe-area-inset-bottom));
745
+ }
746
+ }
747
+ }