@meduza/ui-kit-2 0.1.19 → 0.1.21

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 (87) hide show
  1. package/dist/Cover/Cover.types.d.ts +21 -1
  2. package/dist/DotsOnImage/DotsOnImage.types.d.ts +1 -1
  3. package/dist/Image/Image.types.d.ts +1 -6
  4. package/dist/ListBlock/ListBlock.stories.d.ts +2 -1
  5. package/dist/ListBlock/ListBlock.types.d.ts +7 -1
  6. package/dist/RelatedBlock/RelatedBlock.types.d.ts +14 -1
  7. package/dist/RelatedRichBlock/RelatedRichBlock.stories.d.ts +10 -0
  8. package/dist/RelatedRichBlock/RelatedRichBlock.types.d.ts +4 -0
  9. package/dist/RelatedRichBlock/index.d.ts +3 -0
  10. package/dist/RichTitle/RichTitle.types.d.ts +8 -1
  11. package/dist/SimpleTitle/SimpleTitle.types.d.ts +6 -1
  12. package/dist/SourceBlock/SourceBlock.types.d.ts +12 -1
  13. package/dist/index.d.ts +1 -0
  14. package/dist/types.d.ts +6 -0
  15. package/dist/ui-kit-2.cjs.development.js +147 -47
  16. package/dist/ui-kit-2.cjs.development.js.map +1 -1
  17. package/dist/ui-kit-2.cjs.production.min.js +1 -1
  18. package/dist/ui-kit-2.cjs.production.min.js.map +1 -1
  19. package/dist/ui-kit-2.esm.js +147 -48
  20. package/dist/ui-kit-2.esm.js.map +1 -1
  21. package/dist/ui-kit.css +1157 -961
  22. package/dist/utils/converCase.d.ts +2 -0
  23. package/dist/utils/generateGradient.d.ts +1 -1
  24. package/package.json +4 -1
  25. package/src/.DS_Store +0 -0
  26. package/src/BookmarkButton/BookmarkButton.test.tsx +17 -4
  27. package/src/CardTitle/CardTitle.test.tsx +4 -3
  28. package/src/ChapterBlock/ChapterBlock.test.tsx +4 -3
  29. package/src/Cover/Cover.test.tsx +3 -3
  30. package/src/Cover/Cover.types.ts +22 -1
  31. package/src/Cover/index.tsx +1 -1
  32. package/src/DocumentItemsCount/DocumentItemsCount.test.tsx +4 -3
  33. package/src/DotsOnImage/DotsOnImage.test.tsx +4 -2
  34. package/src/DotsOnImage/DotsOnImage.types.ts +1 -1
  35. package/src/EmbedBlock/EmbedBlock.test.tsx +16 -3
  36. package/src/EmbedBlock/index.tsx +1 -1
  37. package/src/GroupedBlock/GroupedBlock.test.tsx +5 -3
  38. package/src/HalfBlock/HalfBlock.test.tsx +4 -3
  39. package/src/Image/Image.test.tsx +3 -0
  40. package/src/Image/Image.types.ts +1 -6
  41. package/src/Image/RenderPicture.tsx +1 -1
  42. package/src/ImportantLead/ImportantLead.test.tsx +10 -8
  43. package/src/ImportantLead/mock.json +6 -0
  44. package/src/Lazy/Lazy.test.tsx +3 -0
  45. package/src/ListBlock/ListBlock.stories.tsx +2 -1
  46. package/src/ListBlock/ListBlock.test.tsx +8 -4
  47. package/src/ListBlock/ListBlock.types.ts +6 -1
  48. package/src/ListBlock/index.tsx +1 -1
  49. package/src/ListBlock/mock.json +1 -1
  50. package/src/MaterialNote/MaterialNote.test.tsx +4 -3
  51. package/src/Meta/Meta.module.css +1 -1
  52. package/src/QuoteBlock/QuoteBlock.test.tsx +4 -3
  53. package/src/RawHtmlBlock/RawHtmlBlock.test.tsx +18 -9
  54. package/src/RawHtmlBlock/mock.json +6 -0
  55. package/src/RelatedBlock/RelatedBlock.test.tsx +4 -3
  56. package/src/RelatedBlock/RelatedBlock.types.ts +14 -1
  57. package/src/RelatedRichBlock/RelatedRichBlock.module.css +165 -0
  58. package/src/RelatedRichBlock/RelatedRichBlock.stories.module.css +12 -0
  59. package/src/RelatedRichBlock/RelatedRichBlock.stories.tsx +55 -0
  60. package/src/RelatedRichBlock/RelatedRichBlock.test.tsx +20 -0
  61. package/src/RelatedRichBlock/RelatedRichBlock.types.ts +4 -0
  62. package/src/RelatedRichBlock/index.tsx +105 -0
  63. package/src/RelatedRichBlock/mock.json +354 -0
  64. package/src/RenderBlocks/RenderBlocks.stories.module.css +3 -0
  65. package/src/RenderBlocks/RenderBlocks.stories.tsx +4 -1
  66. package/src/RenderBlocks/RenderBlocks.test.tsx +15 -9
  67. package/src/RenderBlocks/index.tsx +5 -0
  68. package/src/RenderBlocks/mock.json +83 -0
  69. package/src/RichTitle/RichTitle.module.css +37 -7
  70. package/src/RichTitle/RichTitle.test.tsx +4 -3
  71. package/src/RichTitle/RichTitle.types.ts +8 -1
  72. package/src/SimpleBlock/SimpleBlock.test.tsx +16 -9
  73. package/src/SimpleBlock/mock.json +6 -0
  74. package/src/SimpleTitle/SimpleTitle.test.tsx +4 -3
  75. package/src/SimpleTitle/SimpleTitle.types.ts +6 -1
  76. package/src/SourceBlock/SourceBlock.test.tsx +4 -3
  77. package/src/SourceBlock/SourceBlock.types.ts +13 -1
  78. package/src/Spoiler/Spoiler.test.tsx +4 -3
  79. package/src/Table/Table.test.tsx +3 -3
  80. package/src/Timestamp/Timestamp.test.tsx +4 -3
  81. package/src/ToolbarButton/ToolbarButton.test.tsx +8 -3
  82. package/src/_storybook/PreviewWrapper/PreviewWrapper.module.css +3 -1
  83. package/src/index.tsx +1 -0
  84. package/src/types.ts +6 -0
  85. package/src/utils/{toCamel.ts → converCase.ts} +3 -0
  86. package/src/utils/generateGradient.ts +21 -15
  87. package/dist/utils/toCamel.d.ts +0 -1
@@ -1,5 +1,11 @@
1
1
  {
2
2
  "blocks": [
3
+ {
4
+ "type": "p",
5
+ "data": "Hello Component",
6
+ "length": 0,
7
+ "id": "1-a3d239200edd759999e5493fd4a6311710f16774927df9907ffbabf57a915a901f"
8
+ },
3
9
  {
4
10
  "type": "lead",
5
11
  "data": "В России качество медицинской помощи даже в одной больнице может значительно отличаться. Это прямое следствие того, что обучение врачей и проверку их знаний и навыков нельзя назвать хорошими. При этом у самих медицинских специалистов даже нет возможности понять, что с ними что-то не так: им дают дипломы, им разрешают работать. И если студент, ординатор или состоявшийся врач захотят получить хорошее образование (и будут понимать, что это значит), у них, скорее всего, возникнут проблемы, потому что в государственном секторе таких возможностей может не быть вообще либо они окажутся труднодоступны. В последнее время все чаще публично выступают люди, которые недовольны таким положением вещей. Они не только говорят о недостатках образования, которые видят, но и пытаются хотя бы локально что-то изменить. «Медуза» решила рассказать о некоторых студентах, врачах и благотворителях, которые меняют то, что им не нравится в вузах, ординатуре и в целом образовании врачей (и заодно объясняем, что не устраивает этих людей).",
@@ -5,10 +5,11 @@ import { SimpleTitleProps } from './SimpleTitle.types'
5
5
 
6
6
  import styles from './SimpleTitle.module.css'
7
7
 
8
- describe('Simple Title', () => {
9
- let props: SimpleTitleProps
8
+ import mock from './mock.json'
10
9
 
11
- const renderComponent = () => render(<SimpleTitle {...props} />)
10
+ describe('Simple Title', () => {
11
+ const renderComponent = () =>
12
+ render(<SimpleTitle block={mock as SimpleTitleProps['block']} />)
12
13
 
13
14
  it('should have root style', () => {
14
15
  const { getByTestId } = renderComponent()
@@ -1,4 +1,9 @@
1
1
  export interface SimpleTitleProps {
2
- block: any
2
+ block: {
3
+ data: {
4
+ first: string
5
+ }
6
+ only_on?: string
7
+ }
3
8
  styleContext?: string[] | string
4
9
  }
@@ -5,10 +5,11 @@ import { SourceBlockProps } from './SourceBlock.types'
5
5
 
6
6
  import styles from './SourceBlock.module.css'
7
7
 
8
- describe('Source Block', () => {
9
- let props: SourceBlockProps
8
+ import mock from './mock.json'
10
9
 
11
- const renderComponent = () => render(<SourceBlock {...props} />)
10
+ describe('Source Block', () => {
11
+ const renderComponent = () =>
12
+ render(<SourceBlock block={mock as SourceBlockProps['block']} />)
12
13
 
13
14
  it('should have root style', () => {
14
15
  const { getByTestId } = renderComponent()
@@ -1,4 +1,16 @@
1
1
  export interface SourceBlockProps {
2
- block: any
2
+ block: {
3
+ only_on?: string
4
+ data: {
5
+ quote: {
6
+ type: string
7
+ data: string
8
+ length: number
9
+ }[]
10
+
11
+ origin: string
12
+ url: string
13
+ }
14
+ }
3
15
  styleContext?: string[] | string
4
16
  }
@@ -5,10 +5,11 @@ import { SpoilerProps } from './Spoiler.types'
5
5
 
6
6
  import styles from './Spoiler.module.css'
7
7
 
8
- describe('Spoiler', () => {
9
- let props: SpoilerProps
8
+ import mock from './mock.json'
10
9
 
11
- const renderComponent = () => render(<Spoiler {...props} />)
10
+ describe('Spoiler', () => {
11
+ const renderComponent = () =>
12
+ render(<Spoiler block={mock as SpoilerProps['block']} />)
12
13
 
13
14
  it('should have root style', () => {
14
15
  const { getByTestId } = renderComponent()
@@ -4,11 +4,11 @@ import { Table } from './'
4
4
  import { TableProps } from './Table.types'
5
5
 
6
6
  import styles from './Table.module.css'
7
+ import mock from './mock.json'
7
8
 
8
9
  describe('Table', () => {
9
- let props: TableProps
10
-
11
- const renderComponent = () => render(<Table {...props} />)
10
+ const renderComponent = () =>
11
+ render(<Table block={mock as TableProps['block']} />)
12
12
 
13
13
  it('should have root style', () => {
14
14
  const { getByTestId } = renderComponent()
@@ -1,14 +1,15 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
3
  import { Timestamp } from './'
4
- import { TimestampProps } from './Timestamp.types'
4
+ // import { TimestampProps } from './Timestamp.types'
5
5
 
6
6
  import styles from './Timestamp.module.css'
7
7
 
8
8
  describe('Timestamp', () => {
9
- let props: TimestampProps
9
+ // let props: TimestampProps
10
10
 
11
- const renderComponent = () => render(<Timestamp {...props} />)
11
+ const renderComponent = () =>
12
+ render(<Timestamp publishedAt={1526024185} type="fromNow" />)
12
13
 
13
14
  it('should have root style', () => {
14
15
  const { getByTestId } = renderComponent()
@@ -1,14 +1,19 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
3
  import { ToolbarButton } from './'
4
- import { ToolbarButtonProps } from './ToolbarButton.types'
4
+ // import { ToolbarButtonProps } from './ToolbarButton.types'
5
5
 
6
6
  import styles from './ToolbarButton.module.css'
7
7
 
8
8
  describe('Toolbar Button', () => {
9
- let props: ToolbarButtonProps
9
+ // let props: ToolbarButtonProps
10
10
 
11
- const renderComponent = () => render(<ToolbarButton {...props} />)
11
+ const renderComponent = () =>
12
+ render(
13
+ <ToolbarButton type="fb" onClick={(): void => alert('Hello Button')}>
14
+ 42
15
+ </ToolbarButton>
16
+ )
12
17
 
13
18
  it('should have root style', () => {
14
19
  const { getByTestId } = renderComponent()
@@ -78,7 +78,9 @@
78
78
  }
79
79
 
80
80
  .wrapper {
81
- padding: 40px;
81
+ @media (min-width: 1000px) {
82
+ padding: 40px;
83
+ }
82
84
  }
83
85
 
84
86
  .wrapper.light {
package/src/index.tsx CHANGED
@@ -37,4 +37,5 @@ export * from './MetaItemLive'
37
37
  export * from './DocumentItemsCount'
38
38
  export * from './ToolbarButton'
39
39
  export * from './Footnote'
40
+ export * from './RelatedRichBlock'
40
41
  // /* PLOP_INJECT_LINK */ //
package/src/types.ts ADDED
@@ -0,0 +1,6 @@
1
+ export interface OptimizedImageItem {
2
+ '1x': string
3
+ '2x': string
4
+ '1x_webp': string
5
+ '2x_webp': string
6
+ }
@@ -1,2 +1,5 @@
1
1
  export const toCamel = (s: string): string =>
2
2
  s.replace(/([_][a-z])/gi, (str) => str.toUpperCase().replace('_', ''))
3
+
4
+ export const toCapitalize = (s: string): string =>
5
+ s[0].toUpperCase() + s.slice(1)
@@ -1,19 +1,25 @@
1
- const generateGradient = (color: string): string => {
2
- const gradientSteps = [
3
- [0, 7],
4
- [0.08, 12],
5
- [0.16, 17],
6
- [0.22, 21],
7
- [0.32, 26],
8
- [0.42, 32],
9
- [0.52, 38],
10
- [0.62, 47],
11
- [0.72, 57],
12
- [0.82, 65],
13
- [1, 82]
14
- ]
1
+ const generateGradient = (color: string, type: string): string => {
2
+ const steps = {
3
+ mediaBlockBottom: [
4
+ [0, 7],
5
+ [0.08, 12],
6
+ [0.16, 17],
7
+ [0.22, 21],
8
+ [0.32, 26],
9
+ [0.42, 32],
10
+ [0.52, 38],
11
+ [0.62, 47],
12
+ [0.72, 57],
13
+ [0.82, 65],
14
+ [1, 82]
15
+ ],
16
+ mediaBlockTop: [
17
+ [0.5, 0],
18
+ [0, 97]
19
+ ]
20
+ }
15
21
 
16
- const gradient = gradientSteps.map((i) => `rgba(${color}, ${i[0]}) ${i[1]}%`)
22
+ const gradient = steps[type].map((i) => `rgba(${color}, ${i[0]}) ${i[1]}%`)
17
23
 
18
24
  return `linear-gradient(-180deg, ${gradient})`
19
25
  }
@@ -1 +0,0 @@
1
- export declare const toCamel: (s: string) => string;