@meduza/ui-kit-2 0.8.5 → 0.8.7

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 (140) hide show
  1. package/dist/AnnouncementInText/AnnouncementInText.types.d.ts +4 -0
  2. package/dist/AnnouncementInText/index.d.ts +3 -0
  3. package/dist/BookmarkButton/BookmarkButton.types.d.ts +6 -0
  4. package/dist/BookmarkButton/index.d.ts +3 -0
  5. package/dist/Button/Button.types.d.ts +16 -0
  6. package/dist/Button/ButtonLoader.d.ts +2 -0
  7. package/dist/Button/index.d.ts +2 -0
  8. package/dist/CardTitle/CardTitle.types.d.ts +11 -0
  9. package/dist/CardTitle/index.d.ts +3 -0
  10. package/dist/ChapterBlock/ChapterBlock.types.d.ts +8 -0
  11. package/dist/ChapterBlock/index.d.ts +3 -0
  12. package/dist/Cover/Cover.types.d.ts +24 -0
  13. package/dist/Cover/index.d.ts +3 -0
  14. package/dist/DocumentItemsCount/DocumentItemsCount.types.d.ts +6 -0
  15. package/dist/DocumentItemsCount/index.d.ts +3 -0
  16. package/dist/DonatesTeaser/DonatesTeaser.types.d.ts +4 -0
  17. package/dist/DonatesTeaser/index.d.ts +3 -0
  18. package/dist/DotsOnImage/DotsOnImage.types.d.ts +46 -0
  19. package/dist/DotsOnImage/index.d.ts +3 -0
  20. package/dist/Dropdown/Dropdown.types.d.ts +5 -0
  21. package/dist/Dropdown/index.d.ts +4 -0
  22. package/dist/EmbedBlock/EmbedBlock.d.ts +3 -0
  23. package/dist/EmbedBlock/EmbedBlock.types.d.ts +12 -0
  24. package/dist/EmbedBlock/EmbedGif.d.ts +3 -0
  25. package/dist/EmbedBlock/IframeBlock.d.ts +3 -0
  26. package/dist/EmbedBlock/index.d.ts +3 -0
  27. package/dist/Footnote/Footnote.types.d.ts +5 -0
  28. package/dist/Footnote/index.d.ts +3 -0
  29. package/dist/GroupedBlock/GroupedBlock.types.d.ts +4 -0
  30. package/dist/GroupedBlock/index.d.ts +3 -0
  31. package/dist/HalfBlock/HalfBlock.types.d.ts +4 -0
  32. package/dist/HalfBlock/index.d.ts +3 -0
  33. package/dist/Image/Image.types.d.ts +35 -0
  34. package/dist/Image/RenderPicture.d.ts +4 -0
  35. package/dist/ImportantLead/ImportantLead.types.d.ts +4 -0
  36. package/dist/ImportantLead/index.d.ts +3 -0
  37. package/dist/Lazy/Lazy.types.d.ts +4 -0
  38. package/dist/ListBlock/ListBlock.types.d.ts +9 -0
  39. package/dist/ListBlock/index.d.ts +3 -0
  40. package/dist/ListViewSwitcher/ListViewSwitcher.types.d.ts +6 -0
  41. package/dist/ListViewSwitcher/index.d.ts +3 -0
  42. package/dist/MaterialNote/MaterialNote.types.d.ts +13 -0
  43. package/dist/MaterialNote/index.d.ts +3 -0
  44. package/dist/MaterialTitle/MaterialTitle.types.d.ts +4 -0
  45. package/dist/MaterialTitle/index.d.ts +5 -0
  46. package/dist/MediaCaption/MediaCaption.types.d.ts +5 -0
  47. package/dist/MediaCaption/index.d.ts +3 -0
  48. package/dist/Meta/Meta.mock.d.ts +12 -0
  49. package/dist/Meta/Meta.types.d.ts +19 -0
  50. package/dist/Meta/MetaContainer.d.ts +3 -0
  51. package/dist/Meta/index.d.ts +3 -0
  52. package/dist/MetaItem/MetaItem.types.d.ts +7 -0
  53. package/dist/MetaItem/index.d.ts +3 -0
  54. package/dist/MetaItemLive/MetaItemLive.types.d.ts +3 -0
  55. package/dist/MetaItemLive/index.d.ts +3 -0
  56. package/dist/Popover/Popover.types.d.ts +5 -0
  57. package/dist/Popover/index.d.ts +3 -0
  58. package/dist/QuoteBlock/QuoteBlock.types.d.ts +6 -0
  59. package/dist/QuoteBlock/index.d.ts +3 -0
  60. package/dist/RawHtmlBlock/RawHtmlBlock.types.d.ts +17 -0
  61. package/dist/RawHtmlBlock/index.d.ts +3 -0
  62. package/dist/RelatedBlock/RelatedBlock.types.d.ts +17 -0
  63. package/dist/RelatedBlock/index.d.ts +3 -0
  64. package/dist/RelatedBook/RelatedBook.mock.d.ts +65 -0
  65. package/dist/RelatedBook/RelatedBook.types.d.ts +4 -0
  66. package/dist/RelatedBook/index.d.ts +3 -0
  67. package/dist/RelatedRichBlock/RelatedRichBlock.types.d.ts +4 -0
  68. package/dist/RelatedRichBlock/index.d.ts +3 -0
  69. package/dist/RenderBlocks/RenderBlocks.types.d.ts +11 -0
  70. package/dist/RenderBlocks/index.d.ts +3 -0
  71. package/dist/RichTitle/RichTitle.types.d.ts +12 -0
  72. package/dist/RichTitle/index.d.ts +3 -0
  73. package/dist/SensitiveBlock/SensitiveBlock.types.d.ts +15 -0
  74. package/dist/SensitiveBlock/index.d.ts +3 -0
  75. package/dist/ShopRelatedBlock/ShopRelatedBlock.types.d.ts +4 -0
  76. package/dist/ShopRelatedBlock/index.d.ts +3 -0
  77. package/dist/SimpleBlock/SimpleBlock.types.d.ts +5 -0
  78. package/dist/SimpleBlock/index.d.ts +3 -0
  79. package/dist/SimpleTitle/SimpleTitle.types.d.ts +9 -0
  80. package/dist/SimpleTitle/index.d.ts +3 -0
  81. package/dist/SourceBlock/SourceBlock.types.d.ts +15 -0
  82. package/dist/SourceBlock/index.d.ts +3 -0
  83. package/dist/Spoiler/Spoiler.types.d.ts +4 -0
  84. package/dist/Spoiler/index.d.ts +3 -0
  85. package/dist/SvgSymbol/SvgSymbol.types.d.ts +8 -0
  86. package/dist/SvgSymbol/icons.d.ts +167 -0
  87. package/dist/Switcher/Switcher.types.d.ts +11 -0
  88. package/dist/Table/Table.types.d.ts +25 -0
  89. package/dist/Table/index.d.ts +3 -0
  90. package/dist/Tag/Tag.types.d.ts +12 -0
  91. package/dist/Tag/index.d.ts +3 -0
  92. package/dist/Timestamp/Timestamp.types.d.ts +5 -0
  93. package/dist/Timestamp/index.d.ts +4 -0
  94. package/dist/Toolbar/Toolbar.d.ts +3 -0
  95. package/dist/Toolbar/Toolbar.types.d.ts +7 -0
  96. package/dist/Toolbar/ToolbarItem.d.ts +3 -0
  97. package/dist/Toolbar/index.d.ts +2 -0
  98. package/dist/ToolbarButton/ToolbarButton.types.d.ts +10 -0
  99. package/dist/ToolbarButton/index.d.ts +3 -0
  100. package/dist/Tooltip/Tooltip.d.ts +3 -0
  101. package/dist/Tooltip/Tooltip.types.d.ts +8 -0
  102. package/dist/Tooltip/TooltipFooter.d.ts +3 -0
  103. package/dist/Tooltip/index.d.ts +2 -0
  104. package/dist/VersesBlock/VersesBlock.types.d.ts +9 -0
  105. package/dist/VersesBlock/index.d.ts +3 -0
  106. package/dist/constants.d.ts +41 -0
  107. package/dist/index.d.ts +46 -0
  108. package/dist/types.d.ts +20 -0
  109. package/dist/ui-kit-2.cjs.development.js +2833 -0
  110. package/dist/ui-kit-2.cjs.development.js.map +1 -0
  111. package/dist/ui-kit-2.cjs.production.min.js +2 -0
  112. package/dist/ui-kit-2.cjs.production.min.js.map +1 -0
  113. package/dist/ui-kit-2.esm.js +2778 -0
  114. package/dist/ui-kit-2.esm.js.map +1 -0
  115. package/dist/ui-kit-game.css +7161 -0
  116. package/dist/ui-kit.css +7161 -0
  117. package/dist/utils/BlockContext.d.ts +8 -0
  118. package/dist/utils/DangerousHtml.d.ts +8 -0
  119. package/dist/utils/capitalizeFirstLetter.d.ts +1 -0
  120. package/dist/utils/converCase.d.ts +2 -0
  121. package/dist/utils/generateGradient.d.ts +2 -0
  122. package/dist/utils/getElementPositionRelativeToViewport.d.ts +2 -0
  123. package/dist/utils/makeStyleContext.d.ts +3 -0
  124. package/dist/utils/pluralize.d.ts +2 -0
  125. package/dist/utils/postMessage.d.ts +2 -0
  126. package/dist/utils/viewportSize.d.ts +6 -0
  127. package/package.json +1 -1
  128. package/src/ListViewSwitcher/ListViewSwitcher.module.css +109 -0
  129. package/src/ListViewSwitcher/ListViewSwitcher.stories.module.css +6 -0
  130. package/src/ListViewSwitcher/ListViewSwitcher.stories.tsx +38 -0
  131. package/src/ListViewSwitcher/ListViewSwitcher.test.tsx +35 -0
  132. package/src/ListViewSwitcher/ListViewSwitcher.types.ts +7 -0
  133. package/src/ListViewSwitcher/index.tsx +30 -0
  134. package/src/Switcher/Switcher.module.css +4 -21
  135. package/src/Switcher/Switcher.stories.module.css +3 -21
  136. package/src/Switcher/Switcher.stories.tsx +13 -31
  137. package/src/Switcher/Switcher.types.ts +2 -4
  138. package/src/Switcher/index.tsx +7 -7
  139. package/src/_storybook/PreviewWrapper/index.tsx +0 -1
  140. package/src/index.tsx +1 -0
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ declare const BlockContext: React.Context<{
3
+ lightBox: any;
4
+ }>;
5
+ export declare const BlockProvider: React.Provider<{
6
+ lightBox: any;
7
+ }>;
8
+ export default BlockContext;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ type DangerousHtmlProps = {
3
+ className?: string;
4
+ html: string;
5
+ tagName?: keyof JSX.IntrinsicElements;
6
+ };
7
+ declare const DangerousHTML: React.FC<DangerousHtmlProps>;
8
+ export default DangerousHTML;
@@ -0,0 +1 @@
1
+ export declare const capitalizeFirstLetter: (string: string) => string;
@@ -0,0 +1,2 @@
1
+ export declare const toCamel: (s: string) => string;
2
+ export declare const toCapitalize: (s: string) => string;
@@ -0,0 +1,2 @@
1
+ declare const generateGradient: (color: string, type: string) => string;
2
+ export default generateGradient;
@@ -0,0 +1,2 @@
1
+ declare const getElementPositionRelativeToViewport: (element: HTMLElement) => number;
2
+ export default getElementPositionRelativeToViewport;
@@ -0,0 +1,3 @@
1
+ import { ClassNames } from './makeClassName';
2
+ declare const makeStyleContext: (classNames: ClassNames, styleContext: string[] | string, styles: Record<string, string>) => ClassNames;
3
+ export default makeStyleContext;
@@ -0,0 +1,2 @@
1
+ declare const pluralize: (number: number, one: string, two: string, five: string) => string;
2
+ export default pluralize;
@@ -0,0 +1,2 @@
1
+ declare const postMessage: (category: string, element: string, action: string) => void;
2
+ export default postMessage;
@@ -0,0 +1,6 @@
1
+ type viewportSize = {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ declare const _default: () => viewportSize;
6
+ export default _default;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.8.5",
2
+ "version": "0.8.7",
3
3
  "license": "MIT",
4
4
  "description": "UIKit for Meduza",
5
5
  "repository": "https://github.com/meduza-corp/ui-kit-2.git",
@@ -0,0 +1,109 @@
1
+ .root {
2
+ position: relative;
3
+
4
+ display: flex;
5
+ align-items: center;
6
+ flex-flow: row nowrap;
7
+
8
+ cursor: pointer;
9
+ user-select: none;
10
+
11
+ border-radius: 40px;
12
+ background-color: #fff;
13
+ }
14
+
15
+ .input {
16
+ position: absolute;
17
+ top: 0;
18
+ left: 0;
19
+
20
+ visibility: hidden;
21
+ }
22
+
23
+ .knob {
24
+ position: relative;
25
+ z-index: $zIndex-2;
26
+
27
+ display: block;
28
+
29
+ transition: 0.25s ease-in-out;
30
+
31
+ border-radius: 15px;
32
+ background: #000;
33
+ }
34
+
35
+ .sm {
36
+ width: 35px;
37
+ height: 18px;
38
+ padding: 2px;
39
+ }
40
+
41
+ .md {
42
+ width: 52px;
43
+ height: 26px;
44
+ padding: 2px 3px;
45
+ }
46
+
47
+ .md .knob {
48
+ width: 22px;
49
+ height: 22px;
50
+ }
51
+
52
+ .grid,
53
+ .list {
54
+ position: absolute;
55
+
56
+ background-size: contain;
57
+ background-repeat: no-repeat;
58
+ }
59
+
60
+ .grid {
61
+ background-image: url("data:image/svg+xml,%3Csvg width='13' height='13' viewBox='0 0 13 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='.359' y='.5' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3Crect x='.359' y='7.078' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3Crect x='6.938' y='.5' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3Crect x='6.938' y='7.078' width='5.42' height='5.42' rx='1.044' fill='%23000'/%3E%3C/svg%3E");
62
+ }
63
+
64
+ .list {
65
+ background-image: url("data:image/svg+xml,%3Csvg width='13' height='13' viewBox='0 0 13 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='.359' y='.5' width='12' height='3' rx='1.044' fill='%23000'/%3E%3Crect x='.359' y='5' width='12' height='3' rx='1.044' fill='%23000'/%3E%3Crect x='.359' y='9.5' width='12' height='3' rx='1.044' fill='%23000'/%3E%3C/svg%3E");
66
+ }
67
+
68
+ .md .input:checked ~ .knob {
69
+ transform: translateX(24px);
70
+ }
71
+
72
+ .md .grid,
73
+ .md .list {
74
+ width: 13px;
75
+ height: 13px;
76
+ top: 7px;
77
+ }
78
+
79
+ .md .grid {
80
+ left: 10px;
81
+ }
82
+
83
+ .md .list {
84
+ right: 10px;
85
+ }
86
+
87
+ .sm .grid {
88
+ left: 5px;
89
+ }
90
+
91
+ .sm .list {
92
+ right: 5px;
93
+ }
94
+
95
+ .sm .knob {
96
+ width: 14px;
97
+ height: 14px;
98
+ }
99
+
100
+ .sm .grid,
101
+ .sm .list {
102
+ width: 8px;
103
+ height: 8px;
104
+ top: 5px;
105
+ }
106
+
107
+ .sm .input:checked ~ .knob {
108
+ transform: translateX(16px);
109
+ }
@@ -0,0 +1,6 @@
1
+ .root {
2
+ display: flex;
3
+ flex-flow: row wrap;
4
+
5
+ gap: 24px;
6
+ }
@@ -0,0 +1,38 @@
1
+ import React, { useState } from 'react'
2
+ import { ListViewSwitcher } from '.'
3
+ import { PreviewWrapper } from '../_storybook/PreviewWrapper'
4
+
5
+ import styles from './ListViewSwitcher.stories.module.css'
6
+
7
+ export default {
8
+ title: 'Main / ListViewSwitcher',
9
+ component: ListViewSwitcher,
10
+ parameters: {
11
+ themeWrapperSideBySide: true
12
+ }
13
+ }
14
+
15
+ const Example: React.FC = () => {
16
+ const [enabledOne, setEnabledOne] = useState(false)
17
+ const [enabledTwo, setEnabledTwo] = useState(false)
18
+ return (
19
+ <div className={styles.root}>
20
+ <ListViewSwitcher
21
+ enabled={enabledOne}
22
+ size="sm"
23
+ onChange={(e) => setEnabledOne(e.target.checked)}
24
+ />
25
+ <ListViewSwitcher
26
+ enabled={enabledTwo}
27
+ size="md"
28
+ onChange={(e) => setEnabledTwo(e.target.checked)}
29
+ />
30
+ </div>
31
+ )
32
+ }
33
+
34
+ export const Default: React.FC = () => (
35
+ <PreviewWrapper theme="dark">
36
+ <Example />
37
+ </PreviewWrapper>
38
+ )
@@ -0,0 +1,35 @@
1
+ import React from 'react'
2
+ import { render, fireEvent, RenderResult } from '@testing-library/react'
3
+ import { ListViewSwitcher } from '.'
4
+ import { ListViewSwitcherProps } from './ListViewSwitcher.types'
5
+
6
+ import styles from './Switcher.module.css'
7
+
8
+ describe('ListViewSwitcher', () => {
9
+ let props: ListViewSwitcherProps
10
+
11
+ const renderComponent = (): RenderResult =>
12
+ render(<ListViewSwitcher {...props} />)
13
+
14
+ it('should have root style', () => {
15
+ const { getByTestId } = renderComponent()
16
+
17
+ const switcher = getByTestId('listViewSwitcher')
18
+
19
+ expect(switcher).toHaveClass(styles.root)
20
+ })
21
+
22
+ it('should check on click', () => {
23
+ let checked = false
24
+ const onChange = (e): void => (checked = e.target.checked)
25
+ const renderComponent = (): RenderResult =>
26
+ render(<ListViewSwitcher onChange={onChange} {...props} />)
27
+ const { getByTestId } = renderComponent()
28
+
29
+ const switcher = getByTestId('listViewSwitcher')
30
+
31
+ fireEvent.click(switcher)
32
+
33
+ expect(checked).toBe(true)
34
+ })
35
+ })
@@ -0,0 +1,7 @@
1
+ import React from 'react'
2
+
3
+ export interface ListViewSwitcherProps {
4
+ enabled: boolean
5
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void
6
+ size?: 'sm' | 'md'
7
+ }
@@ -0,0 +1,30 @@
1
+ import React from 'react'
2
+ import { ListViewSwitcherProps } from './ListViewSwitcher.types'
3
+ import styles from './ListViewSwitcher.module.css'
4
+ import makeClassName from '../utils/makeClassName'
5
+
6
+ export const ListViewSwitcher: React.FC<ListViewSwitcherProps> = ({
7
+ enabled,
8
+ onChange,
9
+ size = 'md'
10
+ }) => (
11
+ <label
12
+ data-testid="listViewSwitcher"
13
+ className={makeClassName([
14
+ [styles.root, true],
15
+ [styles[size], true]
16
+ ])}
17
+ >
18
+ <input
19
+ className={styles.input}
20
+ type="checkbox"
21
+ checked={enabled}
22
+ onChange={onChange}
23
+ />
24
+
25
+ <span className={styles.knob} />
26
+
27
+ <span className={styles.grid} />
28
+ <span className={styles.list} />
29
+ </label>
30
+ )
@@ -13,6 +13,8 @@
13
13
  cursor: pointer;
14
14
 
15
15
  user-select: none;
16
+
17
+ gap: 6px;
16
18
  }
17
19
 
18
20
  .dark {
@@ -93,31 +95,13 @@
93
95
  left: 18px;
94
96
  }
95
97
 
96
- .children.left {
97
- margin-right: 6px;
98
- }
99
-
100
- .children.right {
101
- margin-left: 6px;
102
- }
103
-
104
- /* panel */
105
- .isInPanel .children {
106
-
107
- color: #999;
108
-
109
- font-size: 13px;
110
- letter-spacing: 0.5px;
111
- text-transform: uppercase;
112
- }
113
-
114
98
  /* menu */
115
99
  .isInMenu {
116
100
  font-weight: normal;
117
101
  }
118
102
 
119
- .isInMenu .children {
120
- margin-right: 8px;
103
+ .isInMenu {
104
+ gap: 8px;
121
105
  }
122
106
 
123
107
  .isInMenu .control {
@@ -143,7 +127,6 @@
143
127
 
144
128
  /* live */
145
129
  .isInLive .children {
146
-
147
130
  color: #7f7f7f;
148
131
 
149
132
  font-size: 13px;
@@ -1,26 +1,8 @@
1
1
  .root {
2
- display: block;
3
- }
4
-
5
- .preview {
6
- display: inline-block;
7
- width: 100%;
8
- padding: 16px;
9
-
10
- border: 1px #e8e8e8 solid;
11
- border-radius: 3px;
12
- }
13
-
14
- .row {
15
2
  display: flex;
16
- flex-flow: row wrap;
17
-
18
- padding: 15px;
19
- }
3
+ flex-flow: column wrap;
20
4
 
21
- .row[data-theme='dark'] {
22
- color: #fff;
5
+ font-size: 16px;
23
6
 
24
- background: #262626;
25
- border-radius: 10px;
7
+ gap: 24px;
26
8
  }
@@ -20,37 +20,19 @@ const Example: React.FC = () => {
20
20
  return (
21
21
  <>
22
22
  <div className={styles.root}>
23
- <div className={styles.preview}>
24
- <Switcher
25
- enabled={enabledOne}
26
- styleContext="isInPanel"
27
- onChange={(e) => setEnabledOne(e.target.checked)}
28
- >
29
- <span>Показывать по порядку</span>
30
- </Switcher>
31
- </div>
32
- <div className={styles.preview}>
33
- <div className={styles.row} data-theme="dark">
34
- <Switcher
35
- enabled={enabledTwo}
36
- styleContext="isInMenu"
37
- onChange={(e) => setEnabledTwo(e.target.checked)}
38
- theme="dark"
39
- >
40
- <span>Показывать по порядку</span>
41
- </Switcher>
42
- </div>
43
- </div>
44
- <div className={styles.preview}>
45
- <Switcher
46
- enabled={enabledThree}
47
- styleContext="isInLive"
48
- onChange={(e) => setEnabledThree(e.target.checked)}
49
- childrenPosition="right"
50
- >
51
- <span>Перевернуть трансляцию</span>
52
- </Switcher>
53
- </div>
23
+ <Switcher
24
+ enabled={enabledOne}
25
+ styleContext="isInPanel"
26
+ onChange={(e) => setEnabledOne(e.target.checked)}
27
+ childrenLeft={<span>Показывать по порядку</span>}
28
+ />
29
+
30
+ <Switcher
31
+ enabled={enabledThree}
32
+ styleContext="isInLive"
33
+ onChange={(e) => setEnabledThree(e.target.checked)}
34
+ childrenRight={<span>Перевернуть трансляцию</span>}
35
+ />
54
36
  </div>
55
37
  </>
56
38
  )
@@ -4,13 +4,11 @@ export type SwitcherStyleContexts = 'isInLive' | 'isInPanel' | 'isInMenu'
4
4
 
5
5
  export type SwitcherThemes = 'light' | 'dark'
6
6
 
7
- export type SwitcherChildrenPositions = 'left' | 'right'
8
-
9
7
  export interface SwitcherProps {
10
8
  enabled: boolean
11
9
  styleContext: SwitcherStyleContexts
12
10
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => void
13
11
  theme?: SwitcherThemes
14
- children: JSX.Element[] | JSX.Element
15
- childrenPosition?: SwitcherChildrenPositions
12
+ childrenLeft?: JSX.Element
13
+ childrenRight?: JSX.Element
16
14
  }
@@ -5,11 +5,11 @@ import styles from './Switcher.module.css'
5
5
 
6
6
  export const Switcher: React.FC<SwitcherProps> = ({
7
7
  enabled,
8
- children,
9
- childrenPosition = 'left',
10
8
  onChange,
11
9
  styleContext,
12
- theme = 'light'
10
+ theme = 'light',
11
+ childrenLeft,
12
+ childrenRight
13
13
  }) => (
14
14
  <label
15
15
  data-testid="switcher"
@@ -19,14 +19,14 @@ export const Switcher: React.FC<SwitcherProps> = ({
19
19
  [styles[styleContext], !!styles[styleContext]]
20
20
  ])}
21
21
  >
22
- {children && childrenPosition === 'left' && (
22
+ {childrenLeft && (
23
23
  <div
24
24
  className={makeClassName([
25
25
  [styles.children, true],
26
26
  [styles.left, true]
27
27
  ])}
28
28
  >
29
- {children}
29
+ {childrenLeft}
30
30
  </div>
31
31
  )}
32
32
  <input
@@ -38,14 +38,14 @@ export const Switcher: React.FC<SwitcherProps> = ({
38
38
  <span className={styles.control}>
39
39
  <span className={styles.knob} />
40
40
  </span>
41
- {children && childrenPosition === 'right' && (
41
+ {childrenRight && (
42
42
  <div
43
43
  className={makeClassName([
44
44
  [styles.children, true],
45
45
  [styles.right, true]
46
46
  ])}
47
47
  >
48
- {children}
48
+ {childrenRight}
49
49
  </div>
50
50
  )}
51
51
  </label>
@@ -17,7 +17,6 @@ export const PreviewWrapper: React.FC<PreviewWrapperProps> = ({
17
17
  [styles[theme], !!theme]
18
18
  ])}
19
19
  >
20
- <h2>{theme === 'dark' ? 'Dark theme' : 'Light theme'}</h2>
21
20
  {children}
22
21
  </div>
23
22
  )
package/src/index.tsx CHANGED
@@ -26,6 +26,7 @@ export * from './HalfBlock'
26
26
  export * from './RawHtmlBlock'
27
27
  export * from './ImportantLead'
28
28
  export * from './ListBlock'
29
+ export * from './ListViewSwitcher'
29
30
  export * from './RelatedBlock'
30
31
  export * from './RichTitle'
31
32
  export * from './SimpleBlock'