@gravity-ui/blog-constructor 6.4.0 → 6.4.2

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.
@@ -107,7 +107,7 @@ const Controls = ({ handleLoadData, tags = [], services = [], queryParams, }) =>
107
107
  defaultLabel: (0, i18n_1.i18n)(i18n_1.Keyset.AllServices),
108
108
  }), virtualizationThreshold: VIRTUALIZATION_THRESHOLD, renderOption: customRenders_1.renderOption, renderFilter: customRenders_1.renderFilter }))) : null,
109
109
  hasLikes ? (react_1.default.createElement("div", { className: b('filter-item', { 'width-auto': true }) },
110
- react_1.default.createElement(uikit_1.Button, { view: 'outlined', className: b('saved-only-button', { savedOnly }), size: "xl", onClick: handleSavedOnly },
110
+ react_1.default.createElement(uikit_1.Button, { view: 'outlined', className: b('saved-only-button', { savedOnly }), size: "xl", onClick: handleSavedOnly, selected: savedOnly },
111
111
  react_1.default.createElement(uikit_1.Icon, { data: Save_1.Save, size: ICON_SIZE, className: b('icon', { savedOnly }) }),
112
112
  (0, i18n_1.i18n)(i18n_1.Keyset.ActionSavedOnly)))) : null)));
113
113
  };
@@ -3,7 +3,7 @@ import { AnalyticsEventsProp } from '@gravity-ui/page-constructor';
3
3
  import { QAProps } from '../../../models/common';
4
4
  type SaveProps = QAProps & {
5
5
  title: string | number;
6
- postId: number;
6
+ postId: number | string;
7
7
  hasUserLike: boolean;
8
8
  handleUserLike: () => void;
9
9
  theme?: 'light' | 'dark';
@@ -39,13 +39,15 @@ const Search = ({ className, initialValue, onSubmit, debounce = 300, placeholder
39
39
  const iconData = value ? Close_1.Close : SearchIcon_1.SearchIcon;
40
40
  const iconSize = value ? CLOSE_ICON_SIZE : SEARCH_ICON_SIZE;
41
41
  const handleClick = () => {
42
+ var _a;
42
43
  if (value) {
43
44
  handleChange.cancel();
44
45
  setValue('');
45
46
  onSubmit('');
47
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
46
48
  }
47
49
  };
48
- return (react_1.default.createElement("button", { className: b('input-icon'), onClick: handleClick, "aria-label": (0, i18n_1.i18n)(i18n_1.Keyset.SearchAction) },
50
+ return (react_1.default.createElement("button", { className: b('input-icon'), onClick: handleClick, "aria-label": value ? (0, i18n_1.i18n)(i18n_1.Keyset.ClearAction) : undefined, "aria-hidden": !value },
49
51
  react_1.default.createElement(uikit_1.Icon, { size: iconSize, data: iconData })));
50
52
  }, [handleChange, onSubmit, value]);
51
53
  return (react_1.default.createElement("div", { className: b({ size }, className) },
@@ -2,7 +2,7 @@ import { ToggleLikeCallbackType } from '../models/common';
2
2
  type UseLikesProps = {
3
3
  hasLike?: boolean;
4
4
  count?: number;
5
- postId?: number;
5
+ postId?: number | string;
6
6
  toggleLikeCallback?: ToggleLikeCallbackType;
7
7
  };
8
8
  type UseLikeData = {
@@ -19,6 +19,6 @@ export declare enum Keyset {
19
19
  PromptSignInOnLike = "prompt_sign_in_on_like",
20
20
  SignIn = "Sign In",
21
21
  Save = "save",
22
- SearchAction = "search_action"
22
+ ClearAction = "clear_action"
23
23
  }
24
24
  export declare const i18n: (key: Keyset, params?: import("@gravity-ui/i18n").Params | undefined) => string;
@@ -25,7 +25,7 @@ var Keyset;
25
25
  Keyset["PromptSignInOnLike"] = "prompt_sign_in_on_like";
26
26
  Keyset["SignIn"] = "Sign In";
27
27
  Keyset["Save"] = "save";
28
- Keyset["SearchAction"] = "search_action";
28
+ Keyset["ClearAction"] = "clear_action";
29
29
  })(Keyset = exports.Keyset || (exports.Keyset = {}));
30
30
  const en = {
31
31
  [Keyset.Title]: 'Blog',
@@ -52,7 +52,7 @@ const en = {
52
52
  ],
53
53
  [Keyset.SignIn]: 'Sign In',
54
54
  [Keyset.Save]: 'Save',
55
- [Keyset.SearchAction]: 'Find',
55
+ [Keyset.ClearAction]: 'Clear',
56
56
  };
57
57
  const ru = {
58
58
  [Keyset.Title]: 'Блог',
@@ -79,6 +79,6 @@ const ru = {
79
79
  ],
80
80
  [Keyset.SignIn]: 'Войти',
81
81
  [Keyset.Save]: 'Сохранить',
82
- [Keyset.SearchAction]: 'Найти',
82
+ [Keyset.ClearAction]: 'Очистить',
83
83
  };
84
84
  exports.i18n = (0, i18n_1.addComponentKeysets)({ en, ru }, NAMESPACE);
@@ -3,7 +3,7 @@ import { ContentBlockProps, FormBlockData, HeaderBlockProps, MediaProps as PCMed
3
3
  import { BlockType, ClassNameProps, PostData, QAProps } from './common';
4
4
  import { PaddingsYFMProps } from './paddings';
5
5
  export type AuthorProps = ClassNameProps & {
6
- authorId: number;
6
+ authorId: number | string;
7
7
  image: string;
8
8
  } & PaddingsYFMProps & QAProps;
9
9
  export type BannerProps = ContentBlockProps & QAProps & {
@@ -11,7 +11,7 @@ export interface ClassNameProps {
11
11
  className?: string;
12
12
  }
13
13
  export type Author = {
14
- id: number;
14
+ id: number | string;
15
15
  avatar: string | null;
16
16
  createdAt: string;
17
17
  updatedAt: string;
@@ -24,7 +24,7 @@ export type Author = {
24
24
  [x: string]: string | null;
25
25
  };
26
26
  export type Service = {
27
- id: number;
27
+ id: number | string;
28
28
  slug: string;
29
29
  name: string;
30
30
  } & {
@@ -53,13 +53,13 @@ export type Tag = {
53
53
  icon?: string;
54
54
  isDeleted?: boolean;
55
55
  locale?: string;
56
- blogTagId?: number;
56
+ blogTagId?: number | string;
57
57
  count?: number;
58
58
  };
59
59
  export interface PostData {
60
60
  author?: string;
61
61
  authors?: Author[];
62
- blogPostId?: number;
62
+ blogPostId?: number | string;
63
63
  content?: string;
64
64
  date: string;
65
65
  description?: string;
@@ -130,7 +130,7 @@ export interface PostMetaProps {
130
130
  organization: MetaOrganizationType;
131
131
  }
132
132
  export type ToggleLikeCallbackType = ({ postId, hasLike, }: {
133
- postId?: number;
133
+ postId?: number | string;
134
134
  hasLike?: boolean;
135
135
  }) => void;
136
136
  export interface HeaderBlockProps extends PageConstructorHeaderBlockProps {
@@ -15,7 +15,7 @@ export declare const getPageSearchParams: (query?: Query) => URLSearchParams;
15
15
  export declare const scrollToHash: (hash: string, browser?: string) => void;
16
16
  type CloudListTagStub = {};
17
17
  export declare const getTags: ((tags: Tag[], blogPath: string) => CloudListTagStub[]) & import("lodash").MemoizedFunction;
18
- export declare const postLikeStatus: import("lodash").DebouncedFunc<(postId: number, hasUserLike: boolean) => void>;
18
+ export declare const postLikeStatus: import("lodash").DebouncedFunc<(postId: number | string, hasUserLike: boolean) => void>;
19
19
  export declare const updateContentSizes: ({ size, colSizes, theme, ...contentData }: ContentBlockProps) => {
20
20
  size: import("@gravity-ui/page-constructor").ContentSize;
21
21
  colSizes: {
@@ -104,7 +104,7 @@ export const Controls = ({ handleLoadData, tags = [], services = [], queryParams
104
104
  defaultLabel: i18n(Keyset.AllServices),
105
105
  }), virtualizationThreshold: VIRTUALIZATION_THRESHOLD, renderOption: renderOption, renderFilter: renderFilter }))) : null,
106
106
  hasLikes ? (React.createElement("div", { className: b('filter-item', { 'width-auto': true }) },
107
- React.createElement(Button, { view: 'outlined', className: b('saved-only-button', { savedOnly }), size: "xl", onClick: handleSavedOnly },
107
+ React.createElement(Button, { view: 'outlined', className: b('saved-only-button', { savedOnly }), size: "xl", onClick: handleSavedOnly, selected: savedOnly },
108
108
  React.createElement(Icon, { data: Save, size: ICON_SIZE, className: b('icon', { savedOnly }) }),
109
109
  i18n(Keyset.ActionSavedOnly)))) : null)));
110
110
  };
@@ -4,7 +4,7 @@ import { QAProps } from '../../../models/common';
4
4
  import '../PostInfo.css';
5
5
  type SaveProps = QAProps & {
6
6
  title: string | number;
7
- postId: number;
7
+ postId: number | string;
8
8
  hasUserLike: boolean;
9
9
  handleUserLike: () => void;
10
10
  theme?: 'light' | 'dark';
@@ -36,13 +36,15 @@ export const Search = ({ className, initialValue, onSubmit, debounce = 300, plac
36
36
  const iconData = value ? Close : SearchIcon;
37
37
  const iconSize = value ? CLOSE_ICON_SIZE : SEARCH_ICON_SIZE;
38
38
  const handleClick = () => {
39
+ var _a;
39
40
  if (value) {
40
41
  handleChange.cancel();
41
42
  setValue('');
42
43
  onSubmit('');
44
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
43
45
  }
44
46
  };
45
- return (React.createElement("button", { className: b('input-icon'), onClick: handleClick, "aria-label": i18n(Keyset.SearchAction) },
47
+ return (React.createElement("button", { className: b('input-icon'), onClick: handleClick, "aria-label": value ? i18n(Keyset.ClearAction) : undefined, "aria-hidden": !value },
46
48
  React.createElement(Icon, { size: iconSize, data: iconData })));
47
49
  }, [handleChange, onSubmit, value]);
48
50
  return (React.createElement("div", { className: b({ size }, className) },
@@ -2,7 +2,7 @@ import { ToggleLikeCallbackType } from '../models/common';
2
2
  type UseLikesProps = {
3
3
  hasLike?: boolean;
4
4
  count?: number;
5
- postId?: number;
5
+ postId?: number | string;
6
6
  toggleLikeCallback?: ToggleLikeCallbackType;
7
7
  };
8
8
  type UseLikeData = {
@@ -19,6 +19,6 @@ export declare enum Keyset {
19
19
  PromptSignInOnLike = "prompt_sign_in_on_like",
20
20
  SignIn = "Sign In",
21
21
  Save = "save",
22
- SearchAction = "search_action"
22
+ ClearAction = "clear_action"
23
23
  }
24
24
  export declare const i18n: (key: Keyset, params?: import("@gravity-ui/i18n").Params | undefined) => string;
@@ -22,7 +22,7 @@ export var Keyset;
22
22
  Keyset["PromptSignInOnLike"] = "prompt_sign_in_on_like";
23
23
  Keyset["SignIn"] = "Sign In";
24
24
  Keyset["Save"] = "save";
25
- Keyset["SearchAction"] = "search_action";
25
+ Keyset["ClearAction"] = "clear_action";
26
26
  })(Keyset || (Keyset = {}));
27
27
  const en = {
28
28
  [Keyset.Title]: 'Blog',
@@ -49,7 +49,7 @@ const en = {
49
49
  ],
50
50
  [Keyset.SignIn]: 'Sign In',
51
51
  [Keyset.Save]: 'Save',
52
- [Keyset.SearchAction]: 'Find',
52
+ [Keyset.ClearAction]: 'Clear',
53
53
  };
54
54
  const ru = {
55
55
  [Keyset.Title]: 'Блог',
@@ -76,6 +76,6 @@ const ru = {
76
76
  ],
77
77
  [Keyset.SignIn]: 'Войти',
78
78
  [Keyset.Save]: 'Сохранить',
79
- [Keyset.SearchAction]: 'Найти',
79
+ [Keyset.ClearAction]: 'Очистить',
80
80
  };
81
81
  export const i18n = addComponentKeysets({ en, ru }, NAMESPACE);
@@ -3,7 +3,7 @@ import { ContentBlockProps, FormBlockData, HeaderBlockProps, MediaProps as PCMed
3
3
  import { BlockType, ClassNameProps, PostData, QAProps } from './common';
4
4
  import { PaddingsYFMProps } from './paddings';
5
5
  export type AuthorProps = ClassNameProps & {
6
- authorId: number;
6
+ authorId: number | string;
7
7
  image: string;
8
8
  } & PaddingsYFMProps & QAProps;
9
9
  export type BannerProps = ContentBlockProps & QAProps & {
@@ -11,7 +11,7 @@ export interface ClassNameProps {
11
11
  className?: string;
12
12
  }
13
13
  export type Author = {
14
- id: number;
14
+ id: number | string;
15
15
  avatar: string | null;
16
16
  createdAt: string;
17
17
  updatedAt: string;
@@ -24,7 +24,7 @@ export type Author = {
24
24
  [x: string]: string | null;
25
25
  };
26
26
  export type Service = {
27
- id: number;
27
+ id: number | string;
28
28
  slug: string;
29
29
  name: string;
30
30
  } & {
@@ -53,13 +53,13 @@ export type Tag = {
53
53
  icon?: string;
54
54
  isDeleted?: boolean;
55
55
  locale?: string;
56
- blogTagId?: number;
56
+ blogTagId?: number | string;
57
57
  count?: number;
58
58
  };
59
59
  export interface PostData {
60
60
  author?: string;
61
61
  authors?: Author[];
62
- blogPostId?: number;
62
+ blogPostId?: number | string;
63
63
  content?: string;
64
64
  date: string;
65
65
  description?: string;
@@ -130,7 +130,7 @@ export interface PostMetaProps {
130
130
  organization: MetaOrganizationType;
131
131
  }
132
132
  export type ToggleLikeCallbackType = ({ postId, hasLike, }: {
133
- postId?: number;
133
+ postId?: number | string;
134
134
  hasLike?: boolean;
135
135
  }) => void;
136
136
  export interface HeaderBlockProps extends PageConstructorHeaderBlockProps {
@@ -15,7 +15,7 @@ export declare const getPageSearchParams: (query?: Query) => URLSearchParams;
15
15
  export declare const scrollToHash: (hash: string, browser?: string) => void;
16
16
  type CloudListTagStub = {};
17
17
  export declare const getTags: ((tags: Tag[], blogPath: string) => CloudListTagStub[]) & import("lodash").MemoizedFunction;
18
- export declare const postLikeStatus: import("lodash").DebouncedFunc<(postId: number, hasUserLike: boolean) => void>;
18
+ export declare const postLikeStatus: import("lodash").DebouncedFunc<(postId: number | string, hasUserLike: boolean) => void>;
19
19
  export declare const updateContentSizes: ({ size, colSizes, theme, ...contentData }: ContentBlockProps) => {
20
20
  size: import("@gravity-ui/page-constructor").ContentSize;
21
21
  colSizes: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/blog-constructor",
3
- "version": "6.4.0",
3
+ "version": "6.4.2",
4
4
  "description": "Gravity UI Blog Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -3,7 +3,7 @@ import { ContentBlockProps, FormBlockData, HeaderBlockProps, MediaProps as PCMed
3
3
  import { BlockType, ClassNameProps, PostData, QAProps } from './common';
4
4
  import { PaddingsYFMProps } from './paddings';
5
5
  export type AuthorProps = ClassNameProps & {
6
- authorId: number;
6
+ authorId: number | string;
7
7
  image: string;
8
8
  } & PaddingsYFMProps & QAProps;
9
9
  export type BannerProps = ContentBlockProps & QAProps & {
@@ -11,7 +11,7 @@ export interface ClassNameProps {
11
11
  className?: string;
12
12
  }
13
13
  export type Author = {
14
- id: number;
14
+ id: number | string;
15
15
  avatar: string | null;
16
16
  createdAt: string;
17
17
  updatedAt: string;
@@ -24,7 +24,7 @@ export type Author = {
24
24
  [x: string]: string | null;
25
25
  };
26
26
  export type Service = {
27
- id: number;
27
+ id: number | string;
28
28
  slug: string;
29
29
  name: string;
30
30
  } & {
@@ -53,13 +53,13 @@ export type Tag = {
53
53
  icon?: string;
54
54
  isDeleted?: boolean;
55
55
  locale?: string;
56
- blogTagId?: number;
56
+ blogTagId?: number | string;
57
57
  count?: number;
58
58
  };
59
59
  export interface PostData {
60
60
  author?: string;
61
61
  authors?: Author[];
62
- blogPostId?: number;
62
+ blogPostId?: number | string;
63
63
  content?: string;
64
64
  date: string;
65
65
  description?: string;
@@ -130,7 +130,7 @@ export interface PostMetaProps {
130
130
  organization: MetaOrganizationType;
131
131
  }
132
132
  export type ToggleLikeCallbackType = ({ postId, hasLike, }: {
133
- postId?: number;
133
+ postId?: number | string;
134
134
  hasLike?: boolean;
135
135
  }) => void;
136
136
  export interface HeaderBlockProps extends PageConstructorHeaderBlockProps {