@meduza/ui-kit-2 0.1.18 → 0.1.20

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 (86) 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 +97 -7
  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 +97 -8
  20. package/dist/ui-kit-2.esm.js.map +1 -1
  21. package/dist/ui-kit.css +1240 -1042
  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/Button/Button.module.css +2 -0
  28. package/src/CardTitle/CardTitle.test.tsx +4 -3
  29. package/src/ChapterBlock/ChapterBlock.test.tsx +4 -3
  30. package/src/Cover/Cover.test.tsx +3 -3
  31. package/src/Cover/Cover.types.ts +22 -1
  32. package/src/Cover/index.tsx +1 -1
  33. package/src/DocumentItemsCount/DocumentItemsCount.test.tsx +4 -3
  34. package/src/DotsOnImage/DotsOnImage.test.tsx +4 -2
  35. package/src/DotsOnImage/DotsOnImage.types.ts +1 -1
  36. package/src/EmbedBlock/EmbedBlock.test.tsx +16 -3
  37. package/src/EmbedBlock/index.tsx +1 -1
  38. package/src/GroupedBlock/GroupedBlock.test.tsx +5 -3
  39. package/src/HalfBlock/HalfBlock.test.tsx +4 -3
  40. package/src/Image/Image.test.tsx +3 -0
  41. package/src/Image/Image.types.ts +1 -6
  42. package/src/Image/RenderPicture.tsx +1 -1
  43. package/src/ImportantLead/ImportantLead.test.tsx +10 -8
  44. package/src/ImportantLead/mock.json +6 -0
  45. package/src/Lazy/Lazy.test.tsx +3 -0
  46. package/src/ListBlock/ListBlock.stories.tsx +2 -1
  47. package/src/ListBlock/ListBlock.test.tsx +8 -4
  48. package/src/ListBlock/ListBlock.types.ts +6 -1
  49. package/src/ListBlock/index.tsx +1 -1
  50. package/src/ListBlock/mock.json +1 -1
  51. package/src/MaterialNote/MaterialNote.test.tsx +4 -3
  52. package/src/Meta/Meta.module.css +1 -1
  53. package/src/QuoteBlock/QuoteBlock.test.tsx +4 -3
  54. package/src/RawHtmlBlock/RawHtmlBlock.test.tsx +18 -9
  55. package/src/RawHtmlBlock/mock.json +6 -0
  56. package/src/RelatedBlock/RelatedBlock.test.tsx +4 -3
  57. package/src/RelatedBlock/RelatedBlock.types.ts +14 -1
  58. package/src/RelatedRichBlock/RelatedRichBlock.module.css +165 -0
  59. package/src/RelatedRichBlock/RelatedRichBlock.stories.module.css +12 -0
  60. package/src/RelatedRichBlock/RelatedRichBlock.stories.tsx +55 -0
  61. package/src/RelatedRichBlock/RelatedRichBlock.test.tsx +20 -0
  62. package/src/RelatedRichBlock/RelatedRichBlock.types.ts +4 -0
  63. package/src/RelatedRichBlock/index.tsx +105 -0
  64. package/src/RelatedRichBlock/mock.json +354 -0
  65. package/src/RenderBlocks/RenderBlocks.stories.tsx +4 -1
  66. package/src/RenderBlocks/RenderBlocks.test.tsx +15 -9
  67. package/src/RenderBlocks/mock.json +10 -0
  68. package/src/RichTitle/RichTitle.module.css +37 -7
  69. package/src/RichTitle/RichTitle.test.tsx +4 -3
  70. package/src/RichTitle/RichTitle.types.ts +8 -1
  71. package/src/SimpleBlock/SimpleBlock.test.tsx +16 -9
  72. package/src/SimpleBlock/mock.json +6 -0
  73. package/src/SimpleTitle/SimpleTitle.test.tsx +4 -3
  74. package/src/SimpleTitle/SimpleTitle.types.ts +6 -1
  75. package/src/SourceBlock/SourceBlock.test.tsx +4 -3
  76. package/src/SourceBlock/SourceBlock.types.ts +13 -1
  77. package/src/Spoiler/Spoiler.test.tsx +4 -3
  78. package/src/Table/Table.test.tsx +3 -3
  79. package/src/Timestamp/Timestamp.test.tsx +4 -3
  80. package/src/ToolbarButton/ToolbarButton.test.tsx +8 -3
  81. package/src/_storybook/PreviewWrapper/PreviewWrapper.module.css +3 -1
  82. package/src/index.tsx +1 -0
  83. package/src/types.ts +6 -0
  84. package/src/utils/{toCamel.ts → converCase.ts} +3 -0
  85. package/src/utils/generateGradient.ts +21 -15
  86. package/dist/utils/toCamel.d.ts +0 -1
@@ -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;