@jetbrains/kotlin-web-site-ui 4.0.1 → 4.1.0-alpha.10
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/out/components/header/full-search/chapters/chapters.js +59 -0
- package/out/components/header/full-search/chapters/chapters.module.pcss.js +11 -0
- package/out/components/header/full-search/empty/empty.js +22 -0
- package/out/components/header/full-search/empty/empty.module.pcss.js +6 -0
- package/out/components/header/full-search/empty/full-search-empty.svg.js +1539 -0
- package/out/components/header/full-search/full-search.js +105 -0
- package/out/components/header/full-search/full-search.module.pcss.js +10 -0
- package/out/components/header/full-search/hit-list/get-extended-hits.js +55 -0
- package/out/components/header/full-search/hit-list/hit-list.js +47 -0
- package/out/components/header/full-search/hit-list/hit-list.module.pcss.js +5 -0
- package/out/components/header/full-search/loading/loading.js +13 -0
- package/out/components/header/full-search/loading/loading.module.pcss.js +4 -0
- package/out/components/header/full-search/results-list/results-list.js +25 -0
- package/out/components/header/header.js +62 -7
- package/out/components/header/index.css +381 -0
- package/out/components/header/is-macos.js +5 -0
- package/out/components/header/key-codes.js +3 -0
- package/out/components/header/quick-search/empty/empty.js +17 -0
- package/out/components/header/quick-search/empty/empty.module.pcss.js +5 -0
- package/out/components/header/quick-search/list/list.js +33 -0
- package/out/components/header/quick-search/list/list.module.pcss.js +7 -0
- package/out/components/header/quick-search/loading/loading.js +14 -0
- package/out/components/header/quick-search/loading/loading.module.pcss.js +4 -0
- package/out/components/header/quick-search/quick-search.js +41 -0
- package/out/components/header/quick-search/quick-search.module.pcss.js +4 -0
- package/out/components/header/quick-search/result/result.js +30 -0
- package/out/components/header/quick-search/result/result.module.pcss.js +6 -0
- package/out/components/header/search-box/search-box.js +73 -0
- package/out/components/header/search-box/search-box.module.pcss.js +7 -0
- package/out/components/header/search-wrapper/init-search.js +60 -0
- package/out/components/header/search-wrapper/search-const.js +13 -0
- package/out/components/header/search-wrapper/search-context.js +18 -0
- package/out/components/header/search-wrapper/search-with-algolia.js +58 -0
- package/out/components/header/search-wrapper/search-wrapper.js +40 -0
- package/out/components/header/search-wrapper/use-search.js +85 -0
- package/out/components/top-menu/dropdown-menu/dropdown-menu.js +1 -3
- package/out/components/top-menu/dropdown-menu/dropdown-menu.module.pcss.js +0 -1
- package/out/components/top-menu/index.css +0 -11
- package/package.json +14 -4
|
@@ -272,6 +272,387 @@
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
+
.ktl-result-module_result_EKhUw {
|
|
276
|
+
box-sizing: border-box;
|
|
277
|
+
display: block;
|
|
278
|
+
padding: 16px;
|
|
279
|
+
text-decoration: none;
|
|
280
|
+
}
|
|
281
|
+
.ktl-result-module_result_EKhUw:hover {
|
|
282
|
+
background: rgba(255, 255, 255, 0.1);
|
|
283
|
+
text-decoration: none;
|
|
284
|
+
}
|
|
285
|
+
.ktl-result-module_result_EKhUw:focus {
|
|
286
|
+
outline: none;
|
|
287
|
+
background: rgba(255, 255, 255, 0.1);
|
|
288
|
+
}
|
|
289
|
+
.ktl-result-module_result_EKhUw em {
|
|
290
|
+
background-color: rgba(127,82,255,0.3);
|
|
291
|
+
font-style: normal;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.ktl-result-module_resultTitle_DSpAT {
|
|
295
|
+
margin-bottom: 6px;
|
|
296
|
+
overflow-wrap: break-word;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.ktl-result-module_text_fWBKG {
|
|
300
|
+
display: -webkit-box;
|
|
301
|
+
-webkit-line-clamp: 2;
|
|
302
|
+
-webkit-box-orient: vertical;
|
|
303
|
+
overflow: hidden;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
@media (min-width: 768px) {
|
|
307
|
+
.ktl-result-module_result_EKhUw {
|
|
308
|
+
padding: 16px 32px;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
.ktl-list-module_results_LlxqY {
|
|
312
|
+
box-sizing: border-box;
|
|
313
|
+
max-height: 305px;
|
|
314
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
315
|
+
background: #323236;
|
|
316
|
+
color: #fff;
|
|
317
|
+
overflow-y: scroll;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.ktl-list-module_topBar_OO0XT {
|
|
321
|
+
display: none;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.ktl-list-module_advancedSearch_XNy88 {
|
|
325
|
+
display: inline-block;
|
|
326
|
+
background: transparent;
|
|
327
|
+
border: 0;
|
|
328
|
+
padding: 6px 16px;
|
|
329
|
+
border-radius: 24px;
|
|
330
|
+
cursor: pointer;
|
|
331
|
+
flex-shrink: 0;
|
|
332
|
+
transform: translateY(-6px);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.ktl-list-module_advancedSearch_XNy88:hover {
|
|
336
|
+
background: rgba(255, 255, 255, .1);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.ktl-list-module_advancedSearch_XNy88:focus {
|
|
340
|
+
outline: none;
|
|
341
|
+
box-shadow: rgba(107, 87, 255, 0.8) 0 0 0 4px;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.ktl-list-module_searchString_rJnxa {
|
|
345
|
+
height: 40px;
|
|
346
|
+
display: -webkit-box;
|
|
347
|
+
-webkit-line-clamp: 2;
|
|
348
|
+
-webkit-box-orient: vertical;
|
|
349
|
+
overflow: hidden;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
@media (min-width: 768px) {
|
|
353
|
+
.ktl-list-module_results_LlxqY {
|
|
354
|
+
max-height: 434px;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.ktl-list-module_topBar_OO0XT {
|
|
358
|
+
display: flex;
|
|
359
|
+
align-items: flex-start;
|
|
360
|
+
justify-content: space-between;
|
|
361
|
+
padding: 34px 32px 4px 32px;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
.ktl-empty-module_empty_xh1i- {
|
|
365
|
+
box-sizing: border-box;
|
|
366
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
367
|
+
background: #323236;
|
|
368
|
+
padding: 16px;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.ktl-empty-module_resultString_-8dzl {
|
|
372
|
+
display: -webkit-box;
|
|
373
|
+
-webkit-line-clamp: 3;
|
|
374
|
+
-webkit-box-orient: vertical;
|
|
375
|
+
overflow: hidden;
|
|
376
|
+
overflow-wrap: break-word;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
@media (min-width: 768px) {
|
|
380
|
+
.ktl-empty-module_empty_xh1i- {
|
|
381
|
+
padding: 32px;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.ktl-empty-module_resultString_-8dzl {
|
|
385
|
+
-webkit-line-clamp: 2;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
.ktl-loading-module_loading_CtOhW {
|
|
389
|
+
box-sizing: border-box;
|
|
390
|
+
height: 92px;
|
|
391
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
392
|
+
background: #323236;
|
|
393
|
+
display: flex;
|
|
394
|
+
justify-content: center;
|
|
395
|
+
align-items: center;
|
|
396
|
+
text-align: left;
|
|
397
|
+
}
|
|
398
|
+
.ktl-loading-module_loading_CtOhW > svg {
|
|
399
|
+
fill: #6B57FF;
|
|
400
|
+
}
|
|
401
|
+
.ktl-quick-search-module_wrapper_kkbQQ {
|
|
402
|
+
box-sizing: border-box;
|
|
403
|
+
position: absolute;
|
|
404
|
+
left: 8px;
|
|
405
|
+
right: 8px;
|
|
406
|
+
bottom: -8px;
|
|
407
|
+
transform: translateY(100%);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
@media (min-width: 640px) and (max-width: 768px) {
|
|
411
|
+
.ktl-quick-search-module_wrapper_kkbQQ {
|
|
412
|
+
bottom: 12px;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
@media (min-width: 768px) {
|
|
417
|
+
.ktl-quick-search-module_wrapper_kkbQQ {
|
|
418
|
+
left: 0;
|
|
419
|
+
right: 0;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
.ktl-loading-module_loader_B2IQl {
|
|
423
|
+
margin-top: 4px;
|
|
424
|
+
}
|
|
425
|
+
.ktl-loading-module_loader_B2IQl > svg {
|
|
426
|
+
fill: #6B57FF;
|
|
427
|
+
}
|
|
428
|
+
.ktl-empty-module_wrapper_cNB8Y {
|
|
429
|
+
display: block;
|
|
430
|
+
margin-top: 30px;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.ktl-empty-module_title_p2FMj {
|
|
434
|
+
margin-bottom: 24px;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.ktl-empty-module_image_6Xr6L {
|
|
438
|
+
display: flex;
|
|
439
|
+
justify-content: flex-end;
|
|
440
|
+
margin-top: 16px;
|
|
441
|
+
}
|
|
442
|
+
.ktl-chapters-module_chapters_J0wLB {
|
|
443
|
+
border-left: 1px solid var(--ktl-light-dark-20);
|
|
444
|
+
padding-left: 12px;
|
|
445
|
+
margin-top: 24px;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.ktl-chapters-module_chapterTitle_b6Rdz {
|
|
449
|
+
//border-bottom-color: transparent;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.ktl-chapters-module_chapterTitle_b6Rdz:hover {
|
|
453
|
+
//border-bottom-color: #19191C;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.ktl-chapters-module_chapterTitle_b6Rdz em {
|
|
457
|
+
background: rgba(127, 82, 255, 0.2);
|
|
458
|
+
font-style: normal;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.ktl-chapters-module_singleChapter_zSmx2:not(:last-child) {
|
|
462
|
+
margin-bottom: 12px;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.ktl-chapters-module_headliner_ZBuf9 {
|
|
466
|
+
margin: 0;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.ktl-chapters-module_snippet_yROJo {
|
|
470
|
+
margin-top: 8px;
|
|
471
|
+
color: rgba(39, 40, 44, 0.7);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.ktl-chapters-module_snippet_yROJo em {
|
|
475
|
+
background: rgba(127, 82, 255, 0.2);
|
|
476
|
+
font-style: normal;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.ktl-chapters-module_extraSection_lsZfw {
|
|
480
|
+
display: none;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.ktl-chapters-module_visibleSection_wQyvM {
|
|
484
|
+
display: block;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.ktl-chapters-module_moreButton_98oqy {
|
|
488
|
+
margin-top: 12px;
|
|
489
|
+
}
|
|
490
|
+
.ktl-hit-list-module_hitList_1MP6m {
|
|
491
|
+
margin: 40px 0 50px 0;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.ktl-hit-list-module_titleLink_rdJ6u em {
|
|
495
|
+
background: rgba(127, 82, 255, 0.2);
|
|
496
|
+
font-style: normal;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.ktl-full-search-module_fullSearch_MTU8t {
|
|
500
|
+
display: none;
|
|
501
|
+
box-sizing: border-box;
|
|
502
|
+
position: fixed;
|
|
503
|
+
width: 100%;
|
|
504
|
+
height: 100%;
|
|
505
|
+
top: 0;
|
|
506
|
+
left: 0;
|
|
507
|
+
background: #ffffff;
|
|
508
|
+
overflow-y: auto;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.ktl-full-search-module_closeSearch_5vYDG {
|
|
512
|
+
position: absolute;
|
|
513
|
+
top: 40px;
|
|
514
|
+
right: 40px;
|
|
515
|
+
display: flex;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.ktl-full-search-module_fullSearchClearButton_DGS6T {
|
|
519
|
+
margin: 0;
|
|
520
|
+
padding: 0;
|
|
521
|
+
border: 0;
|
|
522
|
+
background: none;
|
|
523
|
+
display: flex;
|
|
524
|
+
cursor: pointer;
|
|
525
|
+
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.ktl-full-search-module_fullSearchClearButton_DGS6T > svg {
|
|
529
|
+
opacity: 0.7;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.ktl-full-search-module_fullSearchClearButton_DGS6T:hover > svg {
|
|
533
|
+
opacity: 1;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.ktl-full-search-module_fullSearchClearButton_DGS6T:focus {
|
|
537
|
+
outline: none;
|
|
538
|
+
box-shadow: rgba(107, 87, 255, 0.8) 0 0 0 4px;
|
|
539
|
+
border-radius: 100%;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.ktl-full-search-module_fullSearchClearButton_DGS6T:focus > svg {
|
|
543
|
+
opacity: 1;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.ktl-full-search-module_wrapper_9rxXb {
|
|
547
|
+
max-width: 704px;
|
|
548
|
+
margin: 0 auto;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
.ktl-full-search-module_header_Wltw0 {
|
|
552
|
+
width: 100%;
|
|
553
|
+
padding-top: 120px;
|
|
554
|
+
padding-bottom: 10px;
|
|
555
|
+
position: sticky;
|
|
556
|
+
top: 0;
|
|
557
|
+
left: 0;
|
|
558
|
+
background: #ffffff;
|
|
559
|
+
z-index: 10;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.ktl-full-search-module_results_svcSE {
|
|
563
|
+
margin-top: 14px;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.ktl-full-search-module_switcher_o1RgM {
|
|
567
|
+
display: flex;
|
|
568
|
+
justify-content: flex-end;
|
|
569
|
+
margin-top: 14px;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
@media (min-width: 768px) {
|
|
573
|
+
.ktl-full-search-module_fullSearch_MTU8t {
|
|
574
|
+
display: block;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.ktl-search-box-module_searchBox_0SgE9 {
|
|
579
|
+
position: relative;
|
|
580
|
+
width: 408px;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.ktl-search-box-module_searchInput_ba2QS {
|
|
584
|
+
display: flex;
|
|
585
|
+
flex-direction: column;
|
|
586
|
+
width: 100%;
|
|
587
|
+
position: relative;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.ktl-search-box-module_searchMobileClose_fBF7e {
|
|
591
|
+
margin: 0;
|
|
592
|
+
padding: 0 8px;
|
|
593
|
+
border: 0;
|
|
594
|
+
background: none;
|
|
595
|
+
cursor: pointer;
|
|
596
|
+
position: absolute;
|
|
597
|
+
right: 0;
|
|
598
|
+
top: 0;
|
|
599
|
+
height: 100%;
|
|
600
|
+
display: flex;
|
|
601
|
+
align-items: center;
|
|
602
|
+
justify-content: center;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.ktl-search-box-module_searchMobileClose_fBF7e > svg {
|
|
606
|
+
fill: #ffffff;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
.ktl-search-box-module_customClearButton_yecGK {
|
|
610
|
+
margin: 0;
|
|
611
|
+
padding: 0;
|
|
612
|
+
border: 0;
|
|
613
|
+
background: none;
|
|
614
|
+
display: flex;
|
|
615
|
+
cursor: pointer;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.ktl-search-box-module_customClearButton_yecGK > svg {
|
|
619
|
+
fill: #ffffff;
|
|
620
|
+
opacity: 0.7;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
.ktl-search-box-module_customClearButton_yecGK:hover > svg {
|
|
624
|
+
opacity: 1;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.ktl-search-box-module_customClearButton_yecGK:focus {
|
|
628
|
+
outline: none;
|
|
629
|
+
box-shadow: rgba(107, 87, 255, 0.8) 0 0 0 4px;
|
|
630
|
+
border-radius: 100%;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.ktl-search-box-module_customClearButton_yecGK:focus > svg {
|
|
634
|
+
opacity: 1;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
@media (max-width: 767px) {
|
|
638
|
+
.ktl-search-box-module_searchBox_0SgE9 {
|
|
639
|
+
background: var(--ktl-dark-100);
|
|
640
|
+
width: auto;
|
|
641
|
+
position: absolute;
|
|
642
|
+
top: 0;
|
|
643
|
+
left: 0;
|
|
644
|
+
right: 0;
|
|
645
|
+
bottom: 0;
|
|
646
|
+
padding: 4px;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
@media (min-width: 768px) {
|
|
651
|
+
.ktl-search-box-module_searchMobileClose_fBF7e {
|
|
652
|
+
display: none;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
275
656
|
:root {
|
|
276
657
|
--ktl-light-grey: #f4f4f4;
|
|
277
658
|
--ktl-dark-100: rgba(39, 40, 44, 1);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { useTextStyles } from '@rescui/typography';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import styles from './empty.module.pcss.js';
|
|
5
|
+
|
|
6
|
+
const EmptyResult = ({
|
|
7
|
+
placeholder
|
|
8
|
+
}) => {
|
|
9
|
+
const textCn = useTextStyles();
|
|
10
|
+
return React__default.createElement("div", {
|
|
11
|
+
className: styles.empty
|
|
12
|
+
}, React__default.createElement("div", {
|
|
13
|
+
className: classNames(textCn('rs-h4'), styles.resultString)
|
|
14
|
+
}, placeholder));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { EmptyResult };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { Result } from '../result/result.js';
|
|
3
|
+
import { useTextStyles } from '@rescui/typography';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { isMacOs } from '../../is-macos.js';
|
|
6
|
+
import styles from './list.module.pcss.js';
|
|
7
|
+
|
|
8
|
+
const ResultsList = ({
|
|
9
|
+
results,
|
|
10
|
+
searchString,
|
|
11
|
+
toggleFullSearch
|
|
12
|
+
}) => {
|
|
13
|
+
const textCn = useTextStyles();
|
|
14
|
+
return React__default.createElement("div", {
|
|
15
|
+
className: styles.results
|
|
16
|
+
}, results.length ? React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
17
|
+
className: styles.topBar
|
|
18
|
+
}, React__default.createElement("div", {
|
|
19
|
+
className: classNames(textCn('rs-text-3'), styles.searchString)
|
|
20
|
+
}, "Showing results for \u00AB", searchString, "\u00BB"), React__default.createElement("button", {
|
|
21
|
+
className: styles.advancedSearch,
|
|
22
|
+
onClick: toggleFullSearch
|
|
23
|
+
}, React__default.createElement("div", {
|
|
24
|
+
className: classNames(textCn('rs-text-3', {
|
|
25
|
+
hardness: 'hard'
|
|
26
|
+
}))
|
|
27
|
+
}, "Advanced search ", isMacOs() ? '⌘K' : 'Ctrl+K'))), results.map((searchResult, index) => React__default.createElement(Result, {
|
|
28
|
+
key: index,
|
|
29
|
+
hit: searchResult
|
|
30
|
+
}))) : null);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { ResultsList };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { LoadingIcon } from '@rescui/icons';
|
|
3
|
+
import styles from './loading.module.pcss.js';
|
|
4
|
+
|
|
5
|
+
const LoadingResults = () => {
|
|
6
|
+
return React__default.createElement("div", {
|
|
7
|
+
className: styles.loading
|
|
8
|
+
}, React__default.createElement(LoadingIcon, {
|
|
9
|
+
theme: 'dark',
|
|
10
|
+
size: 'l'
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { LoadingResults };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { ThemeProvider } from '@rescui/ui-contexts';
|
|
3
|
+
import { ResultsList } from './list/list.js';
|
|
4
|
+
import { EmptyResult } from './empty/empty.js';
|
|
5
|
+
import { LoadingResults } from './loading/loading.js';
|
|
6
|
+
import styles from './quick-search.module.pcss.js';
|
|
7
|
+
|
|
8
|
+
const QuickSearch = ({
|
|
9
|
+
results,
|
|
10
|
+
searchString,
|
|
11
|
+
toggleFullSearch,
|
|
12
|
+
placeholder
|
|
13
|
+
}) => {
|
|
14
|
+
if (placeholder) {
|
|
15
|
+
return React__default.createElement(ThemeProvider, {
|
|
16
|
+
theme: 'dark'
|
|
17
|
+
}, React__default.createElement("div", {
|
|
18
|
+
className: styles.wrapper
|
|
19
|
+
}, React__default.createElement(EmptyResult, {
|
|
20
|
+
placeholder: placeholder
|
|
21
|
+
})));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (results.length > 0) {
|
|
25
|
+
return React__default.createElement(ThemeProvider, {
|
|
26
|
+
theme: 'dark'
|
|
27
|
+
}, React__default.createElement("div", {
|
|
28
|
+
className: styles.wrapper
|
|
29
|
+
}, React__default.createElement(ResultsList, {
|
|
30
|
+
results: results,
|
|
31
|
+
searchString: searchString,
|
|
32
|
+
toggleFullSearch: toggleFullSearch
|
|
33
|
+
})));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return React__default.createElement("div", {
|
|
37
|
+
className: styles.wrapper
|
|
38
|
+
}, React__default.createElement(LoadingResults, null));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { QuickSearch };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { useTextStyles } from '@rescui/typography';
|
|
3
|
+
import styles from './result.module.pcss.js';
|
|
4
|
+
|
|
5
|
+
const Result = ({
|
|
6
|
+
hit
|
|
7
|
+
}) => {
|
|
8
|
+
const textCn = useTextStyles();
|
|
9
|
+
const hitTitle = hit.title === hit.mainTitle ? hit.highlightedTitle : `${hit.mainTitle}: ${hit.highlightedTitle}`;
|
|
10
|
+
return React__default.createElement("a", {
|
|
11
|
+
className: styles.result,
|
|
12
|
+
href: hit.url
|
|
13
|
+
}, React__default.createElement("div", {
|
|
14
|
+
className: styles.resultTitle
|
|
15
|
+
}, React__default.createElement("div", {
|
|
16
|
+
className: textCn('rs-h4'),
|
|
17
|
+
dangerouslySetInnerHTML: {
|
|
18
|
+
__html: hitTitle
|
|
19
|
+
}
|
|
20
|
+
})), React__default.createElement("div", {
|
|
21
|
+
className: styles.text
|
|
22
|
+
}, React__default.createElement("div", {
|
|
23
|
+
className: textCn('rs-text-3'),
|
|
24
|
+
dangerouslySetInnerHTML: {
|
|
25
|
+
__html: hit.snippet
|
|
26
|
+
}
|
|
27
|
+
})));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { Result };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React__default, { useState, useCallback, useEffect } from 'react';
|
|
2
|
+
import Input from '@rescui/input';
|
|
3
|
+
import { SearchIcon, CloseIcon, ErrorIcon } from '@rescui/icons';
|
|
4
|
+
import { QuickSearch } from '../quick-search/quick-search.js';
|
|
5
|
+
import { FullSearch } from '../full-search/full-search.js';
|
|
6
|
+
import styles from './search-box.module.pcss.js';
|
|
7
|
+
import { useSearch } from '../search-wrapper/use-search.js';
|
|
8
|
+
import { ESC_CODE } from '../key-codes.js';
|
|
9
|
+
|
|
10
|
+
const SearchBox = ({
|
|
11
|
+
closeHandler,
|
|
12
|
+
isMobile,
|
|
13
|
+
fullSearchActive,
|
|
14
|
+
setFullSearchActive
|
|
15
|
+
}) => {
|
|
16
|
+
const [searchInput, setSearchInput] = useState('');
|
|
17
|
+
const {
|
|
18
|
+
hits,
|
|
19
|
+
placeholder
|
|
20
|
+
} = useSearch(searchInput, 25);
|
|
21
|
+
const escHandler = useCallback(event => {
|
|
22
|
+
if (event.keyCode === ESC_CODE) {
|
|
23
|
+
closeHandler();
|
|
24
|
+
}
|
|
25
|
+
}, [closeHandler]);
|
|
26
|
+
const handleInput = useCallback(e => {
|
|
27
|
+
setSearchInput(e.target.value);
|
|
28
|
+
}, []);
|
|
29
|
+
const handleClear = useCallback(() => {
|
|
30
|
+
setSearchInput('');
|
|
31
|
+
}, []);
|
|
32
|
+
const toggleFullSearch = useCallback(() => {
|
|
33
|
+
setFullSearchActive(!fullSearchActive);
|
|
34
|
+
}, [fullSearchActive]);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (typeof document !== `undefined`) {
|
|
37
|
+
document.addEventListener('keydown', escHandler);
|
|
38
|
+
return () => {
|
|
39
|
+
document.removeEventListener('keydown', escHandler);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}, [escHandler]);
|
|
43
|
+
return React__default.createElement("div", {
|
|
44
|
+
className: styles.searchBox
|
|
45
|
+
}, React__default.createElement("div", {
|
|
46
|
+
className: styles.searchInput
|
|
47
|
+
}, React__default.createElement(Input, {
|
|
48
|
+
iconType: 'left',
|
|
49
|
+
value: searchInput,
|
|
50
|
+
onChange: handleInput,
|
|
51
|
+
onClear: isMobile ? closeHandler : handleClear,
|
|
52
|
+
icon: React__default.createElement(SearchIcon, null),
|
|
53
|
+
clearIcon: isMobile ? React__default.createElement(CloseIcon, null) : React__default.createElement("button", {
|
|
54
|
+
className: styles.customClearButton
|
|
55
|
+
}, React__default.createElement(ErrorIcon, null)),
|
|
56
|
+
autoFocus: true
|
|
57
|
+
}), isMobile && React__default.createElement("button", {
|
|
58
|
+
className: styles.searchMobileClose,
|
|
59
|
+
onClick: closeHandler
|
|
60
|
+
}, React__default.createElement(CloseIcon, null))), searchInput && React__default.createElement(QuickSearch, {
|
|
61
|
+
results: hits,
|
|
62
|
+
searchString: searchInput,
|
|
63
|
+
toggleFullSearch: toggleFullSearch,
|
|
64
|
+
placeholder: placeholder
|
|
65
|
+
}), fullSearchActive && React__default.createElement(FullSearch, {
|
|
66
|
+
toggleFullSearch: toggleFullSearch,
|
|
67
|
+
searchString: searchInput,
|
|
68
|
+
results: hits,
|
|
69
|
+
killSearch: closeHandler
|
|
70
|
+
}));
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { SearchBox };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var styles = {
|
|
2
|
+
"searchBox": "ktl-search-box-module_searchBox_0SgE9",
|
|
3
|
+
"searchInput": "ktl-search-box-module_searchInput_ba2QS",
|
|
4
|
+
"searchMobileClose": "ktl-search-box-module_searchMobileClose_fBF7e",
|
|
5
|
+
"customClearButton": "ktl-search-box-module_customClearButton_yecGK"
|
|
6
|
+
};
|
|
7
|
+
export { styles as default };
|