@jetbrains/kotlin-web-site-ui 4.1.0-alpha.1 → 4.1.0-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.
@@ -32,7 +32,10 @@ const Chapters = ({
32
32
  }, React__default.createElement("h4", {
33
33
  className: classNames(textCn('rs-h4'), styles.headliner)
34
34
  }, React__default.createElement("a", {
35
- className: classNames(styles.chapterTitle, textCn('rs-link')),
35
+ className: classNames(styles.chapterTitle, textCn('rs-link', {
36
+ mode: 'clear',
37
+ hardness: 'hard'
38
+ })),
36
39
  href: url,
37
40
  id: chapterId,
38
41
  dangerouslySetInnerHTML: {
@@ -1,12 +1,11 @@
1
- import React__default, { useState, useContext, useCallback } from 'react';
1
+ import React__default, { useState, useCallback } from 'react';
2
2
  import { ThemeProvider } from '@rescui/ui-contexts';
3
3
  import Input from '@rescui/input';
4
- import Switcher from '@rescui/switcher';
4
+ import Button from '@rescui/button';
5
5
  import { CloseIcon, ErrorIcon } from '@rescui/icons';
6
6
  import styles from './full-search.module.pcss.js';
7
7
  import { useSearch } from '../search-wrapper/use-search.js';
8
8
  import { ResultsList } from './results-list/results-list.js';
9
- import SearchContext from '../search-wrapper/search-context.js';
10
9
 
11
10
  const FullSearch = ({
12
11
  searchString,
@@ -17,17 +16,9 @@ const FullSearch = ({
17
16
  hits,
18
17
  placeholder
19
18
  } = useSearch(inputValue, 75);
20
- const {
21
- matching,
22
- matchingOptions,
23
- setMatching
24
- } = useContext(SearchContext);
25
19
  const clearSearch = useCallback(() => {
26
20
  setInputValue('');
27
21
  }, []);
28
- const handleSwitcherChange = useCallback(value => {
29
- setMatching(value);
30
- }, []);
31
22
  const handleInputChange = useCallback(e => {
32
23
  setInputValue(e.target.value);
33
24
  }, [inputValue]);
@@ -37,11 +28,13 @@ const FullSearch = ({
37
28
  className: styles.fullSearch
38
29
  }, React__default.createElement("div", {
39
30
  className: styles.header
40
- }, React__default.createElement("button", {
41
- className: styles.closeSearch,
31
+ }, React__default.createElement("div", {
32
+ className: styles.closeSearch
33
+ }, React__default.createElement(Button, {
34
+ mode: 'clear',
35
+ size: 'l',
36
+ icon: React__default.createElement(CloseIcon, null),
42
37
  onClick: killSearch
43
- }, React__default.createElement(CloseIcon, {
44
- size: 'l'
45
38
  })), React__default.createElement("div", {
46
39
  className: styles.wrapper
47
40
  }, React__default.createElement(Input, {
@@ -52,14 +45,7 @@ const FullSearch = ({
52
45
  clearIcon: React__default.createElement(ErrorIcon, null),
53
46
  size: 'l',
54
47
  autoFocus: true
55
- }), React__default.createElement("div", {
56
- className: styles.switcher
57
- }, React__default.createElement(Switcher, {
58
- value: matching,
59
- onChange: handleSwitcherChange,
60
- options: matchingOptions,
61
- size: 'xs'
62
- })))), React__default.createElement("div", {
48
+ }))), React__default.createElement("div", {
63
49
  className: styles.wrapper
64
50
  }, inputValue && React__default.createElement(ResultsList, {
65
51
  placeholder: placeholder,
@@ -3,7 +3,6 @@ var styles = {
3
3
  "closeSearch": "ktl-full-search-module_closeSearch_5vYDG",
4
4
  "wrapper": "ktl-full-search-module_wrapper_9rxXb",
5
5
  "header": "ktl-full-search-module_header_Wltw0",
6
- "switcher": "ktl-full-search-module_switcher_o1RgM",
7
6
  "results": "ktl-full-search-module_results_svcSE"
8
7
  };
9
8
  export { styles as default };
@@ -1,8 +1,10 @@
1
- import React__default from 'react';
1
+ import React__default, { useContext, useCallback } from 'react';
2
+ import classNames from 'classnames';
2
3
  import { useTextStyles } from '@rescui/typography';
3
- import getExtendedHits from '../result/get-extended-hits.js';
4
+ import Switcher from '@rescui/switcher';
5
+ import SearchContext from '../../search-wrapper/search-context.js';
6
+ import getExtendedHits from './get-extended-hits.js';
4
7
  import { Chapters } from '../chapters/chapters.js';
5
- import classNames from 'classnames';
6
8
  import styles from './hit-list.module.pcss.js';
7
9
 
8
10
  const HitList = ({
@@ -10,7 +12,22 @@ const HitList = ({
10
12
  }) => {
11
13
  const textCn = useTextStyles();
12
14
  const extendedHits = getExtendedHits(hits);
13
- return React__default.createElement(React__default.Fragment, null, extendedHits.map(({
15
+ const {
16
+ matching,
17
+ matchingOptions,
18
+ setMatching
19
+ } = useContext(SearchContext);
20
+ const handleSwitcherChange = useCallback(value => {
21
+ setMatching(value);
22
+ }, []);
23
+ return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
24
+ className: styles.switcher
25
+ }, React__default.createElement(Switcher, {
26
+ value: matching,
27
+ onChange: handleSwitcherChange,
28
+ options: matchingOptions,
29
+ size: 'xs'
30
+ })), extendedHits.map(({
14
31
  title,
15
32
  snippet,
16
33
  chapters = [],
@@ -24,7 +41,10 @@ const HitList = ({
24
41
  }, React__default.createElement("h3", {
25
42
  className: textCn('rs-h3')
26
43
  }, React__default.createElement("a", {
27
- className: classNames(styles.titleLink, textCn('rs-link')),
44
+ className: classNames(styles.titleLink, textCn('rs-link', {
45
+ mode: 'clear',
46
+ hardness: 'hard'
47
+ })),
28
48
  href: url,
29
49
  dangerouslySetInnerHTML: {
30
50
  __html: title
@@ -1,4 +1,5 @@
1
1
  var styles = {
2
+ "switcher": "ktl-hit-list-module_switcher_bt6Xx",
2
3
  "hitList": "ktl-hit-list-module_hitList_1MP6m",
3
4
  "titleLink": "ktl-hit-list-module_titleLink_rdJ6u"
4
5
  };
@@ -1,5 +1,6 @@
1
1
  import React__default, { forwardRef, useState, useMemo, useRef, useImperativeHandle, useLayoutEffect, useCallback, useEffect } from 'react';
2
2
  import { ThemeProvider } from '@rescui/ui-contexts';
3
+ import FocusManager from '@rescui/focus-manager';
3
4
  import useResizeObserver from '@react-hook/resize-observer';
4
5
  import OutsideClickHandler from 'react-outside-click-handler';
5
6
  import { LogoLarge } from './logo-large/logo-large.js';
@@ -60,8 +61,10 @@ const Header = forwardRef(({
60
61
  useEffect(() => {
61
62
  if (typeof document !== `undefined`) {
62
63
  document.addEventListener('keydown', fullSearchKeyHandler);
64
+ const focusManager = new FocusManager();
63
65
  return () => {
64
66
  document.removeEventListener('keydown', fullSearchKeyHandler);
67
+ focusManager.destroy();
65
68
  };
66
69
  }
67
70
  }, [fullSearchKeyHandler]);
@@ -275,11 +275,12 @@
275
275
  .ktl-result-module_result_EKhUw {
276
276
  box-sizing: border-box;
277
277
  display: block;
278
- padding: 16px 32px;
278
+ padding: 16px;
279
279
  text-decoration: none;
280
280
  }
281
281
  .ktl-result-module_result_EKhUw:hover {
282
282
  background: rgba(255, 255, 255, 0.1);
283
+ text-decoration: none;
283
284
  }
284
285
  .ktl-result-module_result_EKhUw:focus {
285
286
  outline: none;
@@ -292,6 +293,7 @@
292
293
 
293
294
  .ktl-result-module_resultTitle_DSpAT {
294
295
  margin-bottom: 6px;
296
+ overflow-wrap: break-word;
295
297
  }
296
298
 
297
299
  .ktl-result-module_text_fWBKG {
@@ -300,6 +302,12 @@
300
302
  -webkit-box-orient: vertical;
301
303
  overflow: hidden;
302
304
  }
305
+
306
+ @media (min-width: 768px) {
307
+ .ktl-result-module_result_EKhUw {
308
+ padding: 16px 32px;
309
+ }
310
+ }
303
311
  .ktl-list-module_results_LlxqY {
304
312
  box-sizing: border-box;
305
313
  max-height: 305px;
@@ -321,6 +329,7 @@
321
329
  border-radius: 24px;
322
330
  cursor: pointer;
323
331
  flex-shrink: 0;
332
+ transform: translateY(-6px);
324
333
  }
325
334
 
326
335
  .ktl-list-module_advancedSearch_XNy88:hover {
@@ -332,22 +341,49 @@
332
341
  box-shadow: rgba(107, 87, 255, 0.8) 0 0 0 4px;
333
342
  }
334
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
+
335
352
  @media (min-width: 768px) {
336
353
  .ktl-list-module_results_LlxqY {
337
354
  max-height: 434px;
338
355
  }
356
+
339
357
  .ktl-list-module_topBar_OO0XT {
340
358
  display: flex;
341
- align-items: center;
359
+ align-items: flex-start;
342
360
  justify-content: space-between;
343
- padding: 34px 32px 14px 32px;
361
+ padding: 34px 32px 4px 32px;
344
362
  }
345
363
  }
346
364
  .ktl-empty-module_empty_xh1i- {
347
365
  box-sizing: border-box;
348
366
  border: 1px solid rgba(255, 255, 255, 0.2);
349
367
  background: #323236;
350
- padding: 32px;
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
+ }
351
387
  }
352
388
  .ktl-loading-module_loading_CtOhW {
353
389
  box-sizing: border-box;
@@ -371,6 +407,12 @@
371
407
  transform: translateY(100%);
372
408
  }
373
409
 
410
+ @media (min-width: 880px) and (max-width: 1008px) {
411
+ .ktl-quick-search-module_wrapper_kkbQQ {
412
+ bottom: 12px;
413
+ }
414
+ }
415
+
374
416
  @media (min-width: 768px) {
375
417
  .ktl-quick-search-module_wrapper_kkbQQ {
376
418
  left: 0;
@@ -390,14 +432,10 @@
390
432
  }
391
433
 
392
434
  .ktl-full-search-module_closeSearch_5vYDG {
393
- padding: 0;
394
- margin: 0;
395
- border: 0;
396
- background: none;
397
- cursor: pointer;
398
435
  position: absolute;
399
436
  top: 40px;
400
437
  right: 40px;
438
+ display: flex;
401
439
  }
402
440
 
403
441
  .ktl-full-search-module_wrapper_9rxXb {
@@ -408,7 +446,7 @@
408
446
  .ktl-full-search-module_header_Wltw0 {
409
447
  width: 100%;
410
448
  padding-top: 120px;
411
- padding-bottom: 24px;
449
+ padding-bottom: 14px;
412
450
  position: sticky;
413
451
  top: 0;
414
452
  left: 0;
@@ -416,12 +454,6 @@
416
454
  z-index: 10;
417
455
  }
418
456
 
419
- .ktl-full-search-module_switcher_o1RgM {
420
- margin-top: 14px;
421
- display: flex;
422
- justify-content: flex-end;
423
- }
424
-
425
457
  .ktl-full-search-module_results_svcSE {
426
458
  margin-top: 14px;
427
459
  }
@@ -431,14 +463,12 @@
431
463
  display: block;
432
464
  }
433
465
  }
434
- .ktl-loading-module_loader_B2IQl {
435
- margin: 24px 0;
436
- }
437
- .ktl-loading-module_loader_B2IQl > svg {
466
+ .ktl-loading-module_loader_B2IQl > svg {
438
467
  fill: #6B57FF;
439
468
  }
440
469
  .ktl-empty-module_wrapper_cNB8Y {
441
470
  display: block;
471
+ margin-top: 26px;
442
472
  }
443
473
 
444
474
  .ktl-empty-module_title_p2FMj {
@@ -457,9 +487,13 @@
457
487
  }
458
488
 
459
489
  .ktl-chapters-module_chapterTitle_b6Rdz {
460
- border-bottom-color: transparent;
490
+ //border-bottom-color: transparent;
461
491
  }
462
492
 
493
+ .ktl-chapters-module_chapterTitle_b6Rdz:hover {
494
+ //border-bottom-color: #19191C;
495
+ }
496
+
463
497
  .ktl-chapters-module_chapterTitle_b6Rdz em {
464
498
  background: rgba(127, 82, 255, 0.2);
465
499
  font-style: normal;
@@ -494,12 +528,13 @@
494
528
  .ktl-chapters-module_moreButton_98oqy {
495
529
  margin-top: 12px;
496
530
  }
497
- .ktl-hit-list-module_hitList_1MP6m {
498
- margin: 24px 0;
531
+ .ktl-hit-list-module_switcher_bt6Xx {
532
+ display: flex;
533
+ justify-content: flex-end;
499
534
  }
500
535
 
501
- .ktl-hit-list-module_titleLink_rdJ6u {
502
- border-bottom-color: transparent;
536
+ .ktl-hit-list-module_hitList_1MP6m {
537
+ margin: 50px 0;
503
538
  }
504
539
 
505
540
  .ktl-hit-list-module_titleLink_rdJ6u em {
@@ -1,5 +1,6 @@
1
1
  import React__default from 'react';
2
2
  import { useTextStyles } from '@rescui/typography';
3
+ import classNames from 'classnames';
3
4
  import styles from './empty.module.pcss.js';
4
5
 
5
6
  const EmptyResult = ({
@@ -9,7 +10,7 @@ const EmptyResult = ({
9
10
  return React__default.createElement("div", {
10
11
  className: styles.empty
11
12
  }, React__default.createElement("div", {
12
- className: textCn('rs-h4')
13
+ className: classNames(textCn('rs-h4'), styles.resultString)
13
14
  }, placeholder));
14
15
  };
15
16
 
@@ -1,4 +1,5 @@
1
1
  var styles = {
2
- "empty": "ktl-empty-module_empty_xh1i-"
2
+ "empty": "ktl-empty-module_empty_xh1i-",
3
+ "resultString": "ktl-empty-module_resultString_-8dzl"
3
4
  };
4
5
  export { styles as default };
@@ -1,6 +1,7 @@
1
- import React__default, { useMemo } from 'react';
1
+ import React__default from 'react';
2
2
  import { Result } from '../result/result.js';
3
3
  import { useTextStyles } from '@rescui/typography';
4
+ import classNames from 'classnames';
4
5
  import { isMacOs } from '../../is-macos.js';
5
6
  import styles from './list.module.pcss.js';
6
7
 
@@ -10,18 +11,19 @@ const ResultsList = ({
10
11
  toggleFullSearch
11
12
  }) => {
12
13
  const textCn = useTextStyles();
13
- const controlledSearchString = useMemo(() => searchString.length > 5 ? `${searchString.substring(0, 5)}...` : searchString, [searchString]);
14
14
  return React__default.createElement("div", {
15
15
  className: styles.results
16
16
  }, results.length ? React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
17
17
  className: styles.topBar
18
18
  }, React__default.createElement("div", {
19
- className: textCn('rs-text-3')
20
- }, "Showing results for \u00AB", controlledSearchString, "\u00BB"), React__default.createElement("button", {
19
+ className: classNames(textCn('rs-text-3'), styles.searchString)
20
+ }, "Showing results for \u00AB", searchString, "\u00BB"), React__default.createElement("button", {
21
21
  className: styles.advancedSearch,
22
22
  onClick: toggleFullSearch
23
23
  }, React__default.createElement("div", {
24
- className: textCn('rs-text-3')
24
+ className: classNames(textCn('rs-text-3', {
25
+ hardness: 'hard'
26
+ }))
25
27
  }, "Advanced search ", isMacOs() ? '⌘K' : 'Ctrl+K'))), results.map((searchResult, index) => React__default.createElement(Result, {
26
28
  key: index,
27
29
  hit: searchResult
@@ -1,6 +1,7 @@
1
1
  var styles = {
2
2
  "results": "ktl-list-module_results_LlxqY",
3
3
  "topBar": "ktl-list-module_topBar_OO0XT",
4
- "advancedSearch": "ktl-list-module_advancedSearch_XNy88"
4
+ "advancedSearch": "ktl-list-module_advancedSearch_XNy88",
5
+ "searchString": "ktl-list-module_searchString_rJnxa"
5
6
  };
6
7
  export { styles as default };
@@ -5,7 +5,6 @@ import { QuickSearch } from '../quick-search/quick-search.js';
5
5
  import { FullSearch } from '../full-search/full-search.js';
6
6
  import styles from './search-box.module.pcss.js';
7
7
  import { useSearch } from '../search-wrapper/use-search.js';
8
- import { isMacOs } from '../is-macos.js';
9
8
  import { ESC_CODE } from '../key-codes.js';
10
9
 
11
10
  const SearchBox = ({
@@ -41,11 +40,9 @@ const SearchBox = ({
41
40
  };
42
41
  }
43
42
  }, [escHandler]);
44
- const QuickSearchPlaceholder = isMobile ? 'Search' : `${isMacOs() ? '⌘K' : 'Ctrl+K'} for advanced search`;
45
43
  return React__default.createElement("div", {
46
44
  className: styles.searchBox
47
45
  }, React__default.createElement(Input, {
48
- placeholder: QuickSearchPlaceholder,
49
46
  iconType: 'left',
50
47
  value: searchInput,
51
48
  onChange: handleInput,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jetbrains/kotlin-web-site-ui",
3
3
  "description": "UI components for Kotlin web sites development",
4
- "version": "4.1.0-alpha.1",
4
+ "version": "4.1.0-alpha.4",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
7
7
  "files": [
@@ -29,11 +29,12 @@
29
29
  "@rescui/tooltip": "0.x",
30
30
  "@rescui/typography": "0.x",
31
31
  "@rescui/ui-contexts": "0.x",
32
+ "@rescui/focus-manager": "0.x",
32
33
  "algoliasearch": "4.x",
33
34
  "formik": "2.x",
34
35
  "react": ">= 16.8.6 < 18",
35
36
  "react-dom": ">= 16.8.6 < 18",
36
- "react-outside-click-handler": "^1.3.0",
37
+ "react-outside-click-handler": "1.x",
37
38
  "react-swipeable-views": "0.x",
38
39
  "sha.js": "2.x"
39
40
  },
@@ -47,8 +48,9 @@
47
48
  "@react-hook/resize-observer": "^1.2.5",
48
49
  "@rescui/button": "^0.2.1",
49
50
  "@rescui/checkbox": "^0.1.0",
50
- "@rescui/icons": "^0.2.0",
51
- "@rescui/input": "^0.1.2",
51
+ "@rescui/focus-manager": "^0.1.1",
52
+ "@rescui/icons": "^0.8.2",
53
+ "@rescui/input": "^0.4.6",
52
54
  "@rescui/switcher": "^0.2.2",
53
55
  "@rescui/tooltip": "^0.1.2",
54
56
  "@rescui/typography": "^0.7.3",