@defra/flood-webchat 0.0.1-alpha.2 → 0.0.1-alpha.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.
package/main.scss CHANGED
@@ -1,3 +1,744 @@
1
- .defra-webchat-example {
2
- color: blue;
1
+ .js-enabled[data-wc-unsupported] {
2
+ display: none;
3
+ }
4
+
5
+ .wc-html {
6
+ @include mq ($until: tablet) {
7
+ height: 100vh;
8
+ overflow: hidden;
9
+ }
10
+ }
11
+
12
+ .wc-body {
13
+ @include mq ($until: tablet) {
14
+ position: fixed;
15
+ overflow: hidden;
16
+ inset:0;
17
+ }
18
+ }
19
+
20
+ .wc-scroll-padding {
21
+ scroll-padding-bottom: calc(2rem + 20px);
22
+ }
23
+
24
+ .wc-hidden {
25
+ visibility: hidden;
26
+ }
27
+
28
+ .wc-live {
29
+ @extend .govuk-visually-hidden;
30
+ }
31
+
32
+ .wc {
33
+ display: none;
34
+ position: fixed;
35
+ flex-wrap: nowrap;
36
+ z-index: 999;
37
+ inset: 0;
38
+ padding: 0;
39
+ box-sizing: border-box;
40
+
41
+ // overflow: auto;
42
+ -webkit-overflow-scrolling: touch;
43
+ touch-action: pan-x pan-y;
44
+ background-color: govuk-colour('white');
45
+
46
+ @include mq ($from: tablet) {
47
+ top: auto;
48
+ left: auto;
49
+ width: 400px;
50
+ height: 540px;
51
+
52
+ // padding: 10px;
53
+ margin-right: 10px;
54
+ margin-bottom: 10px;
55
+ }
56
+
57
+ &:focus {
58
+ outline: none;
59
+ }
60
+
61
+ &:focus.wc-focus-visible::after {
62
+ @include focus($glow: 5px, $strong: 2px, $background: 0, $inset: 0);
63
+
64
+ inset: 4px;
65
+ }
66
+ }
67
+
68
+ .wc--open {
69
+ display: flex;
70
+ }
71
+
72
+ .wc__inner {
73
+ position: relative;
74
+ flex: 0 0 100%;
75
+ display: flex;
76
+ flex-flow: column nowrap;
77
+
78
+ // background-color: white;
79
+ background-color: transparent;
80
+ border: 0;
81
+ outline: 0;
82
+
83
+ @include mq ($from: tablet) {
84
+ border: 1px solid govuk-colour('black');
85
+ }
86
+
87
+ box-sizing: border-box;
88
+ }
89
+
90
+ .wc__header {
91
+ flex: 0 0 0;
92
+ }
93
+
94
+ .wc__body {
95
+ flex: 1 1 auto;
96
+ overflow-y: auto;
97
+ overscroll-behavior: contain;
98
+ position: relative;
99
+
100
+ &:focus {
101
+ outline: none;
102
+ }
103
+
104
+ &:focus.wc-focus-visible {
105
+ outline: 3px solid transparent;
106
+ outline-offset: -2px;
107
+ box-shadow:
108
+ inset 0 0 0 2px $govuk-focus-colour,
109
+ inset 0 0 0 4px govuk-colour('black'),
110
+ 0 0 0 1px $govuk-focus-colour;
111
+
112
+ // z-index: 2;
113
+ }
114
+
115
+ &:focus.wc-focus-visible + .wc__footer .wc-message {
116
+ border-top: 1px solid transparent;
117
+ }
118
+ }
119
+
120
+ .wc__footer {
121
+ flex: 0 0 0;
122
+ position: relative;
123
+ }
124
+
125
+ .wc-settings {
126
+ padding-left: 5px;
127
+ padding-right: 5px;
128
+ }
129
+
130
+ .wc-visibility-hidden {
131
+ @include mq ($until: tablet) {
132
+ visibility: hidden;
133
+ }
134
+ }
135
+
136
+ // Header
137
+ .wc-header {
138
+ display: flex;
139
+ flex-flow: row nowrap;
140
+ align-items: center;
141
+ background-color: govuk-colour('black');
142
+ border-bottom: 1px solid govuk-colour('black');
143
+ padding: 3px;
144
+ }
145
+
146
+ .wc-status {
147
+ position: relative;
148
+ display: flex;
149
+ flex-direction: row;
150
+ justify-content: space-between;
151
+ padding: 15px;
152
+ align-items: center;
153
+
154
+ &::after {
155
+ position: absolute;
156
+ content: '';
157
+ bottom: 0;
158
+ left: 15px;
159
+ right: 15px;
160
+ height: 0;
161
+ border-bottom: 1px solid govuk-colour('mid-grey');
162
+ }
163
+
164
+ @include mq ($from: tablet) {
165
+ padding: 10px;
166
+
167
+ &::after {
168
+ left: 10px;
169
+ right: 10px;
170
+ }
171
+ }
172
+ }
173
+
174
+ .wc-status__content {
175
+ @extend .govuk-body;
176
+
177
+ flex: 1 1 auto;
178
+ margin: 0;
179
+ font-size: 16px;
180
+ line-height: 1.3158;
181
+ }
182
+
183
+ .wc-status__button {
184
+ flex: 0 0 auto;
185
+ }
186
+
187
+ .wc-status__meta {
188
+ display: block;
189
+ font-size: 16px;
190
+ color: govuk-colour('dark-grey');
191
+ }
192
+
193
+ // Pre and post chat
194
+ .wc-content {
195
+ padding: 20px 15px;
196
+
197
+ .govuk-form-group {
198
+ margin-bottom: 15px;
199
+ }
200
+
201
+ .govuk-label,
202
+ .govuk-fieldset__legend,
203
+ .wc-hint {
204
+ font-size: 16px;
205
+ }
206
+
207
+ .govuk-label + p {
208
+ margin-bottom: 10px;
209
+ }
210
+
211
+ .wc-message__textbox {
212
+ margin-bottom: 5px !important;
213
+ }
214
+
215
+ .wc-textarea-question {
216
+ resize: none;
217
+ }
218
+
219
+ .wc-textarea--error {
220
+ @extend .govuk-textarea--error;
221
+ }
222
+
223
+ p, ul {
224
+ font-size: 16px;
225
+ margin-bottom: 15px;
226
+ }
227
+
228
+ .govuk-heading-m,
229
+ .govuk-error-summary__title {
230
+ @include mq ($from: 'tablet') {
231
+ font-size: 19px;
232
+ margin-bottom: 15px;
233
+ }
234
+ }
235
+
236
+ .govuk-checkboxes label {
237
+ @include mq ($from: 'tablet') {
238
+ font-size: 16px;
239
+ }
240
+ }
241
+ }
242
+
243
+ // Message list
244
+ .wc-list {
245
+ @extend .govuk-list;
246
+
247
+ display: flex;
248
+ flex-flow: column nowrap;
249
+ font-size: 16px;
250
+ line-height: 20px;
251
+ margin: 0;
252
+ padding: 0;
253
+ position: relative;
254
+
255
+ // z-index: -1;
256
+ .govuk-heading-m {
257
+ @include mq ($from: 'tablet') {
258
+ font-size: 18px;
259
+ margin-bottom: 15px;
260
+ }
261
+ }
262
+
263
+ > li {
264
+ margin-bottom: 0;
265
+ }
266
+
267
+ &__item {
268
+ display: block;
269
+ flex: 0 0 auto;
270
+ max-width: 75%;
271
+ margin: 0 15px;
272
+ padding: 5px 0 0;
273
+
274
+ @include mq ($from: 'tablet') {
275
+ margin-left: 10px;
276
+ margin-right: 10px;
277
+ }
278
+ }
279
+
280
+ &__item-inner {
281
+ display: inline-block;
282
+ padding: 10px 12.5px;
283
+ background-color: govuk-colour('light-grey');
284
+ border-radius: 10px;
285
+ word-break: break-word;
286
+ white-space: pre-line;
287
+ backface-visibility: hidden;
288
+ }
289
+
290
+ @keyframes blink {
291
+ 50% {
292
+ fill: transparent
293
+ }
294
+ }
295
+
296
+ &__item-inner svg {
297
+ display: block;
298
+ color: govuk-colour('dark-grey');
299
+
300
+ circle {
301
+ animation: 1s blink infinite;
302
+ fill: currentcolor;
303
+ }
304
+
305
+ circle:nth-child(2) {
306
+ animation-delay: 250ms
307
+ }
308
+
309
+ circle:nth-child(3) {
310
+ animation-delay: 500ms
311
+ }
312
+ }
313
+
314
+ &__item:first-child {
315
+ padding-top: 15px;
316
+ }
317
+
318
+ &__item:last-child {
319
+ padding-bottom: 15px;
320
+ }
321
+
322
+ &__item--inbound {
323
+ align-self: flex-end;
324
+ }
325
+
326
+ &__item--outbound {
327
+ align-self: flex-start;
328
+ }
329
+
330
+ &__item--inbound &__item-inner {
331
+ background-color: govuk-colour('blue');
332
+ color: govuk-colour('white');
333
+ border-top-right-radius: 0;
334
+
335
+ a:not(:focus), a:visited:not(:focus) {
336
+ color: govuk-colour('white');
337
+ }
338
+ }
339
+
340
+ &__item--outbound &__item-inner {
341
+ border-top-left-radius: 0;
342
+ }
343
+
344
+ &__item-meta {
345
+ display: block;
346
+
347
+ @include govuk-font($size: 14);
348
+
349
+ color: $govuk-secondary-text-colour;
350
+ font-size: 14px;
351
+ margin-top: 2px;
352
+ margin-bottom: 2px;
353
+ }
354
+
355
+ &__item--inbound &__item-meta {
356
+ text-align: right;
357
+ }
358
+ }
359
+
360
+ .wc-title {
361
+ @extend .govuk-heading-s;
362
+
363
+ margin: 0 0 0 7px;
364
+ font-size: 19px;
365
+ flex: 1 1 auto;
366
+ position: relative;
367
+ color: govuk-colour('white');
368
+ }
369
+
370
+ .wc-back-link {
371
+ @extend .govuk-back-link;
372
+
373
+ margin: 0 0 30px;
374
+ }
375
+
376
+ .wc-inset-text {
377
+ @extend .govuk-inset-text;
378
+
379
+ font-size: 16px;
380
+ border-left-width: 5px;
381
+ padding-top: 5px;
382
+ padding-bottom: 5px;
383
+ margin-top: 20px;
384
+ margin-bottom: 30px;
385
+ }
386
+
387
+ .wc-back-btn,
388
+ .wc-hide-btn,
389
+ .wc-close-btn {
390
+ display: block;
391
+ flex: 0 0 auto;
392
+
393
+ // align-self: flex-end;
394
+ font-size: 16px;
395
+ color: govuk-colour('white');
396
+ background-color: transparent;;
397
+ border: 0 solid transparent;
398
+ padding: 7px;
399
+ margin: 0 0 0 auto;
400
+ cursor: pointer;
401
+
402
+ &:focus {
403
+ outline: none;
404
+ }
405
+
406
+ &:focus.wc-focus-visible {
407
+ outline: 3px solid $govuk-focus-colour;
408
+ }
409
+
410
+ svg {
411
+ position: relative;
412
+ color: govuk-colour('white');
413
+ vertical-align: middle;
414
+ pointer-events: none;
415
+ }
416
+ }
417
+
418
+ .wc-back-btn {
419
+ margin-right: -7px;
420
+
421
+ @include mq ($from: 'tablet') {
422
+ display: none;
423
+ }
424
+ }
425
+
426
+ .wc-hide-btn,
427
+ .wc-close-btn {
428
+ @include mq ($until: 'tablet') {
429
+ display: none;
430
+ }
431
+ }
432
+
433
+ .wc-start-btn,
434
+ .wc-submit-btn,
435
+ .wc-confirm-end-btn,
436
+ .wc-submit-feedback-btn,
437
+ .wc-feedback-btn {
438
+ @extend .govuk-button;
439
+
440
+ font-size: 16px;
441
+
442
+ &:focus:not(:active):not(:hover) {
443
+ background-color: govuk-colour('green');
444
+ border-color: govuk-colour('green');
445
+ color: govuk-colour('white');
446
+ }
447
+
448
+ &:focus:not(:active):hover {
449
+ border-color: transparent;
450
+ box-shadow: 0 2px 0 govuk-colour('black');
451
+ }
452
+
453
+ &.wc-focus-visible:focus:not(:active) {
454
+ border-color: $govuk-focus-colour;
455
+ color: govuk-colour('black');
456
+ background-color: $govuk-focus-colour;
457
+ box-shadow: 0 2px 0 govuk-colour('black');
458
+ }
459
+ }
460
+
461
+ .wc-message {
462
+ position: relative;
463
+ display: flex;
464
+ flex-wrap: nowrap;
465
+ align-items: baseline;
466
+ border-top: 1px solid govuk-colour('black');
467
+ border-bottom: 1px solid govuk-colour('black');
468
+
469
+ &.wc-focus-visible::after {
470
+ @include focus($glow: 5px, $strong: 2px, $background: 0, $inset: 0);
471
+
472
+ inset: 4px;
473
+ }
474
+
475
+ &__label {
476
+ position: absolute;
477
+ pointer-events: none;
478
+
479
+ @extend .govuk-body;
480
+
481
+ font-size: 16px;
482
+ line-height: 20px;
483
+ margin: 20px;
484
+
485
+ @include mq ($from: 'tablet') {
486
+ margin: 18px 18px 19px;
487
+ }
488
+
489
+ left: 0;
490
+ bottom: 0;
491
+ color: govuk-colour('dark-grey');
492
+ z-index: 3;
493
+ }
494
+
495
+ &__label--hidden {
496
+ @extend .govuk-visually-hidden;
497
+ }
498
+
499
+ &__textbox {
500
+ @extend .govuk-textarea;
501
+
502
+ box-sizing: border-box;
503
+ min-height: auto;
504
+ font-size: 16px;
505
+ line-height: 20px;
506
+ max-height: 120px;
507
+ flex: 1 1 auto;
508
+ align-self: flex-end;
509
+ margin: 20px;
510
+
511
+ @include mq ($from: 'tablet') {
512
+ margin: 18px 18px 19px;
513
+ }
514
+
515
+ padding: 0;
516
+ border: 0;
517
+ height: 20px;
518
+ resize: none;
519
+ overflow-x: hidden;
520
+ overscroll-behavior: contain;
521
+
522
+ &:focus {
523
+ outline: none;
524
+ box-shadow: none;
525
+ z-index: 2;
526
+ }
527
+ }
528
+
529
+ &__send {
530
+ @extend .govuk-button;
531
+
532
+ margin: 10px 15px 12px 0;
533
+
534
+ @include mq ($from: 'tablet') {
535
+ margin-right: 10px;
536
+ }
537
+
538
+ font-size: 16px;
539
+ position: relative;
540
+ flex: 0 0 auto;
541
+ align-self: flex-end;
542
+ display: flex;
543
+ flex-flow: row nowrap;
544
+ align-items: center;
545
+ width: auto;
546
+ cursor: pointer;
547
+
548
+ svg {
549
+ display: block;
550
+ color: govuk-colour('white');
551
+ pointer-events: none;
552
+ margin-left: 5px;
553
+ }
554
+ }
555
+ }
556
+
557
+ .wc-credit {
558
+ display: none;
559
+
560
+ @include govuk-font($size: 14);
561
+
562
+ color: $govuk-secondary-text-colour;
563
+ padding: 0 10px 5px;
564
+ }
565
+
566
+ .wc-end-btn,
567
+ .wc-transcript-btn,
568
+ .wc-audio-btn,
569
+ .wc-settings-btn {
570
+ display: inline-block;
571
+ color: $govuk-text-colour !important;
572
+ margin: 10px 5px;
573
+ }
574
+
575
+ .wc-audio-btn span {
576
+ pointer-events: none;
577
+ }
578
+
579
+ .wc-end-btn {
580
+ font-size: 16px;
581
+ margin: 0;
582
+ width: auto;
583
+ }
584
+
585
+ .wc-link__inner {
586
+ max-width: 960px;
587
+ margin-left: auto;
588
+ margin-right: auto;
589
+ }
590
+
591
+ .wc-link--fixed {
592
+ position: fixed;
593
+ bottom: 0;
594
+ left: 0;
595
+ right: 0;
596
+ padding-left: 15px;
597
+ padding-right: 15px;
598
+
599
+ @include mq ($from: 'tablet') {
600
+ padding-left: 30px;
601
+ padding-right: 30px;
602
+ }
603
+
604
+ background-color: govuk-colour('light-grey');
605
+
606
+ .wc-open-btn {
607
+ margin-top: 10px;
608
+ margin-bottom: 10px;
609
+ }
610
+ }
611
+
612
+ .wc-link--hidden {
613
+ display:none;
614
+ }
615
+
616
+ .wc-open-btn {
617
+ @extend .defra-link-icon;
618
+
619
+ margin-bottom: 0;
620
+
621
+ &:visited {
622
+ color: $govuk-link-colour;
623
+ }
624
+
625
+ span {
626
+ pointer-events: none;
627
+ }
628
+
629
+ svg {
630
+ @include mq ($from: 'tablet') {
631
+ top: 3px;
632
+ }
633
+
634
+ color: govuk-colour('black');
635
+ pointer-events: none;
636
+ }
637
+
638
+ &:focus {
639
+ box-shadow: none;
640
+ background-color: transparent;
641
+ text-decoration: underline;
642
+ color: $govuk-focus-colour;
643
+ }
644
+
645
+ &:hover:not(:focus):not(:active) {
646
+ color: $govuk-link-hover-colour;
647
+
648
+ svg {
649
+ color: govuk-colour('dark-blue');
650
+ }
651
+
652
+ .wc-open-btn__unseen {
653
+ background-color: govuk-colour('dark-blue');
654
+ }
655
+ }
656
+
657
+ &__unseen {
658
+ display: inline-block;
659
+ position: relative;
660
+ border-radius: 10px;
661
+ background-color: govuk-colour('black');
662
+ color: govuk-colour('white');
663
+ font-weight: bold;
664
+ font-size: 14px;
665
+ padding: 0 6px;
666
+ margin-left: 5px;
667
+
668
+ @include mq ($from: tablet) {
669
+ top: -1px;
670
+ padding-left: 7px;
671
+ padding-right: 7px;
672
+ }
673
+ }
674
+ }
675
+
676
+ .wc-timeout {
677
+ text-align: center;
678
+ padding-bottom: 20px;
679
+
680
+ &__inner {
681
+ margin: 5px 10px;
682
+ border-top: 1px solid govuk-colour('mid-grey');
683
+ }
684
+
685
+ &__message {
686
+ position: relative;
687
+ display: inline-block;
688
+ margin: auto;
689
+ background-color: govuk-colour('white');
690
+ padding: 0 5px;
691
+ top: -11px;
692
+
693
+ @include govuk-font($size: 14);
694
+
695
+ color: $govuk-secondary-text-colour;
696
+ font-size: 14px;
697
+ }
698
+ }
699
+
700
+ .wc-cancel-timeout-btn {
701
+ @extend .defra-button-secondary;
702
+ }
703
+
704
+ // Overides
705
+ .wc .govuk-character-count {
706
+ margin-bottom: 0;
707
+ }
708
+
709
+ .wc .govuk-error-summary {
710
+ margin-bottom: 30px;
711
+ }
712
+
713
+ .wc .govuk-error-summary__list {
714
+ margin-bottom: 0;
715
+
716
+ li:last-child {
717
+ margin-bottom: 0;
718
+ }
719
+ }
720
+
721
+ // Keyboard only focus helper
722
+ .wc [hidden] {
723
+ display: none !important;
724
+ }
725
+
726
+ [data-wc-focus-visible] {
727
+ &:focus {
728
+ box-shadow: none;
729
+ background-color: transparent;
730
+ text-decoration: underline;
731
+ color: $govuk-link-colour;
732
+ }
733
+
734
+ &:active {
735
+ color: govuk-colour('black');
736
+ }
737
+
738
+ &.wc-focus-visible:focus {
739
+ background-color: $govuk-focus-colour;
740
+ box-shadow: 0 -2px $govuk-focus-colour, 0 4px govuk-colour('black');
741
+ text-decoration: none;
742
+ color: govuk-colour('black');
743
+ }
3
744
  }