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