@gravity-ui/blog-constructor 5.0.2 → 5.2.0

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 (124) hide show
  1. package/build/cjs/blocks/Author/Author.d.ts +1 -1
  2. package/build/cjs/blocks/Author/Author.js +2 -2
  3. package/build/cjs/blocks/Banner/Banner.d.ts +1 -1
  4. package/build/cjs/blocks/Banner/Banner.js +7 -5
  5. package/build/cjs/blocks/CTA/CTA.d.ts +1 -1
  6. package/build/cjs/blocks/ColoredText/ColoredText.d.ts +1 -1
  7. package/build/cjs/blocks/ColoredText/ColoredText.js +5 -4
  8. package/build/cjs/blocks/Feed/Feed.d.ts +1 -1
  9. package/build/cjs/blocks/Header/Header.d.ts +1 -1
  10. package/build/cjs/blocks/Layout/Layout.d.ts +2 -2
  11. package/build/cjs/blocks/Media/Media.d.ts +1 -1
  12. package/build/cjs/blocks/Meta/Meta.d.ts +1 -1
  13. package/build/cjs/blocks/Suggest/Suggest.d.ts +1 -1
  14. package/build/cjs/blocks/YFM/YFM.d.ts +1 -1
  15. package/build/cjs/blocks/YFM/YFM.js +6 -4
  16. package/build/cjs/components/FeedHeader/FeedHeader.d.ts +1 -1
  17. package/build/cjs/components/FeedHeader/components/Controls/Controls.css +5 -23
  18. package/build/cjs/components/FeedHeader/components/Controls/Controls.d.ts +1 -1
  19. package/build/cjs/components/FeedHeader/components/Controls/Controls.js +1 -1
  20. package/build/cjs/components/FeedHeader/components/Controls/customRenders.js +1 -2
  21. package/build/cjs/components/Paginator/types.d.ts +4 -4
  22. package/build/cjs/components/PostCard/PostCard.d.ts +4 -3
  23. package/build/cjs/components/PostCard/PostCard.js +5 -4
  24. package/build/cjs/components/PostInfo/PostInfo.d.ts +1 -1
  25. package/build/cjs/components/PostInfo/SuggestPostInfo.d.ts +3 -3
  26. package/build/cjs/components/PostInfo/SuggestPostInfo.js +2 -1
  27. package/build/cjs/components/PostInfo/components/Date.d.ts +3 -2
  28. package/build/cjs/components/PostInfo/components/Date.js +2 -1
  29. package/build/cjs/components/PostInfo/components/ReadingTime.d.ts +1 -1
  30. package/build/cjs/components/PostInfo/components/Save.d.ts +1 -1
  31. package/build/cjs/components/PostInfo/components/Sharing.d.ts +1 -1
  32. package/build/cjs/components/Posts/Posts.d.ts +1 -1
  33. package/build/cjs/components/Posts/Posts.js +5 -2
  34. package/build/cjs/components/PostsEmpty/PostsEmpty.d.ts +1 -1
  35. package/build/cjs/components/PostsError/PostsError.d.ts +1 -1
  36. package/build/cjs/components/Search/Search.css +13 -15
  37. package/build/cjs/components/Search/Search.d.ts +7 -1
  38. package/build/cjs/components/Search/Search.js +26 -14
  39. package/build/cjs/constructor/BlogConstructorProvider.d.ts +2 -2
  40. package/build/cjs/constructor/blocksMap.d.ts +11 -11
  41. package/build/cjs/containers/BlogPostPage/BlogPostPage.d.ts +1 -1
  42. package/build/cjs/icons/Close.d.ts +1 -1
  43. package/build/cjs/icons/DropdownArrow.d.ts +1 -1
  44. package/build/cjs/icons/Save.d.ts +1 -1
  45. package/build/cjs/icons/SaveFilled.d.ts +1 -1
  46. package/build/cjs/icons/SearchIcon.d.ts +1 -1
  47. package/build/cjs/icons/ShareArrowUp.d.ts +1 -1
  48. package/build/cjs/icons/Time.d.ts +1 -1
  49. package/build/cjs/models/blocks.d.ts +5 -5
  50. package/build/cjs/models/common.d.ts +8 -0
  51. package/build/cjs/models/common.js +12 -2
  52. package/build/cjs/utils/cn.d.ts +2 -3
  53. package/build/cjs/utils/cn.js +4 -7
  54. package/build/cjs/utils/common.d.ts +1 -0
  55. package/build/cjs/utils/common.js +15 -2
  56. package/build/esm/blocks/Author/Author.d.ts +1 -1
  57. package/build/esm/blocks/Author/Author.js +2 -2
  58. package/build/esm/blocks/Banner/Banner.d.ts +1 -1
  59. package/build/esm/blocks/Banner/Banner.js +8 -6
  60. package/build/esm/blocks/CTA/CTA.d.ts +1 -1
  61. package/build/esm/blocks/ColoredText/ColoredText.d.ts +1 -1
  62. package/build/esm/blocks/ColoredText/ColoredText.js +6 -5
  63. package/build/esm/blocks/Feed/Feed.d.ts +1 -1
  64. package/build/esm/blocks/Header/Header.d.ts +1 -1
  65. package/build/esm/blocks/Layout/Layout.d.ts +2 -2
  66. package/build/esm/blocks/Media/Media.d.ts +1 -1
  67. package/build/esm/blocks/Meta/Meta.d.ts +1 -1
  68. package/build/esm/blocks/Suggest/Suggest.d.ts +1 -1
  69. package/build/esm/blocks/YFM/YFM.d.ts +1 -1
  70. package/build/esm/blocks/YFM/YFM.js +6 -4
  71. package/build/esm/components/FeedHeader/FeedHeader.d.ts +1 -1
  72. package/build/esm/components/FeedHeader/components/Controls/Controls.css +5 -23
  73. package/build/esm/components/FeedHeader/components/Controls/Controls.d.ts +1 -1
  74. package/build/esm/components/FeedHeader/components/Controls/Controls.js +1 -1
  75. package/build/esm/components/FeedHeader/components/Controls/customRenders.js +1 -2
  76. package/build/esm/components/Paginator/types.d.ts +4 -4
  77. package/build/esm/components/PostCard/PostCard.d.ts +4 -3
  78. package/build/esm/components/PostCard/PostCard.js +5 -4
  79. package/build/esm/components/PostInfo/PostInfo.d.ts +1 -1
  80. package/build/esm/components/PostInfo/SuggestPostInfo.d.ts +3 -3
  81. package/build/esm/components/PostInfo/SuggestPostInfo.js +2 -1
  82. package/build/esm/components/PostInfo/components/Date.d.ts +3 -2
  83. package/build/esm/components/PostInfo/components/Date.js +2 -1
  84. package/build/esm/components/PostInfo/components/ReadingTime.d.ts +1 -1
  85. package/build/esm/components/PostInfo/components/Save.d.ts +1 -1
  86. package/build/esm/components/PostInfo/components/Sharing.d.ts +1 -1
  87. package/build/esm/components/Posts/Posts.d.ts +1 -1
  88. package/build/esm/components/Posts/Posts.js +5 -2
  89. package/build/esm/components/PostsEmpty/PostsEmpty.d.ts +1 -1
  90. package/build/esm/components/PostsError/PostsError.d.ts +1 -1
  91. package/build/esm/components/Search/Search.css +13 -15
  92. package/build/esm/components/Search/Search.d.ts +7 -1
  93. package/build/esm/components/Search/Search.js +28 -16
  94. package/build/esm/constructor/BlogConstructorProvider.d.ts +2 -2
  95. package/build/esm/constructor/blocksMap.d.ts +11 -11
  96. package/build/esm/containers/BlogPostPage/BlogPostPage.d.ts +1 -1
  97. package/build/esm/icons/Close.d.ts +1 -1
  98. package/build/esm/icons/DropdownArrow.d.ts +1 -1
  99. package/build/esm/icons/Save.d.ts +1 -1
  100. package/build/esm/icons/SaveFilled.d.ts +1 -1
  101. package/build/esm/icons/SearchIcon.d.ts +1 -1
  102. package/build/esm/icons/ShareArrowUp.d.ts +1 -1
  103. package/build/esm/icons/Time.d.ts +1 -1
  104. package/build/esm/models/blocks.d.ts +5 -5
  105. package/build/esm/models/common.d.ts +8 -0
  106. package/build/esm/models/common.js +11 -1
  107. package/build/esm/utils/cn.d.ts +2 -3
  108. package/build/esm/utils/cn.js +3 -4
  109. package/build/esm/utils/common.d.ts +1 -0
  110. package/build/esm/utils/common.js +13 -1
  111. package/package.json +18 -6
  112. package/server/models/blocks.d.ts +5 -5
  113. package/server/models/common.d.ts +8 -0
  114. package/server/models/common.js +12 -2
  115. package/build/cjs/components/ButtonWithIcon/ButtonWithIcon.css +0 -76
  116. package/build/cjs/components/ButtonWithIcon/ButtonWithIcon.d.ts +0 -12
  117. package/build/cjs/components/ButtonWithIcon/ButtonWithIcon.js +0 -11
  118. package/build/cjs/demo/DocsDecorator/DocsDecorator.css +0 -14
  119. package/build/cjs/internal-typings/bem-cn-lite.d.ts +0 -17
  120. package/build/esm/components/ButtonWithIcon/ButtonWithIcon.css +0 -76
  121. package/build/esm/components/ButtonWithIcon/ButtonWithIcon.d.ts +0 -13
  122. package/build/esm/components/ButtonWithIcon/ButtonWithIcon.js +0 -7
  123. package/build/esm/demo/DocsDecorator/DocsDecorator.css +0 -14
  124. package/build/esm/internal-typings/bem-cn-lite.d.ts +0 -17
@@ -1,10 +1,11 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { LocaleContext } from '../../../contexts/LocaleContext';
3
+ import { PostCardSize } from '../../../models/common';
3
4
  import { block } from '../../../utils/cn';
4
5
  import { format } from '../../../utils/date';
5
6
  import '../PostInfo.css';
6
7
  const b = block('post-info');
7
- export const Date = ({ date, size = 's' }) => {
8
+ export const Date = ({ date, size = PostCardSize.SMALL }) => {
8
9
  const { locale } = useContext(LocaleContext);
9
10
  return React.createElement("div", { className: b('item', { size }) }, format(date, 'longDate', locale === null || locale === void 0 ? void 0 : locale.code));
10
11
  };
@@ -4,5 +4,5 @@ type ReadingTimeProps = {
4
4
  readingTime: number;
5
5
  size?: 's' | 'm';
6
6
  };
7
- export declare const ReadingTime: React.FC<ReadingTimeProps>;
7
+ export declare const ReadingTime: ({ readingTime, size }: ReadingTimeProps) => React.JSX.Element;
8
8
  export {};
@@ -25,5 +25,5 @@ type SaveProps = QAProps & {
25
25
  *
26
26
  * @returns jsx
27
27
  */
28
- export declare const Save: React.FC<SaveProps>;
28
+ export declare const Save: ({ title, postId, hasUserLike, handleUserLike, metrikaGoal, size, theme, qa, }: SaveProps) => React.JSX.Element;
29
29
  export {};
@@ -7,5 +7,5 @@ type SharingProps = {
7
7
  */
8
8
  metrikaGoal?: string;
9
9
  };
10
- export declare const Sharing: React.FC<SharingProps>;
10
+ export declare const Sharing: ({ theme, metrikaGoal }: SharingProps) => React.JSX.Element;
11
11
  export {};
@@ -15,5 +15,5 @@ type PostCardProps = {
15
15
  pinnedPostOnPage?: PostData;
16
16
  pageCountForShowSupportButtons?: number;
17
17
  };
18
- export declare const Posts: React.FC<PostCardProps>;
18
+ export declare const Posts: ({ containerId, pinnedPostOnPage, currentPage, postsOnPage, isShowMoreVisible, errorShowMore, postCountOnPage, perPageInQuery, isFetching, handleShowMore, handlePageChange, pageCountForShowSupportButtons, }: PostCardProps) => React.JSX.Element;
19
19
  export {};
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { CardLayoutBlock } from '@gravity-ui/page-constructor';
3
3
  import { Button } from '@gravity-ui/uikit';
4
4
  import { Keyset, i18 } from '../../i18n';
5
+ import { PostCardSize, PostCardTitleHeadingLevel } from '../../models/common';
5
6
  import { block } from '../../utils/cn';
6
7
  import { Paginator } from '../Paginator/Paginator';
7
8
  import { PostCard } from '../PostCard/PostCard';
@@ -12,12 +13,14 @@ export const Posts = ({ containerId, pinnedPostOnPage, currentPage, postsOnPage,
12
13
  isFetching && React.createElement("div", { className: b('loaderContainer') }),
13
14
  React.createElement("div", { id: containerId, className: b('cards-container', { isLoading: isFetching }) },
14
15
  pinnedPostOnPage && currentPage === 1 && (React.createElement("div", { className: b('pinned-container') },
15
- React.createElement(PostCard, { post: pinnedPostOnPage, size: "m", fullWidth: true, showTag: true }))),
16
+ React.createElement(PostCard, { post: pinnedPostOnPage, size: PostCardSize.MEDIUM, fullWidth: true, showTag: true, titleHeadingLevel: PostCardTitleHeadingLevel.H2 }))),
16
17
  (postsOnPage === null || postsOnPage === void 0 ? void 0 : postsOnPage.length) ? (React.createElement(CardLayoutBlock, { title: '', colSizes: {
17
18
  all: 12,
18
19
  lg: 4,
19
20
  md: 6,
20
- } }, postsOnPage === null || postsOnPage === void 0 ? void 0 : postsOnPage.map((post) => (React.createElement(PostCard, { key: post.id, post: post, showTag: true }))))) : (React.createElement(PostsEmpty, null))),
21
+ } }, postsOnPage === null || postsOnPage === void 0 ? void 0 : postsOnPage.map((post) => (React.createElement(PostCard, { key: post.id, post: post, showTag: true, titleHeadingLevel: pinnedPostOnPage
22
+ ? PostCardTitleHeadingLevel.H3
23
+ : PostCardTitleHeadingLevel.H2 }))))) : (React.createElement(PostsEmpty, null))),
21
24
  React.createElement("div", { className: b('pagination') },
22
25
  Boolean(isShowMoreVisible && (postsOnPage === null || postsOnPage === void 0 ? void 0 : postsOnPage.length)) && (React.createElement(Button, { view: "outlined", size: "xl", className: b('more-button'), onClick: handleShowMore }, i18(Keyset.ActionLoadMore))),
23
26
  errorShowMore && (React.createElement("div", { className: b('error-show-more') },
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import './PostsEmpty.css';
3
- export declare const PostsEmpty: React.FC;
3
+ export declare const PostsEmpty: () => React.JSX.Element;
@@ -3,5 +3,5 @@ import './PostError.css';
3
3
  type PostsErrorContainerProps = {
4
4
  onButtonClick?: () => void | Promise<void>;
5
5
  };
6
- export declare const PostsError: React.FC<PostsErrorContainerProps>;
6
+ export declare const PostsError: ({ onButtonClick }: PostsErrorContainerProps) => React.JSX.Element;
7
7
  export {};
@@ -7,30 +7,28 @@ unpredictable css rules order in build */
7
7
  display: flex;
8
8
  align-items: center;
9
9
  justify-content: flex-end;
10
- height: 44px;
11
10
  transition: width 0.3s;
12
11
  }
13
- .bc-search__close-button, .bc-search__search-button {
14
- position: absolute;
15
- z-index: 2;
16
- right: 10px;
12
+ .bc-search__input-icon {
13
+ display: flex;
14
+ padding-right: 7px;
17
15
  color: var(--g-color-text-hint);
16
+ cursor: pointer;
18
17
  }
19
- .bc-search__search-button:hover {
20
- color: var(--g-color-text-secondary);
18
+ .bc-search__search-suggest {
19
+ display: flex;
20
+ align-items: center;
21
+ height: 44px;
22
+ background-color: var(--g-color-base-background);
23
+ border-radius: var(--bc-text-input-border-radius);
24
+ border: 1px solid var(--g-color-base-background);
21
25
  }
22
- .bc-search__search-suggest-container {
23
- width: 100%;
26
+ .bc-search__search-suggest:hover, .bc-search__search-suggest:focus {
27
+ border: 1px solid var(--g-color-base-generic-hover);
24
28
  }
25
29
  .bc-search .bc-search__search-suggest-control {
26
- background-color: var(--g-color-base-background);
27
30
  padding-left: 12px;
28
31
  padding-right: 32px;
29
- border-radius: var(--bc-text-input-border-radius);
30
- border: 1px solid transparent;
31
- }
32
- .bc-search .bc-search__search-suggest-control:hover, .bc-search .bc-search__search-suggest-control:focus {
33
- border: 1px solid var(--g-color-base-generic-hover);
34
32
  }
35
33
  .bc-search_size_s {
36
34
  --bc-text-input-border-radius: var(--g-border-radius-l);
@@ -12,5 +12,11 @@ interface SearchProps extends ClassNameProps {
12
12
  autoFocus?: boolean;
13
13
  className?: string;
14
14
  }
15
- export declare const Search: React.FC<SearchProps>;
15
+ /**
16
+ * Search component, placed on blog main page,
17
+ * based on TextInput from uikit
18
+ *
19
+ * @returns {JSX|null}
20
+ */
21
+ export declare const Search: ({ className, initialValue, onSubmit, debounce, placeholder, size, autoFocus, value: externalValue, }: SearchProps) => React.JSX.Element;
16
22
  export {};
@@ -1,18 +1,23 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import { TextInput } from '@gravity-ui/uikit';
1
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
2
+ import { Icon, TextInput } from '@gravity-ui/uikit';
3
3
  import { debounce as lodashDebounce } from 'lodash';
4
4
  import { useIsIPhone } from '../../hooks/useIsIPhone';
5
5
  import { Keyset, i18 } from '../../i18n';
6
6
  import { Close } from '../../icons/Close';
7
7
  import { SearchIcon } from '../../icons/SearchIcon';
8
8
  import { block } from '../../utils/cn';
9
- import { ButtonWithIcon } from '../ButtonWithIcon/ButtonWithIcon';
10
9
  import './Search.css';
11
10
  const b = block('search');
12
11
  const SEARCH_ICON_SIZE = 16;
13
12
  const CLOSE_ICON_SIZE = 12;
14
- export const Search = (props) => {
15
- const { className, initialValue, onSubmit, debounce = 300, placeholder = i18(Keyset.Search), size = 'm', autoFocus = false, value: externalValue, } = props;
13
+ const AUTOFOCUS_TIMEOUT = 0;
14
+ /**
15
+ * Search component, placed on blog main page,
16
+ * based on TextInput from uikit
17
+ *
18
+ * @returns {JSX|null}
19
+ */
20
+ export const Search = ({ className, initialValue, onSubmit, debounce = 300, placeholder = i18(Keyset.Search), size = 'm', autoFocus = false, value: externalValue, }) => {
16
21
  const handleChange = lodashDebounce(onSubmit, debounce);
17
22
  const [value, setValue] = useState(initialValue);
18
23
  const inputRef = useRef(null);
@@ -24,20 +29,27 @@ export const Search = (props) => {
24
29
  }, [externalValue]);
25
30
  useEffect(() => {
26
31
  if (autoFocus && !isIPhone) {
27
- setTimeout(() => { var _a; return (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); }, 0);
32
+ setTimeout(() => { var _a; return (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); }, AUTOFOCUS_TIMEOUT);
28
33
  }
29
34
  }, [autoFocus, inputRef, isIPhone]);
30
- return (React.createElement("div", { className: b({ size }, className) },
31
- React.createElement("div", { className: b('search-suggest-container') },
32
- React.createElement(TextInput, { className: b('search-suggest'), value: value, onUpdate: (query) => {
33
- setValue(query);
34
- handleChange(query);
35
- }, placeholder: placeholder, size: size === 'm' ? 'xl' : 'l', controlRef: inputRef, view: "clear", controlProps: {
36
- className: b('search-suggest-control'),
37
- } })),
38
- value ? (React.createElement(ButtonWithIcon, { className: b('close-button'), icon: Close, iconSize: CLOSE_ICON_SIZE, size: "xs", onClick: () => {
35
+ const rightContent = useMemo(() => {
36
+ const iconData = value ? Close : SearchIcon;
37
+ const iconSize = value ? CLOSE_ICON_SIZE : SEARCH_ICON_SIZE;
38
+ const handleClick = () => {
39
+ if (value) {
39
40
  handleChange.cancel();
40
41
  setValue('');
41
42
  onSubmit('');
42
- } })) : (React.createElement(ButtonWithIcon, { className: b('search-button'), icon: SearchIcon, iconSize: SEARCH_ICON_SIZE, size: "xs", disabled: true }))));
43
+ }
44
+ };
45
+ return (React.createElement("div", { className: b('input-icon'), onClick: handleClick },
46
+ React.createElement(Icon, { size: iconSize, data: iconData })));
47
+ }, [handleChange, onSubmit, value]);
48
+ return (React.createElement("div", { className: b({ size }, className) },
49
+ React.createElement(TextInput, { className: b('search-suggest'), value: value, onUpdate: (query) => {
50
+ setValue(query);
51
+ handleChange(query);
52
+ }, placeholder: placeholder, size: size === 'm' ? 'xl' : 'l', controlRef: inputRef, view: "clear", controlProps: {
53
+ className: b('search-suggest-control'),
54
+ }, rightContent: rightContent })));
43
55
  };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { PropsWithChildren } from 'react';
2
2
  import { AnalyticsContextProps } from '@gravity-ui/page-constructor';
3
3
  import { DeviceContextProps } from '../contexts/DeviceContext';
4
4
  import { RouterContextProps } from '../contexts/RouterContext';
@@ -15,4 +15,4 @@ export interface BlogConstructorProviderProps {
15
15
  settings?: SettingsContextProps;
16
16
  children?: React.ReactNode;
17
17
  }
18
- export declare const BlogConstructorProvider: React.FC<BlogConstructorProviderProps>;
18
+ export declare const BlogConstructorProvider: ({ isMobile, locale, router, theme, device, analytics, settings, children, }: PropsWithChildren<BlogConstructorProviderProps>) => React.JSX.Element;
@@ -1,18 +1,18 @@
1
1
  declare const _default: {
2
2
  blocks: {
3
- "blog-yfm-block": import("react").FC<import("../models/blocks").YFMProps>;
4
- "blog-layout-block": import("react").FC<import("../models/blocks").LayoutProps>;
5
- "blog-media-block": import("react").FC<import("../models/blocks").MediaProps>;
6
- "blog-banner-block": import("react").FC<import("../models/blocks").BannerProps>;
7
- "blog-cta-block": import("react").FC<import("../models/blocks").CTAProps>;
8
- "blog-colored-text-block": import("react").FC<import("../models/blocks").ColoredTextProps>;
9
- "blog-author-block": import("react").FC<import("../models/blocks").AuthorProps>;
10
- "blog-suggest-block": import("react").FC<import("../models/blocks").SuggestProps>;
11
- "blog-meta-block": import("react").FC<import("../models/blocks").MetaProps>;
12
- "blog-feed-block": import("react").FC<import("../models/blocks").FeedProps>;
3
+ "blog-yfm-block": (props: import("../models/blocks").YFMProps) => import("react").JSX.Element;
4
+ "blog-layout-block": ({ fullWidth, mobileOrder, children, paddingTop, paddingBottom, }: import("react").PropsWithChildren<import("../models/blocks").LayoutProps>) => import("react").JSX.Element;
5
+ "blog-media-block": ({ text, paddingTop, paddingBottom, ...mediaProps }: import("../models/blocks").MediaProps) => import("react").JSX.Element;
6
+ "blog-banner-block": ({ color, imageSize, image, paddingTop, paddingBottom, qa, ...content }: import("../models/blocks").BannerProps) => import("react").JSX.Element;
7
+ "blog-cta-block": ({ items, paddingTop, paddingBottom }: import("../models/blocks").CTAProps) => import("react").JSX.Element;
8
+ "blog-colored-text-block": ({ background, paddingTop, paddingBottom, qa, ...content }: import("../models/blocks").ColoredTextProps) => import("react").JSX.Element;
9
+ "blog-author-block": (props: import("../models/blocks").AuthorProps) => import("react").JSX.Element | null;
10
+ "blog-suggest-block": ({ paddingTop, paddingBottom }: import("../models/blocks").SuggestProps) => import("react").JSX.Element | null;
11
+ "blog-meta-block": (props: import("../models/blocks").MetaProps) => import("react").JSX.Element;
12
+ "blog-feed-block": ({ image }: import("../models/blocks").FeedProps) => import("react").JSX.Element;
13
13
  };
14
14
  headers: {
15
- "blog-header-block": import("react").FC<import("../models/blocks").HeaderProps>;
15
+ "blog-header-block": (props: import("../models/blocks").HeaderProps) => import("react").JSX.Element;
16
16
  };
17
17
  };
18
18
  export default _default;
@@ -19,4 +19,4 @@ export interface BlogPostPageProps {
19
19
  isSignedInUser?: boolean;
20
20
  onClickSignIn?: React.EventHandler<SyntheticEvent>;
21
21
  }
22
- export declare const BlogPostPage: React.FC<BlogPostPageProps>;
22
+ export declare const BlogPostPage: ({ metaData, suggestedPosts, likes, content, post, settings, navigation, shareOptions, isSignedInUser, onClickSignIn, }: BlogPostPageProps) => React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const Close: React.FC<React.SVGProps<SVGSVGElement>>;
2
+ export declare const Close: (props: React.SVGProps<SVGSVGElement>) => React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const DropdownArrow: React.FC<React.SVGProps<SVGSVGElement>>;
2
+ export declare const DropdownArrow: (props: React.SVGProps<SVGSVGElement>) => React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const Save: React.FC<React.SVGProps<SVGSVGElement>>;
2
+ export declare const Save: (props: React.SVGProps<SVGSVGElement>) => React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const SaveFilled: React.FC<React.SVGProps<SVGSVGElement>>;
2
+ export declare const SaveFilled: (props: React.SVGProps<SVGSVGElement>) => React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const SearchIcon: React.FC<React.SVGProps<SVGSVGElement>>;
2
+ export declare const SearchIcon: (props: React.SVGProps<SVGSVGElement>) => React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const ShareArrowUp: React.FC<React.SVGProps<SVGSVGElement>>;
2
+ export declare const ShareArrowUp: (props: React.SVGProps<SVGSVGElement>) => React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const Time: React.FC<React.SVGProps<SVGSVGElement>>;
2
+ export declare const Time: (props: React.SVGProps<SVGSVGElement>) => React.JSX.Element;
@@ -1,17 +1,17 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { ContentBlockProps, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme } from '@gravity-ui/page-constructor';
3
- import { BlockType, ClassNameProps, PostData } from './common';
3
+ import { BlockType, ClassNameProps, PostData, QAProps } from './common';
4
4
  import { PaddingsYFMProps } from './paddings';
5
5
  export type AuthorProps = ClassNameProps & {
6
6
  authorId: number;
7
7
  image: string;
8
- } & PaddingsYFMProps;
9
- export type BannerProps = ContentBlockProps & {
8
+ } & PaddingsYFMProps & QAProps;
9
+ export type BannerProps = ContentBlockProps & QAProps & {
10
10
  color?: string;
11
11
  image?: string;
12
12
  imageSize?: 's' | 'm';
13
13
  } & PaddingsYFMProps;
14
- export type ColoredTextProps = ContentBlockProps & {
14
+ export type ColoredTextProps = ContentBlockProps & QAProps & {
15
15
  background?: {
16
16
  color?: string;
17
17
  image?: string;
@@ -40,7 +40,7 @@ export type SuggestProps = ClassNameProps & {
40
40
  } & PaddingsYFMProps;
41
41
  export type YFMProps = {
42
42
  text: string;
43
- } & PaddingsYFMProps;
43
+ } & PaddingsYFMProps & QAProps;
44
44
  export type FeedProps = {
45
45
  image: string;
46
46
  };
@@ -168,3 +168,11 @@ export type FetchArgs = {
168
168
  export interface QAProps {
169
169
  qa?: string;
170
170
  }
171
+ export declare enum PostCardSize {
172
+ SMALL = "s",
173
+ MEDIUM = "m"
174
+ }
175
+ export declare enum PostCardTitleHeadingLevel {
176
+ H2 = "h2",
177
+ H3 = "h3"
178
+ }
@@ -28,4 +28,14 @@ export var DefaultEventNames;
28
28
  DefaultEventNames["Tag"] = "selector-tag-click";
29
29
  DefaultEventNames["Service"] = "selector-service-click";
30
30
  DefaultEventNames["SaveOnly"] = "save-only-button-click";
31
- })(DefaultEventNames || (DefaultEventNames = {}));
31
+ })(DefaultEventNames || (DefaultEventNames = {}));
32
+ export var PostCardSize;
33
+ (function (PostCardSize) {
34
+ PostCardSize["SMALL"] = "s";
35
+ PostCardSize["MEDIUM"] = "m";
36
+ })(PostCardSize || (PostCardSize = {}));
37
+ export var PostCardTitleHeadingLevel;
38
+ (function (PostCardTitleHeadingLevel) {
39
+ PostCardTitleHeadingLevel["H2"] = "h2";
40
+ PostCardTitleHeadingLevel["H3"] = "h3";
41
+ })(PostCardTitleHeadingLevel || (PostCardTitleHeadingLevel = {}));
@@ -1,4 +1,3 @@
1
- import blockOrigin from 'bem-cn-lite';
2
1
  export declare const NAMESPACE = "bc-";
3
- export type CnBlock = ReturnType<typeof blockOrigin>;
4
- export declare function block(name: string): CnBlock;
2
+ export declare const cn: import("@bem-react/classname").ClassNameInitilizer;
3
+ export declare const block: import("@bem-react/classname").ClassNameInitilizer;
@@ -1,5 +1,4 @@
1
- import blockOrigin from 'bem-cn-lite';
1
+ import { withNaming } from '@bem-react/classname';
2
2
  export const NAMESPACE = 'bc-';
3
- export function block(name) {
4
- return blockOrigin(`${NAMESPACE}${name}`);
5
- }
3
+ export const cn = withNaming({ e: '__', m: '_' });
4
+ export const block = withNaming({ n: NAMESPACE, e: '__', m: '_' });
@@ -41,4 +41,5 @@ export declare const isMetrikaExist: (goal: NewMetrikaGoal, existGoals: NewMetri
41
41
  export declare const getBlogElementMetrika: (blogCustomGoal: NewMetrikaGoal, existingGoals?: MetrikaGoal) => string | string[] | NewMetrikaGoal[];
42
42
  export declare const getFeedQueryParams: (queryString: Query, pageNumber?: number) => GetPostsRequest;
43
43
  export declare const scrollOnPageChange: (containerId: string) => void;
44
+ export declare const getQaAttributes: (qa?: string, ...customKeys: (string | Array<string>)[]) => Record<string, string>;
44
45
  export {};
@@ -1,9 +1,10 @@
1
1
  import { __rest } from "tslib";
2
2
  import { format, parse } from 'url';
3
3
  import { isNewMetrikaFormat, } from '@gravity-ui/page-constructor';
4
- import { debounce, memoize } from 'lodash';
4
+ import { camelCase, debounce, flatten, memoize } from 'lodash';
5
5
  import { CONTENT_DEFAULT_COL_SIZES, CONTENT_DEFAULT_SIZE, CONTENT_DEFAULT_THEME, DEFAULT_PAGE, DEFAULT_ROWS_PER_PAGE, } from '../blocks/constants';
6
6
  import { Keyset, i18 } from '../i18n';
7
+ const QA_ATTRIBUTES_KEYS = ['container', 'content', 'wrapper', 'image', 'button'];
7
8
  export function getAbsolutePath(router, url) {
8
9
  if (!router || !router.pathname) {
9
10
  return url !== null && url !== void 0 ? url : '';
@@ -98,4 +99,15 @@ export const scrollOnPageChange = (containerId) => {
98
99
  if (y < 0) {
99
100
  scrollToHash(containerId);
100
101
  }
102
+ };
103
+ export const getQaAttributes = (qa, ...customKeys) => {
104
+ const attributes = {};
105
+ if (qa) {
106
+ const keys = QA_ATTRIBUTES_KEYS.concat(flatten(customKeys));
107
+ keys.forEach((key) => {
108
+ attributes[camelCase(key)] = `${qa}-${key}`;
109
+ });
110
+ attributes.default = qa;
111
+ }
112
+ return attributes;
101
113
  };
package/package.json CHANGED
@@ -1,12 +1,25 @@
1
1
  {
2
2
  "name": "@gravity-ui/blog-constructor",
3
- "version": "5.0.2",
3
+ "version": "5.2.0",
4
4
  "description": "Gravity UI Blog Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/gravity-ui/blog-constructor"
9
9
  },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./build/esm/index.d.ts",
13
+ "require": "./build/cjs/index.js",
14
+ "import": "./build/esm/index.js"
15
+ },
16
+ "./server": {
17
+ "types": "./server/index.d.ts",
18
+ "require": "./server/index.js",
19
+ "import": "./server/index.js"
20
+ },
21
+ "./styles/*": "./styles/*"
22
+ },
10
23
  "files": [
11
24
  "build",
12
25
  "styles",
@@ -46,9 +59,9 @@
46
59
  "test:watch": "jest --watchAll --maxWorkers=25%"
47
60
  },
48
61
  "dependencies": {
49
- "@gravity-ui/components": "^2.0.0",
62
+ "@bem-react/classname": "^1.6.0",
63
+ "@gravity-ui/components": "^2.4.0",
50
64
  "@gravity-ui/i18n": "^1.0.0",
51
- "bem-cn-lite": "^4.0.0",
52
65
  "lodash": "^4.17.21",
53
66
  "react-helmet": "^6.1.0",
54
67
  "react-player": "^2.9.0",
@@ -76,11 +89,11 @@
76
89
  "@commitlint/config-conventional": "^17.4.3",
77
90
  "@doc-tools/transform": "^3.3.2",
78
91
  "@gravity-ui/eslint-config": "^2.0.0",
79
- "@gravity-ui/page-constructor": "^4.0.0",
92
+ "@gravity-ui/page-constructor": "^4.8.0",
80
93
  "@gravity-ui/prettier-config": "^1.0.1",
81
94
  "@gravity-ui/stylelint-config": "^1.0.0",
82
95
  "@gravity-ui/tsconfig": "^1.0.0",
83
- "@gravity-ui/uikit": "^5.1.0",
96
+ "@gravity-ui/uikit": "^5.11.0",
84
97
  "@storybook/addon-essentials": "^7.0.27",
85
98
  "@storybook/cli": "^7.0.27",
86
99
  "@storybook/preset-scss": "^1.0.3",
@@ -99,7 +112,6 @@
99
112
  "@types/sanitize-html": "^2.6.0",
100
113
  "@types/ua-parser-js": "^0.7.36",
101
114
  "eslint": "^8.34.0",
102
- "eslint-plugin-local": "./eslint-plugin-local",
103
115
  "eslint-plugin-no-not-accumulator-reassign": "^0.1.0",
104
116
  "eslint-plugin-testing-library": "^5.9.1",
105
117
  "gulp": "^4.0.2",
@@ -1,17 +1,17 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { ContentBlockProps, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme } from '@gravity-ui/page-constructor';
3
- import { BlockType, ClassNameProps, PostData } from './common';
3
+ import { BlockType, ClassNameProps, PostData, QAProps } from './common';
4
4
  import { PaddingsYFMProps } from './paddings';
5
5
  export type AuthorProps = ClassNameProps & {
6
6
  authorId: number;
7
7
  image: string;
8
- } & PaddingsYFMProps;
9
- export type BannerProps = ContentBlockProps & {
8
+ } & PaddingsYFMProps & QAProps;
9
+ export type BannerProps = ContentBlockProps & QAProps & {
10
10
  color?: string;
11
11
  image?: string;
12
12
  imageSize?: 's' | 'm';
13
13
  } & PaddingsYFMProps;
14
- export type ColoredTextProps = ContentBlockProps & {
14
+ export type ColoredTextProps = ContentBlockProps & QAProps & {
15
15
  background?: {
16
16
  color?: string;
17
17
  image?: string;
@@ -40,7 +40,7 @@ export type SuggestProps = ClassNameProps & {
40
40
  } & PaddingsYFMProps;
41
41
  export type YFMProps = {
42
42
  text: string;
43
- } & PaddingsYFMProps;
43
+ } & PaddingsYFMProps & QAProps;
44
44
  export type FeedProps = {
45
45
  image: string;
46
46
  };
@@ -168,3 +168,11 @@ export type FetchArgs = {
168
168
  export interface QAProps {
169
169
  qa?: string;
170
170
  }
171
+ export declare enum PostCardSize {
172
+ SMALL = "s",
173
+ MEDIUM = "m"
174
+ }
175
+ export declare enum PostCardTitleHeadingLevel {
176
+ H2 = "h2",
177
+ H3 = "h3"
178
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultEventNames = exports.BlockType = exports.Theme = void 0;
3
+ exports.PostCardTitleHeadingLevel = exports.PostCardSize = exports.DefaultEventNames = exports.BlockType = exports.Theme = void 0;
4
4
  var Theme;
5
5
  (function (Theme) {
6
6
  Theme["Light"] = "light";
@@ -31,4 +31,14 @@ var DefaultEventNames;
31
31
  DefaultEventNames["Tag"] = "selector-tag-click";
32
32
  DefaultEventNames["Service"] = "selector-service-click";
33
33
  DefaultEventNames["SaveOnly"] = "save-only-button-click";
34
- })(DefaultEventNames = exports.DefaultEventNames || (exports.DefaultEventNames = {}));
34
+ })(DefaultEventNames = exports.DefaultEventNames || (exports.DefaultEventNames = {}));
35
+ var PostCardSize;
36
+ (function (PostCardSize) {
37
+ PostCardSize["SMALL"] = "s";
38
+ PostCardSize["MEDIUM"] = "m";
39
+ })(PostCardSize = exports.PostCardSize || (exports.PostCardSize = {}));
40
+ var PostCardTitleHeadingLevel;
41
+ (function (PostCardTitleHeadingLevel) {
42
+ PostCardTitleHeadingLevel["H2"] = "h2";
43
+ PostCardTitleHeadingLevel["H3"] = "h3";
44
+ })(PostCardTitleHeadingLevel = exports.PostCardTitleHeadingLevel || (exports.PostCardTitleHeadingLevel = {}));
@@ -1,76 +0,0 @@
1
- /* use this for style redefinitions to awoid problems with
2
- unpredictable css rules order in build */
3
- .bc-button-with-icon {
4
- display: inline-block;
5
- margin: 0;
6
- padding: 0;
7
- font: inherit;
8
- border: none;
9
- outline: none;
10
- color: inherit;
11
- background: none;
12
- cursor: pointer;
13
- outline: none;
14
- display: flex;
15
- align-items: center;
16
- justify-content: center;
17
- transition: color 0.2s;
18
- }
19
- .utilityfocus .bc-button-with-icon:focus {
20
- outline: 2px solid #ffdb4d;
21
- }
22
- .bc-button-with-icon_size_xs {
23
- height: 24px;
24
- width: 24px;
25
- }
26
- .bc-button-with-icon_size_s {
27
- height: 28px;
28
- width: 28px;
29
- }
30
- .bc-button-with-icon_size_m {
31
- height: 32px;
32
- width: 32px;
33
- }
34
- .bc-button-with-icon_size_n {
35
- height: 36px;
36
- width: 36px;
37
- }
38
- .bc-button-with-icon_theme_primary {
39
- color: var(--www-text-content-color);
40
- transition: color 0.2s;
41
- }
42
- .bc-button-with-icon_theme_primary:hover {
43
- color: var(--g-color-text-primary);
44
- }
45
- .bc-button-with-icon_theme_secondary {
46
- color: var(--g-color-text-secondary);
47
- transition: color 0.2s;
48
- }
49
- .bc-button-with-icon_theme_secondary:hover {
50
- color: var(--www-text-content-color);
51
- }
52
- .bc-button-with-icon_theme_link {
53
- color: var(--www-text-content-color);
54
- transition: color 0.2s;
55
- }
56
- .bc-button-with-icon_theme_link:hover {
57
- color: var(--g-color-text-link-hover);
58
- }
59
- .bc-button-with-icon_theme_accent {
60
- color: var(--g-color-base-danger-heavy);
61
- transition: opacity 0.2s;
62
- opacity: 0.7;
63
- }
64
- .bc-button-with-icon_theme_accent:hover {
65
- opacity: 1;
66
- }
67
- .bc-button-with-icon_disabled {
68
- cursor: default;
69
- color: var(--g-color-text-secondary);
70
- }
71
- .bc-button-with-icon_disabled:hover {
72
- color: var(--g-color-text-secondary);
73
- }
74
- .mobile .bc-button-with-icon:hover {
75
- color: inherit;
76
- }