@jetbrains/kotlin-web-site-ui 4.1.0-alpha.3 → 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.
@@ -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';
4
+ import Switcher from '@rescui/switcher';
5
+ import SearchContext from '../../search-wrapper/search-context.js';
3
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 = [],
@@ -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
  };
@@ -275,7 +275,7 @@
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 {
@@ -293,6 +293,7 @@
293
293
 
294
294
  .ktl-result-module_resultTitle_DSpAT {
295
295
  margin-bottom: 6px;
296
+ overflow-wrap: break-word;
296
297
  }
297
298
 
298
299
  .ktl-result-module_text_fWBKG {
@@ -301,6 +302,12 @@
301
302
  -webkit-box-orient: vertical;
302
303
  overflow: hidden;
303
304
  }
305
+
306
+ @media (min-width: 768px) {
307
+ .ktl-result-module_result_EKhUw {
308
+ padding: 16px 32px;
309
+ }
310
+ }
304
311
  .ktl-list-module_results_LlxqY {
305
312
  box-sizing: border-box;
306
313
  max-height: 305px;
@@ -322,6 +329,7 @@
322
329
  border-radius: 24px;
323
330
  cursor: pointer;
324
331
  flex-shrink: 0;
332
+ transform: translateY(-6px);
325
333
  }
326
334
 
327
335
  .ktl-list-module_advancedSearch_XNy88:hover {
@@ -333,8 +341,12 @@
333
341
  box-shadow: rgba(107, 87, 255, 0.8) 0 0 0 4px;
334
342
  }
335
343
 
336
- .ktl-list-module_advancedSearchTitle_sHR3T {
337
- color: #ffffff;
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;
338
350
  }
339
351
 
340
352
  @media (min-width: 768px) {
@@ -344,16 +356,34 @@
344
356
 
345
357
  .ktl-list-module_topBar_OO0XT {
346
358
  display: flex;
347
- align-items: center;
359
+ align-items: flex-start;
348
360
  justify-content: space-between;
349
- padding: 34px 32px 14px 32px;
361
+ padding: 34px 32px 4px 32px;
350
362
  }
351
363
  }
352
364
  .ktl-empty-module_empty_xh1i- {
353
365
  box-sizing: border-box;
354
366
  border: 1px solid rgba(255, 255, 255, 0.2);
355
367
  background: #323236;
356
- 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
+ }
357
387
  }
358
388
  .ktl-loading-module_loading_CtOhW {
359
389
  box-sizing: border-box;
@@ -377,6 +407,12 @@
377
407
  transform: translateY(100%);
378
408
  }
379
409
 
410
+ @media (min-width: 880px) and (max-width: 1008px) {
411
+ .ktl-quick-search-module_wrapper_kkbQQ {
412
+ bottom: 12px;
413
+ }
414
+ }
415
+
380
416
  @media (min-width: 768px) {
381
417
  .ktl-quick-search-module_wrapper_kkbQQ {
382
418
  left: 0;
@@ -396,14 +432,10 @@
396
432
  }
397
433
 
398
434
  .ktl-full-search-module_closeSearch_5vYDG {
399
- padding: 0;
400
- margin: 0;
401
- border: 0;
402
- background: none;
403
- cursor: pointer;
404
435
  position: absolute;
405
436
  top: 40px;
406
437
  right: 40px;
438
+ display: flex;
407
439
  }
408
440
 
409
441
  .ktl-full-search-module_wrapper_9rxXb {
@@ -414,7 +446,7 @@
414
446
  .ktl-full-search-module_header_Wltw0 {
415
447
  width: 100%;
416
448
  padding-top: 120px;
417
- padding-bottom: 24px;
449
+ padding-bottom: 14px;
418
450
  position: sticky;
419
451
  top: 0;
420
452
  left: 0;
@@ -422,12 +454,6 @@
422
454
  z-index: 10;
423
455
  }
424
456
 
425
- .ktl-full-search-module_switcher_o1RgM {
426
- margin-top: 14px;
427
- display: flex;
428
- justify-content: flex-end;
429
- }
430
-
431
457
  .ktl-full-search-module_results_svcSE {
432
458
  margin-top: 14px;
433
459
  }
@@ -437,14 +463,12 @@
437
463
  display: block;
438
464
  }
439
465
  }
440
- .ktl-loading-module_loader_B2IQl {
441
- margin: 24px 0;
442
- }
443
- .ktl-loading-module_loader_B2IQl > svg {
466
+ .ktl-loading-module_loader_B2IQl > svg {
444
467
  fill: #6B57FF;
445
468
  }
446
469
  .ktl-empty-module_wrapper_cNB8Y {
447
470
  display: block;
471
+ margin-top: 26px;
448
472
  }
449
473
 
450
474
  .ktl-empty-module_title_p2FMj {
@@ -504,8 +528,13 @@
504
528
  .ktl-chapters-module_moreButton_98oqy {
505
529
  margin-top: 12px;
506
530
  }
531
+ .ktl-hit-list-module_switcher_bt6Xx {
532
+ display: flex;
533
+ justify-content: flex-end;
534
+ }
535
+
507
536
  .ktl-hit-list-module_hitList_1MP6m {
508
- margin: 24px 0;
537
+ margin: 50px 0;
509
538
  }
510
539
 
511
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,4 +1,4 @@
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
4
  import classNames from 'classnames';
@@ -11,18 +11,19 @@ const ResultsList = ({
11
11
  toggleFullSearch
12
12
  }) => {
13
13
  const textCn = useTextStyles();
14
- const controlledSearchString = useMemo(() => searchString.length > 5 ? `${searchString.substring(0, 5)}...` : searchString, [searchString]);
15
14
  return React__default.createElement("div", {
16
15
  className: styles.results
17
16
  }, results.length ? React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
18
17
  className: styles.topBar
19
18
  }, React__default.createElement("div", {
20
- className: textCn('rs-text-3')
21
- }, "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", {
22
21
  className: styles.advancedSearch,
23
22
  onClick: toggleFullSearch
24
23
  }, React__default.createElement("div", {
25
- className: classNames(textCn('rs-text-3'), styles.advancedSearchTitle)
24
+ className: classNames(textCn('rs-text-3', {
25
+ hardness: 'hard'
26
+ }))
26
27
  }, "Advanced search ", isMacOs() ? '⌘K' : 'Ctrl+K'))), results.map((searchResult, index) => React__default.createElement(Result, {
27
28
  key: index,
28
29
  hit: searchResult
@@ -2,6 +2,6 @@ var styles = {
2
2
  "results": "ktl-list-module_results_LlxqY",
3
3
  "topBar": "ktl-list-module_topBar_OO0XT",
4
4
  "advancedSearch": "ktl-list-module_advancedSearch_XNy88",
5
- "advancedSearchTitle": "ktl-list-module_advancedSearchTitle_sHR3T"
5
+ "searchString": "ktl-list-module_searchString_rJnxa"
6
6
  };
7
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.3",
4
+ "version": "4.1.0-alpha.4",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
7
7
  "files": [
@@ -49,8 +49,8 @@
49
49
  "@rescui/button": "^0.2.1",
50
50
  "@rescui/checkbox": "^0.1.0",
51
51
  "@rescui/focus-manager": "^0.1.1",
52
- "@rescui/icons": "^0.2.0",
53
- "@rescui/input": "^0.1.2",
52
+ "@rescui/icons": "^0.8.2",
53
+ "@rescui/input": "^0.4.6",
54
54
  "@rescui/switcher": "^0.2.2",
55
55
  "@rescui/tooltip": "^0.1.2",
56
56
  "@rescui/typography": "^0.7.3",