@meduza/ui-kit-2 0.1.7 → 0.1.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.
Files changed (147) hide show
  1. package/dist/Image/Image.types.d.ts +2 -2
  2. package/dist/MaterialNote/MaterialNote.stories.d.ts +2 -1
  3. package/dist/MaterialNote/MaterialNote.types.d.ts +2 -1
  4. package/dist/MaterialTitle/MaterialTitle.types.d.ts +2 -2
  5. package/dist/Popover/Popover.types.d.ts +2 -2
  6. package/dist/Tag/Tag.types.d.ts +2 -2
  7. package/dist/ui-kit-2.cjs.development.js +83 -79
  8. package/dist/ui-kit-2.cjs.development.js.map +1 -1
  9. package/dist/ui-kit-2.cjs.production.min.js +1 -1
  10. package/dist/ui-kit-2.cjs.production.min.js.map +1 -1
  11. package/dist/ui-kit-2.esm.js +83 -79
  12. package/dist/ui-kit-2.esm.js.map +1 -1
  13. package/dist/ui-kit.css +446 -446
  14. package/dist/utils/DangerousHtml.d.ts +3 -3
  15. package/dist/utils/makeClassName.d.ts +2 -1
  16. package/dist/utils/makeStyleContext.d.ts +2 -1
  17. package/package.json +12 -4
  18. package/src/BookmarkButton/BookmarkButton.stories.tsx +1 -1
  19. package/src/BookmarkButton/index.tsx +2 -4
  20. package/src/Button/Button.stories.tsx +2 -2
  21. package/src/Button/Button.test.tsx +3 -3
  22. package/src/Button/index.tsx +3 -3
  23. package/src/CardTitle/CardTitle.stories.tsx +1 -1
  24. package/src/CardTitle/CardTitle.test.tsx +1 -1
  25. package/src/CardTitle/index.tsx +1 -2
  26. package/src/ChapterBlock/ChapterBlock.stories.tsx +1 -1
  27. package/src/ChapterBlock/ChapterBlock.test.tsx +1 -1
  28. package/src/ChapterBlock/index.tsx +4 -8
  29. package/src/Cover/Cover.stories.tsx +1 -1
  30. package/src/Cover/Cover.test.tsx +1 -1
  31. package/src/Cover/index.tsx +5 -6
  32. package/src/DocumentItemsCount/DocumentItemsCount.stories.tsx +2 -2
  33. package/src/DocumentItemsCount/DocumentItemsCount.test.tsx +1 -1
  34. package/src/DocumentItemsCount/index.tsx +0 -1
  35. package/src/DotsOnImage/DotsOnImage.stories.tsx +1 -1
  36. package/src/DotsOnImage/DotsOnImage.test.tsx +1 -0
  37. package/src/DotsOnImage/index.tsx +1 -2
  38. package/src/Dropdown/index.tsx +2 -2
  39. package/src/EmbedBlock/EmbedBlock.stories.tsx +2 -2
  40. package/src/EmbedBlock/EmbedBlock.test.tsx +1 -1
  41. package/src/EmbedBlock/EmbedBlock.tsx +3 -8
  42. package/src/EmbedBlock/EmbedGif.tsx +0 -3
  43. package/src/EmbedBlock/IframeBlock.tsx +0 -1
  44. package/src/EmbedBlock/index.tsx +0 -1
  45. package/src/GroupedBlock/GroupedBlock.stories.tsx +2 -2
  46. package/src/GroupedBlock/GroupedBlock.test.tsx +1 -1
  47. package/src/GroupedBlock/GroupedBlock.types.ts +1 -1
  48. package/src/GroupedBlock/index.tsx +4 -6
  49. package/src/HalfBlock/HalfBlock.stories.tsx +1 -1
  50. package/src/HalfBlock/HalfBlock.test.tsx +1 -1
  51. package/src/HalfBlock/HalfBlock.types.ts +1 -1
  52. package/src/HalfBlock/index.tsx +3 -5
  53. package/src/Image/Image.stories.tsx +1 -1
  54. package/src/Image/Image.test.tsx +1 -1
  55. package/src/Image/Image.types.ts +2 -2
  56. package/src/Image/RenderPicture.tsx +1 -2
  57. package/src/Image/index.tsx +1 -6
  58. package/src/ImportantLead/ImportantLead.stories.tsx +1 -1
  59. package/src/ImportantLead/ImportantLead.test.tsx +1 -1
  60. package/src/ImportantLead/index.tsx +3 -5
  61. package/src/Lazy/Lazy.stories.tsx +3 -2
  62. package/src/Lazy/Lazy.test.tsx +1 -1
  63. package/src/Lazy/index.tsx +2 -4
  64. package/src/ListBlock/ListBlock.stories.tsx +3 -3
  65. package/src/ListBlock/ListBlock.test.tsx +1 -1
  66. package/src/ListBlock/index.tsx +3 -5
  67. package/src/MaterialNote/MaterialNote.stories.tsx +4 -3
  68. package/src/MaterialNote/MaterialNote.test.tsx +1 -1
  69. package/src/MaterialNote/MaterialNote.types.ts +2 -1
  70. package/src/MaterialNote/index.tsx +3 -3
  71. package/src/MaterialTitle/MaterialTitle.stories.tsx +1 -1
  72. package/src/MaterialTitle/MaterialTitle.test.tsx +1 -1
  73. package/src/MaterialTitle/MaterialTitle.types.ts +2 -1
  74. package/src/MediaCaption/MediaCaption.stories.tsx +1 -1
  75. package/src/MediaCaption/MediaCaption.test.tsx +1 -1
  76. package/src/MediaCaption/MediaCaption.types.ts +2 -2
  77. package/src/MediaCaption/index.tsx +2 -2
  78. package/src/Meta/Meta.stories.tsx +2 -2
  79. package/src/Meta/Meta.test.tsx +1 -1
  80. package/src/Meta/MetaContainer.tsx +2 -4
  81. package/src/Meta/index.tsx +2 -3
  82. package/src/MetaItem/MetaItem.stories.tsx +2 -2
  83. package/src/MetaItem/MetaItem.test.tsx +1 -1
  84. package/src/MetaItem/index.tsx +1 -3
  85. package/src/MetaItemLive/MetaItemLive.stories.tsx +2 -2
  86. package/src/MetaItemLive/MetaItemLive.test.tsx +1 -1
  87. package/src/MetaItemLive/index.tsx +1 -3
  88. package/src/Popover/Popover.stories.tsx +1 -1
  89. package/src/Popover/Popover.test.tsx +1 -1
  90. package/src/Popover/Popover.types.ts +2 -1
  91. package/src/Popover/index.tsx +1 -2
  92. package/src/QuoteBlock/QuoteBlock.stories.tsx +1 -1
  93. package/src/QuoteBlock/QuoteBlock.test.tsx +1 -1
  94. package/src/QuoteBlock/index.tsx +2 -3
  95. package/src/RawHtmlBlock/RawHtmlBlock.stories.tsx +2 -2
  96. package/src/RawHtmlBlock/RawHtmlBlock.test.tsx +1 -1
  97. package/src/RawHtmlBlock/index.tsx +0 -2
  98. package/src/RelatedBlock/RelatedBlock.stories.tsx +1 -1
  99. package/src/RelatedBlock/RelatedBlock.test.tsx +1 -1
  100. package/src/RelatedBlock/index.tsx +2 -3
  101. package/src/RenderBlocks/RenderBlocks.stories.tsx +1 -1
  102. package/src/RenderBlocks/RenderBlocks.test.tsx +1 -1
  103. package/src/RenderBlocks/index.tsx +0 -1
  104. package/src/RichTitle/RichTitle.stories.tsx +1 -1
  105. package/src/RichTitle/RichTitle.test.tsx +1 -1
  106. package/src/RichTitle/index.tsx +2 -3
  107. package/src/SimpleBlock/SimpleBlock.stories.tsx +2 -2
  108. package/src/SimpleBlock/SimpleBlock.test.tsx +1 -1
  109. package/src/SimpleBlock/index.tsx +8 -11
  110. package/src/SimpleTitle/SimpleTitle.stories.tsx +1 -1
  111. package/src/SimpleTitle/SimpleTitle.test.tsx +1 -1
  112. package/src/SimpleTitle/index.tsx +2 -2
  113. package/src/SourceBlock/SourceBlock.stories.tsx +6 -6
  114. package/src/SourceBlock/SourceBlock.test.tsx +1 -1
  115. package/src/SourceBlock/index.tsx +7 -6
  116. package/src/SourceBlock/mock.json +15 -0
  117. package/src/Spoiler/Spoiler.stories.tsx +1 -1
  118. package/src/Spoiler/Spoiler.test.tsx +1 -1
  119. package/src/Spoiler/index.tsx +4 -5
  120. package/src/SvgSymbol/SvgSymbol.stories.tsx +6 -6
  121. package/src/SvgSymbol/SvgSymbol.test.tsx +1 -1
  122. package/src/SvgSymbol/index.tsx +2 -2
  123. package/src/Switcher/Switcher.stories.tsx +4 -4
  124. package/src/Switcher/Switcher.test.tsx +1 -1
  125. package/src/Switcher/index.tsx +1 -2
  126. package/src/Table/Table.stories.tsx +1 -1
  127. package/src/Table/Table.test.tsx +1 -1
  128. package/src/Table/index.tsx +2 -2
  129. package/src/Tag/Tag.stories.tsx +1 -3
  130. package/src/Tag/Tag.test.tsx +4 -4
  131. package/src/Tag/Tag.types.ts +3 -1
  132. package/src/Tag/index.tsx +2 -2
  133. package/src/Timestamp/Timestamp.stories.tsx +1 -1
  134. package/src/Timestamp/Timestamp.test.tsx +1 -1
  135. package/src/Timestamp/index.tsx +0 -2
  136. package/src/Toolbar/Toolbar.stories.tsx +0 -2
  137. package/src/Toolbar/Toolbar.test.tsx +1 -1
  138. package/src/Toolbar/index.tsx +2 -3
  139. package/src/ToolbarButton/ToolbarButton.stories.tsx +2 -2
  140. package/src/ToolbarButton/ToolbarButton.test.tsx +1 -1
  141. package/src/ToolbarButton/index.tsx +2 -3
  142. package/src/_storybook/PreviewWrapper/index.tsx +1 -1
  143. package/src/utils/DangerousHtml.tsx +26 -18
  144. package/src/utils/generateGradient.ts +1 -1
  145. package/src/utils/makeClassName.ts +3 -1
  146. package/src/utils/makeStyleContext.ts +8 -4
  147. package/src/utils/toCamel.ts +1 -1
@@ -1,7 +1,6 @@
1
1
  import React from 'react'
2
2
  import { RelatedBlockProps } from './RelatedBlock.types'
3
-
4
- import makeClassName from '../utils/makeClassName'
3
+ import { makeClassName, ClassNames } from '../utils/makeClassName'
5
4
  import makeStyleContext from '../utils/makeStyleContext'
6
5
 
7
6
  import styles from './RelatedBlock.module.css'
@@ -13,7 +12,7 @@ export const RelatedBlock: React.FC<RelatedBlockProps> = ({
13
12
  },
14
13
  styleContext
15
14
  }) => {
16
- let classNames: (string[] | string | boolean)[][] = [
15
+ let classNames: ClassNames = [
17
16
  [styles.root, true],
18
17
  [styles[onlyOn], true]
19
18
  ]
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
-
3
2
  import { RenderBlocks } from './'
4
3
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
4
+
5
5
  import styles from './RenderBlocks.stories.module.css'
6
6
 
7
7
  export default {
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
-
4
3
  import { RenderBlocks } from './'
5
4
  import { RenderBlocksProps } from './RenderBlocks.types'
5
+
6
6
  import styles from './RenderBlocks.module.css'
7
7
 
8
8
  describe('Render Blocks', () => {
@@ -1,6 +1,5 @@
1
1
  import React from 'react'
2
2
  import { RenderBlocksProps } from './RenderBlocks.types'
3
-
4
3
  import { Tag } from '../Tag'
5
4
  import { SimpleTitle } from '../SimpleTitle'
6
5
  import { RichTitle } from '../RichTitle'
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
-
3
2
  import { RichTitle } from './'
4
3
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
4
+
5
5
  import styles from './RichTitle.stories.module.css'
6
6
 
7
7
  import mock from './mock.json'
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
-
4
3
  import { RichTitle } from './'
5
4
  import { RichTitleProps } from './RichTitle.types'
5
+
6
6
  import styles from './RichTitle.module.css'
7
7
 
8
8
  describe('Rich Title', () => {
@@ -1,7 +1,6 @@
1
1
  import React from 'react'
2
2
  import { RichTitleProps } from './RichTitle.types'
3
-
4
- import makeClassName from '../utils/makeClassName'
3
+ import { makeClassName, ClassNames } from '../utils/makeClassName'
5
4
  import makeStyleContext from '../utils/makeStyleContext'
6
5
 
7
6
  import styles from './RichTitle.module.css'
@@ -13,7 +12,7 @@ export const RichTitle: React.FC<RichTitleProps> = ({
13
12
  },
14
13
  styleContext
15
14
  }) => {
16
- let classNames: (string[] | string | boolean)[][] = [
15
+ let classNames: ClassNames = [
17
16
  [styles.root, true],
18
17
  [styles[onlyOn], true],
19
18
  [styles.featured, !!featured]
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
-
3
2
  import { SimpleBlock } from './'
4
3
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
4
+
5
5
  import styles from './SimpleBlock.stories.module.css'
6
6
 
7
7
  import mock from './mock.json'
@@ -18,7 +18,7 @@ const Example: React.FC = () => {
18
18
  return (
19
19
  <>
20
20
  <div className={styles.root}>
21
- {mock.blocks.map(item => (
21
+ {mock.blocks.map((item) => (
22
22
  <SimpleBlock
23
23
  block={item}
24
24
  key={item.id}
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
-
4
3
  import { SimpleBlock } from './'
5
4
  import { SimpleBlockProps } from './SimpleBlock.types'
5
+
6
6
  import styles from './SimpleBlock.module.css'
7
7
 
8
8
  describe('Simple Block', () => {
@@ -1,9 +1,7 @@
1
1
  import React from 'react'
2
2
  import { SimpleBlockProps } from './SimpleBlock.types'
3
-
4
- import makeClassName from '../utils/makeClassName'
3
+ import { makeClassName, ClassNames } from '../utils/makeClassName'
5
4
  import makeStyleContext from '../utils/makeStyleContext'
6
- import DangerousHTML from '../utils/DangerousHtml'
7
5
 
8
6
  import styles from './SimpleBlock.module.css'
9
7
 
@@ -11,9 +9,9 @@ export const SimpleBlock: React.FC<SimpleBlockProps> = ({
11
9
  block: { data, type, only_on: onlyOn },
12
10
  styleContext
13
11
  }) => {
14
- let tagName
12
+ let TagName
15
13
 
16
- let classNames: (string[] | string | boolean)[][] = [
14
+ let classNames: ClassNames = [
17
15
  [styles[type], !!type && !!styles[type]],
18
16
  [styles[onlyOn], true]
19
17
  ]
@@ -27,21 +25,20 @@ export const SimpleBlock: React.FC<SimpleBlockProps> = ({
27
25
  case 'lead':
28
26
  case 'note_caption':
29
27
  case 'note_credit': {
30
- tagName = 'p'
28
+ TagName = 'p'
31
29
  break
32
30
  }
33
31
  case 'lead_hr': {
34
- tagName = 'div'
32
+ TagName = 'div'
35
33
  break
36
34
  }
37
35
  default:
38
- tagName = type
36
+ TagName = type
39
37
  }
40
38
  return (
41
- <DangerousHTML
39
+ <TagName
42
40
  className={makeClassName(classNames)}
43
- html={data || ''}
44
- tagName={tagName}
41
+ dangerouslySetInnerHTML={{ __html: data }}
45
42
  />
46
43
  )
47
44
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
-
3
2
  import { SimpleTitle } from './'
4
3
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
4
+
5
5
  import styles from './SimpleTitle.stories.module.css'
6
6
 
7
7
  import mock from './mock.json'
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
-
4
3
  import { SimpleTitle } from './'
5
4
  import { SimpleTitleProps } from './SimpleTitle.types'
5
+
6
6
  import styles from './SimpleTitle.module.css'
7
7
 
8
8
  describe('Simple Title', () => {
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import { SimpleTitleProps } from './SimpleTitle.types'
3
- import makeClassName from '../utils/makeClassName'
3
+ import { makeClassName, ClassNames } from '../utils/makeClassName'
4
4
  import makeStyleContext from '../utils/makeStyleContext'
5
5
 
6
6
  import styles from './SimpleTitle.module.css'
@@ -12,7 +12,7 @@ export const SimpleTitle: React.FC<SimpleTitleProps> = ({
12
12
  },
13
13
  styleContext
14
14
  }) => {
15
- let classNames: (string[] | string | boolean)[][] = [
15
+ let classNames: ClassNames = [
16
16
  [styles.root, true],
17
17
  [styles[onlyOn], true]
18
18
  ]
@@ -1,9 +1,11 @@
1
1
  import React from 'react'
2
-
3
2
  import { SourceBlock } from './'
4
3
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
4
+
5
5
  import styles from './SourceBlock.stories.module.css'
6
6
 
7
+ import mock from './mock.json'
8
+
7
9
  export default {
8
10
  title: 'Main / SourceBlock',
9
11
  component: SourceBlock,
@@ -14,11 +16,9 @@ export default {
14
16
 
15
17
  const Example: React.FC = () => {
16
18
  return (
17
- <>
18
- <div className={styles.root}>
19
- <SourceBlock />
20
- </div>
21
- </>
19
+ <div className={styles.root}>
20
+ <SourceBlock block={mock} />
21
+ </div>
22
22
  )
23
23
  }
24
24
 
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
-
4
3
  import { SourceBlock } from './'
5
4
  import { SourceBlockProps } from './SourceBlock.types'
5
+
6
6
  import styles from './SourceBlock.module.css'
7
7
 
8
8
  describe('Source Block', () => {
@@ -1,17 +1,18 @@
1
1
  import React from 'react'
2
2
  import { SourceBlockProps } from './SourceBlock.types'
3
-
4
- import makeClassName from '../utils/makeClassName'
3
+ import { makeClassName, ClassNames } from '../utils/makeClassName'
5
4
  import makeStyleContext from '../utils/makeStyleContext'
6
- import DangerousHTML from '../utils/DangerousHtml'
7
5
 
8
6
  import styles from './SourceBlock.module.css'
9
7
 
10
8
  export const SourceBlock: React.FC<SourceBlockProps> = ({
11
- block: { only_on: onlyOn, quote, origin, url },
9
+ block: {
10
+ only_on: onlyOn,
11
+ data: { quote, origin, url }
12
+ },
12
13
  styleContext
13
14
  }) => {
14
- let classNames: (string[] | string | boolean)[][] = [
15
+ let classNames: ClassNames = [
15
16
  [styles.root, true],
16
17
  [styles[onlyOn], true]
17
18
  ]
@@ -33,7 +34,7 @@ export const SourceBlock: React.FC<SourceBlockProps> = ({
33
34
  rel="noopener noreferrer"
34
35
  >
35
36
  {quote.map((item, index) => (
36
- <DangerousHTML key={index} html={item.data} tagName="p" />
37
+ <p key={index} dangerouslySetInnerHTML={{ __html: item.data }} />
37
38
  ))}
38
39
  <footer>
39
40
  <cite className={styles.origin}>{origin}</cite>
@@ -0,0 +1,15 @@
1
+ {
2
+ "type": "source",
3
+ "data": {
4
+ "quote": [
5
+ {
6
+ "type": "p",
7
+ "data": "«В свое время, в 1990-е, потребительская корзина позиционировалась как временная, кризисная мера. Полагали, что мы через короткое время сможем отказаться от этого подхода и перейти к определению бедности через медианные доходы граждан. Но мы прожили с этой временной мерой почти четверть века», — отмечает глава НИИ труда Дмитрий Платыгин.",
8
+ "length": 339
9
+ }
10
+ ],
11
+ "origin": "Коммерсант",
12
+ "url": "https://www.kommersant.ru/doc/4502584?from=main_1"
13
+ },
14
+ "id": "4-072f3b4143d3377d533e198d3ea1ac263959a79a114e81104ecb4ab02b3996e5"
15
+ }
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
-
3
2
  import { Spoiler } from './'
4
3
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
4
+
5
5
  import styles from './Spoiler.stories.module.css'
6
6
 
7
7
  import mock from './mock.json'
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
-
4
3
  import { Spoiler } from './'
5
4
  import { SpoilerProps } from './Spoiler.types'
5
+
6
6
  import styles from './Spoiler.module.css'
7
7
 
8
8
  describe('Spoiler', () => {
@@ -1,10 +1,9 @@
1
1
  import React, { useState, useRef } from 'react'
2
2
  import { SpoilerProps } from './Spoiler.types'
3
-
4
- import makeClassName from '../utils/makeClassName'
3
+ import { makeClassName, ClassNames } from '../utils/makeClassName'
5
4
  import makeStyleContext from '../utils/makeStyleContext'
6
- import postMessage from '../utils/postMessage'
7
5
 
6
+ import postMessage from '../utils/postMessage'
8
7
  import { RenderBlocks } from '../RenderBlocks'
9
8
  import { Button } from '../Button'
10
9
  import { SvgSymbol } from '../SvgSymbol'
@@ -39,7 +38,7 @@ export const Spoiler: React.FC<SpoilerProps> = ({
39
38
  }
40
39
  }
41
40
 
42
- let classNames: (string[] | string | boolean)[][] = [
41
+ let classNames: ClassNames = [
43
42
  [styles.root, true],
44
43
  [styles[onlyOn], !!onlyOn],
45
44
  [styles[display], !!display && styles[display]],
@@ -57,7 +56,7 @@ export const Spoiler: React.FC<SpoilerProps> = ({
57
56
  <div ref={ref} className={makeClassName(classNames)} data-testid="spoiler">
58
57
  <div className={styles.header}>{title && <h3>{title}</h3>}</div>
59
58
  <div className={styles.body}>
60
- {blocks.map(item => (
59
+ {blocks.map((item) => (
61
60
  <RenderBlocks
62
61
  key={item.id}
63
62
  block={item}
@@ -1,9 +1,9 @@
1
1
  import React from 'react'
2
-
3
2
  import { SvgSymbol } from './'
4
3
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
4
+ import { Icons } from './SvgSymbol.types'
5
+
5
6
  import styles from './SvgSymbol.stories.module.css'
6
- import { Icons } from 'SvgSymbol/SvgSymbol.types'
7
7
 
8
8
  export default {
9
9
  title: 'Main / SvgSymbol',
@@ -46,7 +46,7 @@ const Example: React.FC = () => {
46
46
  <div className={styles.root}>
47
47
  <h2>Кнопки соц. сетей и реакций</h2>
48
48
  <div className={styles.row}>
49
- {social.map(icon => (
49
+ {social.map((icon) => (
50
50
  <span title={icon} key={`iconName-${icon}`} className={styles.icon}>
51
51
  <SvgSymbol icon={icon} size="medium" />
52
52
  </span>
@@ -55,7 +55,7 @@ const Example: React.FC = () => {
55
55
 
56
56
  <h2>Мета</h2>
57
57
  <div className={styles.row}>
58
- {meta.map(icon => (
58
+ {meta.map((icon) => (
59
59
  <span title={icon} key={`iconName-${icon}`} className={styles.icon}>
60
60
  <SvgSymbol icon={icon} size="medium" />
61
61
  </span>
@@ -64,7 +64,7 @@ const Example: React.FC = () => {
64
64
 
65
65
  <h2>Плеер</h2>
66
66
  <div className={styles.row}>
67
- {podcast.map(icon => (
67
+ {podcast.map((icon) => (
68
68
  <span title={icon} key={`iconName-${icon}`} className={styles.icon}>
69
69
  <SvgSymbol icon={icon} size="medium" />
70
70
  </span>
@@ -73,7 +73,7 @@ const Example: React.FC = () => {
73
73
 
74
74
  <h2>Другие</h2>
75
75
  <div className={styles.row}>
76
- {other.map(icon => (
76
+ {other.map((icon) => (
77
77
  <span title={icon} key={`iconName-${icon}`} className={styles.icon}>
78
78
  <SvgSymbol icon={icon} size="medium" />
79
79
  </span>
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render, RenderResult } from '@testing-library/react'
3
-
4
3
  import { SvgSymbol } from './'
5
4
  import { SvgSymbolProps } from './SvgSymbol.types'
5
+
6
6
  import styles from './SvgSymbol.module.css'
7
7
 
8
8
  describe('Svg Symbol', () => {
@@ -1,9 +1,9 @@
1
1
  import React from 'react'
2
2
  import { SvgSymbolProps } from './SvgSymbol.types'
3
- import makeClassName from '../utils/makeClassName'
3
+ import { makeClassName } from '../utils/makeClassName'
4
+ import { icons } from './icons'
4
5
 
5
6
  import styles from './SvgSymbol.module.css'
6
- import { icons } from './icons'
7
7
 
8
8
  export const SvgSymbol: React.FC<SvgSymbolProps> = ({
9
9
  icon,
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react'
2
-
3
2
  import { Switcher } from './'
4
3
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
4
+
5
5
  import styles from './Switcher.stories.module.css'
6
6
 
7
7
  export default {
@@ -24,7 +24,7 @@ const Example: React.FC = () => {
24
24
  <Switcher
25
25
  enabled={enabledOne}
26
26
  styleContext="isInPanel"
27
- onChange={e => setEnabledOne(e.target.checked)}
27
+ onChange={(e) => setEnabledOne(e.target.checked)}
28
28
  >
29
29
  <span>Показывать по порядку</span>
30
30
  </Switcher>
@@ -34,7 +34,7 @@ const Example: React.FC = () => {
34
34
  <Switcher
35
35
  enabled={enabledTwo}
36
36
  styleContext="isInMenu"
37
- onChange={e => setEnabledTwo(e.target.checked)}
37
+ onChange={(e) => setEnabledTwo(e.target.checked)}
38
38
  theme="dark"
39
39
  >
40
40
  <span>Показывать по порядку</span>
@@ -45,7 +45,7 @@ const Example: React.FC = () => {
45
45
  <Switcher
46
46
  enabled={enabledThree}
47
47
  styleContext="isInLive"
48
- onChange={e => setEnabledThree(e.target.checked)}
48
+ onChange={(e) => setEnabledThree(e.target.checked)}
49
49
  childrenPosition="right"
50
50
  >
51
51
  <span>Перевернуть трансляцию</span>
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render, fireEvent, RenderResult } from '@testing-library/react'
3
-
4
3
  import { Switcher } from './'
5
4
  import { SwitcherProps } from './Switcher.types'
5
+
6
6
  import styles from './Switcher.module.css'
7
7
 
8
8
  describe('Switcher', () => {
@@ -1,7 +1,6 @@
1
1
  import React from 'react'
2
2
  import { SwitcherProps } from './Switcher.types'
3
- import makeClassName from '../utils/makeClassName'
4
-
3
+ import { makeClassName } from '../utils/makeClassName'
5
4
  import styles from './Switcher.module.css'
6
5
 
7
6
  export const Switcher: React.FC<SwitcherProps> = ({
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
-
3
2
  import { Table } from './'
4
3
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
4
+
5
5
  import styles from './Table.stories.module.css'
6
6
 
7
7
  import mock from './mock.json'
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
-
4
3
  import { Table } from './'
5
4
  import { TableProps } from './Table.types'
5
+
6
6
  import styles from './Table.module.css'
7
7
 
8
8
  describe('Table', () => {
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { TableProps } from './Table.types'
3
3
  import makeStyleContext from '../utils/makeStyleContext'
4
- import makeClassName from '../utils/makeClassName'
4
+ import { makeClassName, ClassNames } from '../utils/makeClassName'
5
5
 
6
6
  import { MediaCaption } from '../MediaCaption'
7
7
 
@@ -28,7 +28,7 @@ export const Table: React.FC<TableProps> = ({
28
28
  '#f4f0f8': 'violet'
29
29
  }
30
30
 
31
- let classNames: (string[] | string | boolean)[][] = [
31
+ let classNames: ClassNames = [
32
32
  [styles.root, true],
33
33
  [styles[display], !!display && !!styles[display]]
34
34
  ]
@@ -1,8 +1,6 @@
1
1
  import React from 'react'
2
-
3
2
  import { Tag } from './'
4
3
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
5
-
6
4
  import { TagSizes, TagThemes } from './Tag.types'
7
5
 
8
6
  import styles from './Tag.stories.module.css'
@@ -29,7 +27,7 @@ const Example: React.FC = () => {
29
27
  return (
30
28
  <>
31
29
  <div className={styles.root}>
32
- {tags.map(tag => (
30
+ {tags.map((tag) => (
33
31
  <div key={`tagSize-${tag.theme}-${tag.size}`}>
34
32
  <Tag size={tag.size} theme={tag.theme} styleContext="rich">
35
33
  {tag.title}
@@ -1,14 +1,14 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
-
4
3
  import { Tag } from './'
5
- // import { TagProps } from './Tag.types'
4
+ import { TagProps } from './Tag.types'
5
+
6
6
  import styles from './Tag.module.css'
7
7
 
8
8
  describe('Tag', () => {
9
- // let props: TagProps
9
+ let props: TagProps
10
10
 
11
- const renderComponent = () => render(<Tag>Tag name</Tag>)
11
+ const renderComponent = () => render(<Tag {...props}>Tag name</Tag>)
12
12
 
13
13
  it('should have root style', () => {
14
14
  const { getByTestId } = renderComponent()
@@ -1,3 +1,5 @@
1
+ import React from 'react'
2
+
1
3
  export type TagSizes = 'small' | 'large'
2
4
 
3
5
  export type TagThemes = 'dark' | 'gold' | 'gray' | 'light' | 'inherit'
@@ -5,7 +7,7 @@ export type TagThemes = 'dark' | 'gold' | 'gray' | 'light' | 'inherit'
5
7
  export type TagStyleContexts = 'isInToolbar' | 'isInSpoiler' | 'isInDropdown'
6
8
 
7
9
  export interface TagProps {
8
- children: JSX.Element[] | JSX.Element
10
+ children: React.ReactNode | JSX.Element[] | JSX.Element
9
11
  styleContext?: string | string[]
10
12
  theme: TagThemes
11
13
  size: TagSizes
package/src/Tag/index.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { TagProps } from './Tag.types'
3
3
  import makeStyleContext from '../utils/makeStyleContext'
4
- import makeClassName from '../utils/makeClassName'
4
+ import { makeClassName, ClassNames } from '../utils/makeClassName'
5
5
 
6
6
  import styles from './Tag.module.css'
7
7
 
@@ -13,7 +13,7 @@ export const Tag: React.FC<TagProps> = ({
13
13
  correlation,
14
14
  onlyOn
15
15
  }) => {
16
- let classNames: (string[] | string | boolean)[][] = [
16
+ let classNames: ClassNames = [
17
17
  [styles.root, true],
18
18
  [styles[size], !!size && !!styles[size]],
19
19
  [styles[theme], !!theme && !!styles[theme]],
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
-
3
2
  import { Timestamp } from './'
4
3
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
4
+
5
5
  import styles from './Timestamp.stories.module.css'
6
6
 
7
7
  export default {
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
-
4
3
  import { Timestamp } from './'
5
4
  import { TimestampProps } from './Timestamp.types'
5
+
6
6
  import styles from './Timestamp.module.css'
7
7
 
8
8
  describe('Timestamp', () => {
@@ -1,9 +1,7 @@
1
1
  import React from 'react'
2
2
  import { TimestampProps } from './Timestamp.types'
3
-
4
3
  import dayjs from 'dayjs'
5
4
  import 'dayjs/locale/ru'
6
-
7
5
  import relativeTime from 'dayjs/plugin/relativeTime'
8
6
 
9
7
  import styles from './Timestamp.module.css'
@@ -1,11 +1,9 @@
1
1
  import React, { useState } from 'react'
2
-
3
2
  import { Toolbar } from './'
4
3
  import { ToolbarButton } from '../ToolbarButton'
5
4
  import { ToolbarButtonTypes } from '../ToolbarButton/ToolbarButton.types'
6
5
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
7
6
 
8
-
9
7
  import styles from './Toolbar.stories.module.css'
10
8
 
11
9
  export default {
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
-
4
3
  import { Toolbar } from './'
5
4
  import { ToolbarProps } from './Toolbar.types'
5
+
6
6
  import styles from './Toolbar.module.css'
7
7
 
8
8
  describe('Toolbar', () => {