@gravity-ui/page-constructor 4.15.3 → 4.17.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 (45) hide show
  1. package/build/cjs/blocks/CardLayout/CardLayout.js +2 -2
  2. package/build/cjs/components/CardBase/CardBase.d.ts +1 -0
  3. package/build/cjs/components/CardBase/CardBase.js +2 -2
  4. package/build/cjs/components/FileLink/FileLink.js +2 -2
  5. package/build/cjs/components/Link/Link.js +2 -2
  6. package/build/cjs/components/Title/TitleItem.js +3 -3
  7. package/build/cjs/constructor-items.d.ts +1 -1
  8. package/build/cjs/models/constructor-items/blocks.d.ts +1 -0
  9. package/build/cjs/models/constructor-items/common.d.ts +3 -0
  10. package/build/cjs/models/constructor-items/sub-blocks.d.ts +1 -0
  11. package/build/cjs/models/navigation.d.ts +3 -0
  12. package/build/cjs/navigation/components/NavigationItem/components/GithubButton/GithubButton.d.ts +1 -1
  13. package/build/cjs/navigation/components/NavigationItem/components/GithubButton/GithubButton.js +2 -2
  14. package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js +3 -3
  15. package/build/cjs/navigation/components/SocialIcon/SocialIcon.js +2 -2
  16. package/build/cjs/navigation/utils.d.ts +1 -0
  17. package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +2 -2
  18. package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +1 -0
  19. package/build/cjs/text-transform/config.d.ts +1 -0
  20. package/build/esm/blocks/CardLayout/CardLayout.js +2 -2
  21. package/build/esm/components/CardBase/CardBase.d.ts +1 -0
  22. package/build/esm/components/CardBase/CardBase.js +2 -2
  23. package/build/esm/components/FileLink/FileLink.js +2 -2
  24. package/build/esm/components/Link/Link.js +2 -2
  25. package/build/esm/components/Title/TitleItem.js +3 -3
  26. package/build/esm/constructor-items.d.ts +1 -1
  27. package/build/esm/models/constructor-items/blocks.d.ts +1 -0
  28. package/build/esm/models/constructor-items/common.d.ts +3 -0
  29. package/build/esm/models/constructor-items/sub-blocks.d.ts +1 -0
  30. package/build/esm/models/navigation.d.ts +3 -0
  31. package/build/esm/navigation/components/NavigationItem/components/GithubButton/GithubButton.d.ts +1 -1
  32. package/build/esm/navigation/components/NavigationItem/components/GithubButton/GithubButton.js +2 -2
  33. package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js +3 -3
  34. package/build/esm/navigation/components/SocialIcon/SocialIcon.js +2 -2
  35. package/build/esm/navigation/utils.d.ts +1 -0
  36. package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +2 -2
  37. package/build/esm/sub-blocks/LayoutItem/utils.d.ts +1 -0
  38. package/build/esm/text-transform/config.d.ts +1 -0
  39. package/package.json +1 -1
  40. package/server/models/constructor-items/blocks.d.ts +1 -0
  41. package/server/models/constructor-items/common.d.ts +3 -0
  42. package/server/models/constructor-items/sub-blocks.d.ts +1 -0
  43. package/server/models/navigation.d.ts +3 -0
  44. package/server/text-transform/config.d.ts +1 -0
  45. package/widget/index.js +1 -1
@@ -11,7 +11,7 @@ const DEFAULT_SIZES = {
11
11
  md: 4,
12
12
  };
13
13
  const b = (0, utils_1.block)('card-layout-block');
14
- const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, className, }) => (react_1.default.createElement(components_1.AnimateBlock, { className: b(null, className), animate: animated },
15
- (title || description) && react_1.default.createElement(components_1.Title, { title: title, subtitle: description }),
14
+ const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, className, titleClassName, }) => (react_1.default.createElement(components_1.AnimateBlock, { className: b(null, className), animate: animated },
15
+ (title || description) && (react_1.default.createElement(components_1.Title, { title: title, subtitle: description, className: titleClassName })),
16
16
  react_1.default.createElement(grid_1.Row, null, react_1.default.Children.map(children, (child, index) => (react_1.default.createElement(grid_1.Col, { key: index, sizes: colSizes, className: b('item') }, child))))));
17
17
  exports.default = CardLayout;
@@ -7,6 +7,7 @@ export interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams {
7
7
  contentClassName?: string;
8
8
  children: ReactElement | ReactElement[];
9
9
  url?: string;
10
+ urlTitle?: string;
10
11
  target?: HTMLAttributeAnchorTarget;
11
12
  metrikaGoals?: MetrikaGoal;
12
13
  pixelEvents?: ButtonPixel;
@@ -14,7 +14,7 @@ const Header = () => null;
14
14
  const Content = () => null;
15
15
  const Footer = () => null;
16
16
  const Layout = (props) => {
17
- const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', qa, } = props;
17
+ const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', urlTitle, qa, } = props;
18
18
  const handleMetrika = (0, useMetrika_1.useMetrika)();
19
19
  const handleAnalytics = (0, hooks_1.useAnalytics)(common_1.DefaultEventNames.CardBase, url);
20
20
  let header, content, footer, image, headerClass, footerClass;
@@ -53,7 +53,7 @@ const Layout = (props) => {
53
53
  handleAnalytics(analyticsEvents);
54
54
  };
55
55
  return url ? (react_1.default.createElement(RouterLink_1.default, { href: url },
56
- react_1.default.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick, "data-qa": qa }, cardContent))) : (react_1.default.createElement("div", { className: fullClassName, "data-qa": qa }, cardContent));
56
+ react_1.default.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick, title: urlTitle, "data-qa": qa }, cardContent))) : (react_1.default.createElement("div", { className: fullClassName, "data-qa": qa }, cardContent));
57
57
  };
58
58
  exports.Layout = Layout;
59
59
  exports.Layout.Header = Header;
@@ -41,13 +41,13 @@ const LabelSizeMap = {
41
41
  };
42
42
  const FileLink = (props) => {
43
43
  const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
44
- const { href, text, type = 'vertical', textSize = 'm', className, theme = 'default', onClick, tabIndex, } = props;
44
+ const { href, text, type = 'vertical', textSize = 'm', className, theme = 'default', onClick, tabIndex, urlTitle, } = props;
45
45
  const fileExt = getFileExt(href);
46
46
  const labelTheme = (FileExtensionThemes[fileExt] || 'unknown');
47
47
  const labelSize = LabelSizeMap[textSize];
48
48
  return (react_1.default.createElement("div", { className: b({ ext: fileExt, type, size: textSize, theme }, className) },
49
49
  react_1.default.createElement(uikit_1.Label, { className: b('file-label'), size: labelSize, theme: labelTheme }, fileExt),
50
50
  react_1.default.createElement("div", { className: b('link') },
51
- react_1.default.createElement("a", Object.assign({ href: href, onClick: onClick, tabIndex: tabIndex }, (0, utils_1.getLinkProps)(href, hostname)), text))));
51
+ react_1.default.createElement("a", Object.assign({ href: href, onClick: onClick, tabIndex: tabIndex, title: urlTitle }, (0, utils_1.getLinkProps)(href, hostname)), text))));
52
52
  };
53
53
  exports.default = FileLink;
@@ -28,7 +28,7 @@ function getArrowSize(size) {
28
28
  }
29
29
  }
30
30
  const LinkBlock = (props) => {
31
- const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, tabIndex, qa, } = props;
31
+ const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, tabIndex, qa, urlTitle, } = props;
32
32
  const qaAttributes = (0, index_1.getQaAttrubutes)(qa, ['normal']);
33
33
  const handleMetrika = (0, useMetrika_1.useMetrika)();
34
34
  const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.Link, url);
@@ -50,7 +50,7 @@ const LinkBlock = (props) => {
50
50
  case 'normal': {
51
51
  const linkProps = (0, utils_1.getLinkProps)(url, hostname, target);
52
52
  const content = children || text;
53
- return (react_1.default.createElement("a", Object.assign({ className: b('link', { theme: colorTheme, 'has-arrow': arrow }), href: href, onClick: onClick, tabIndex: tabIndex }, linkProps, { "data-qa": qaAttributes.normal }), arrow ? (react_1.default.createElement(react_1.Fragment, null,
53
+ return (react_1.default.createElement("a", Object.assign({ className: b('link', { theme: colorTheme, 'has-arrow': arrow }), href: href, onClick: onClick, tabIndex: tabIndex, title: urlTitle }, linkProps, { "data-qa": qaAttributes.normal }), arrow ? (react_1.default.createElement(react_1.Fragment, null,
54
54
  react_1.default.createElement("span", { className: b('content') }, content),
55
55
  WORD_JOINER_SYM,
56
56
  react_1.default.createElement(uikit_1.Icon, { className: b('arrow'), data: icons_1.Chevron, size: getArrowSize(textSize) }))) : (content)));
@@ -26,7 +26,7 @@ function getArrowSize(size, isMobile) {
26
26
  exports.getArrowSize = getArrowSize;
27
27
  const TitleItem = (props) => {
28
28
  const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
29
- const { textSize = 'm', text, anchor, justify, url, onClick, custom, className, qa, resetMargin = true, } = props;
29
+ const { textSize = 'm', text, anchor, justify, url, onClick, custom, className, qa, resetMargin = true, urlTitle, } = props;
30
30
  const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
31
31
  const textMarkup = (react_1.default.createElement(react_1.default.Fragment, null,
32
32
  react_1.default.createElement(__1.HTML, { className: b('text') }, text),
@@ -42,10 +42,10 @@ const TitleItem = (props) => {
42
42
  content = textMarkup;
43
43
  }
44
44
  else if (url) {
45
- content = (react_1.default.createElement("a", Object.assign({ className: b('link'), href: url }, (0, utils_1.getLinkProps)(url, hostname), { onClick: onClick }), insideClickableContent));
45
+ content = (react_1.default.createElement("a", Object.assign({ className: b('link'), href: url }, (0, utils_1.getLinkProps)(url, hostname), { onClick: onClick, title: urlTitle }), insideClickableContent));
46
46
  }
47
47
  else if (onClick) {
48
- content = (react_1.default.createElement("span", { className: b('link'), onClick: onClick }, insideClickableContent));
48
+ content = (react_1.default.createElement("span", { className: b('link'), onClick: onClick, title: urlTitle }, insideClickableContent));
49
49
  }
50
50
  return (react_1.default.createElement(react_1.Fragment, null,
51
51
  anchor && react_1.default.createElement(Anchor_1.default, { id: anchor, className: b('anchor') }),
@@ -34,5 +34,5 @@ export declare const navItemMap: {
34
34
  social: import("react").FC<import("./navigation/components/SocialIcon/SocialIcon").NavigationSocialItemOwnProps>;
35
35
  dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("./navigation/models").NavigationItemProps & import("./models").NavigationDropdownItem) => JSX.Element;
36
36
  link: import("react").FC<import("./navigation/models").NavigationItemProps & import("./models").NavigationLinkItem>;
37
- "github-button": ({ text, url, className, label, size, icon, }: import("./navigation/models").NavigationItemProps & import("./models").NavigationGithubButton) => JSX.Element;
37
+ "github-button": ({ text, url, className, label, size, icon, urlTitle, }: import("./navigation/models").NavigationItemProps & import("./models").NavigationGithubButton) => JSX.Element;
38
38
  };
@@ -221,6 +221,7 @@ export interface TabsBlockProps extends Animatable {
221
221
  }
222
222
  export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
223
223
  title?: TitleItemProps | string;
224
+ titleClassName?: string;
224
225
  description?: string;
225
226
  colSizes?: GridColumnSizesType;
226
227
  }
@@ -120,6 +120,7 @@ export interface MediaVideoProps extends AnalyticsEventsBase {
120
120
  }
121
121
  export interface LinkProps extends AnalyticsEventsBase, Stylable, Tabbable {
122
122
  url: string;
123
+ urlTitle?: string;
123
124
  text?: string;
124
125
  textSize?: TextSize;
125
126
  theme?: LinkTheme;
@@ -135,6 +136,7 @@ export interface FileLinkProps extends ClassNameProps, Tabbable {
135
136
  type?: FileLinkType;
136
137
  textSize?: TextSize;
137
138
  theme?: ContentTheme;
139
+ urlTitle?: string;
138
140
  onClick?: () => void;
139
141
  }
140
142
  export type ButtonTheme = ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
@@ -260,6 +262,7 @@ export interface TitleItemBaseProps {
260
262
  text: string;
261
263
  textSize?: TextSize;
262
264
  url?: string;
265
+ urlTitle?: string;
263
266
  custom?: string | ReactNode;
264
267
  onClick?: () => void;
265
268
  }
@@ -73,6 +73,7 @@ export interface QuoteProps extends Themable, CardBaseProps {
73
73
  }
74
74
  export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
75
75
  url?: string;
76
+ urlTitle?: string;
76
77
  background?: ThemeSupporting<ImageObjectProps>;
77
78
  paddingBottom?: 's' | 'm' | 'l' | 'xl';
78
79
  backgroundColor?: string;
@@ -29,6 +29,7 @@ export declare enum NavigationGithubButtonIcon {
29
29
  export interface NavigationGithubButton extends Omit<NavigationItemBase, 'icon'> {
30
30
  type: NavigationItemType.GithubButton;
31
31
  url: string;
32
+ urlTitle?: string;
32
33
  label?: string;
33
34
  icon?: keyof typeof NavigationGithubButtonIcon;
34
35
  size?: string;
@@ -36,6 +37,7 @@ export interface NavigationGithubButton extends Omit<NavigationItemBase, 'icon'>
36
37
  export interface NavigationLinkItem extends Omit<NavigationItemBase, 'url'> {
37
38
  type: NavigationItemType.Link;
38
39
  url: string;
40
+ urlTitle?: string;
39
41
  arrow?: boolean;
40
42
  target?: string;
41
43
  }
@@ -52,6 +54,7 @@ export interface NavigationSocialItem extends Omit<NavigationItemBase, 'text'> {
52
54
  type: NavigationItemType.Social;
53
55
  icon: ImageProps;
54
56
  url: string;
57
+ urlTitle?: string;
55
58
  }
56
59
  export type NavigationItemModel = NavigationLinkItem | NavigationButtonItem | NavigationDropdownItem;
57
60
  export type NavigationItemData = NavigationLinkItem | NavigationButtonItem | NavigationSocialItem | NavigationDropdownItem;
@@ -1,5 +1,5 @@
1
1
  import { NavigationGithubButton } from '../../../../../models';
2
2
  import { NavigationItemProps } from '../../../../models';
3
3
  type NavigationGithubButtonProps = NavigationItemProps & NavigationGithubButton;
4
- export declare const GithubButton: ({ text, url, className, label, size, icon, }: NavigationGithubButtonProps) => JSX.Element;
4
+ export declare const GithubButton: ({ text, url, className, label, size, icon, urlTitle, }: NavigationGithubButtonProps) => JSX.Element;
5
5
  export {};
@@ -8,7 +8,7 @@ const utils_1 = require("../../../../../utils");
8
8
  const b = (0, utils_1.block)('github-button');
9
9
  const DEFAULT_LABEL = 'Stars on GitHub';
10
10
  /* More information about github-buttons in https://buttons.github.io/ */
11
- const GithubButton = ({ text, url, className, label, size, icon, }) => {
11
+ const GithubButton = ({ text, url, className, label, size, icon, urlTitle, }) => {
12
12
  const containerRef = (0, react_1.useRef)(null);
13
13
  const linkRef = (0, react_1.useRef)(null);
14
14
  (0, react_1.useEffect)(() => {
@@ -42,6 +42,6 @@ const GithubButton = ({ text, url, className, label, size, icon, }) => {
42
42
  }, []);
43
43
  return (react_1.default.createElement("div", { className: b(null, className) },
44
44
  react_1.default.createElement("span", { ref: containerRef },
45
- react_1.default.createElement("a", Object.assign({ href: url, ref: linkRef, "data-show-count": "true", "aria-label": label || DEFAULT_LABEL }, (icon && { 'data-icon': models_1.NavigationGithubButtonIcon[icon] }), (size && { 'data-size': size })), text))));
45
+ react_1.default.createElement("a", Object.assign({ href: url, ref: linkRef, title: urlTitle, "data-show-count": "true", "aria-label": label || DEFAULT_LABEL }, (icon && { 'data-icon': models_1.NavigationGithubButtonIcon[icon] }), (size && { 'data-size': size })), text))));
46
46
  };
47
47
  exports.GithubButton = GithubButton;
@@ -12,7 +12,7 @@ const ContentWrapper_1 = require("../ContentWrapper/ContentWrapper");
12
12
  const b = (0, utils_2.block)('navigation-link');
13
13
  const NavigationLink = (props) => {
14
14
  const { hostname, Link } = (0, react_1.useContext)(locationContext_1.LocationContext);
15
- const { url, text, icon, arrow, target, className, iconSize } = props, rest = tslib_1.__rest(props, ["url", "text", "icon", "arrow", "target", "className", "iconSize"]);
15
+ const { url, text, icon, arrow, target, className, iconSize, urlTitle } = props, rest = tslib_1.__rest(props, ["url", "text", "icon", "arrow", "target", "className", "iconSize", "urlTitle"]);
16
16
  const linkExtraProps = (0, utils_2.getLinkProps)(url, hostname, target);
17
17
  const iconData = icon && (0, utils_1.getMediaImage)(icon);
18
18
  const classes = b(null, className);
@@ -20,11 +20,11 @@ const NavigationLink = (props) => {
20
20
  react_1.default.createElement(ContentWrapper_1.ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }),
21
21
  arrow && react_1.default.createElement(icons_1.NavigationArrow, { className: b('arrow') })));
22
22
  if ((linkExtraProps === null || linkExtraProps === void 0 ? void 0 : linkExtraProps.target) || !Link) {
23
- return (react_1.default.createElement("a", Object.assign({ href: url, title: text, className: classes }, rest, linkExtraProps), content));
23
+ return (react_1.default.createElement("a", Object.assign({ href: url, title: urlTitle || text, className: classes }, rest, linkExtraProps), content));
24
24
  }
25
25
  else {
26
26
  return (react_1.default.createElement(components_1.RouterLink, { href: url, passHref: true },
27
- react_1.default.createElement("a", Object.assign({ title: text }, rest, { className: classes }), content)));
27
+ react_1.default.createElement("a", Object.assign({ title: urlTitle || text }, rest, { className: classes }), content)));
28
28
  }
29
29
  };
30
30
  exports.NavigationLink = NavigationLink;
@@ -6,10 +6,10 @@ const components_1 = require("../../../components");
6
6
  const utils_1 = require("../../../components/Media/Image/utils");
7
7
  const utils_2 = require("../../../utils");
8
8
  const b = (0, utils_2.block)('social-icon');
9
- const SocialIcon = ({ icon, url, className }) => {
9
+ const SocialIcon = ({ icon, url, className, urlTitle }) => {
10
10
  const iconData = (0, utils_1.getMediaImage)(icon);
11
11
  const { alt } = iconData;
12
- return (react_1.default.createElement("a", { href: url, "aria-label": alt, title: alt, target: "_blank", rel: "noopener noreferrer", className: b(null, className) },
12
+ return (react_1.default.createElement("a", { href: url, "aria-label": alt, title: urlTitle || alt, target: "_blank", rel: "noopener noreferrer", className: b(null, className) },
13
13
  react_1.default.createElement(components_1.Image, Object.assign({ className: b('icon') }, iconData))));
14
14
  };
15
15
  exports.default = SocialIcon;
@@ -11,6 +11,7 @@ export declare const getItemClickHandler: ({ column, index, onActiveItemChange,
11
11
  export declare function getNavigationItemWithIconSize(iconSize?: number): (item: NavigationItemModel) => NavigationButtonItem | NavigationDropdownItem | {
12
12
  type: NavigationItemType.Link;
13
13
  url: string;
14
+ urlTitle?: string | undefined;
14
15
  arrow?: boolean | undefined;
15
16
  target?: string | undefined;
16
17
  text: string;
@@ -8,11 +8,11 @@ const utils_1 = require("../../utils");
8
8
  const Content_1 = tslib_1.__importDefault(require("../Content/Content"));
9
9
  const b = (0, utils_1.block)('background-card');
10
10
  const BackgroundCard = (props) => {
11
- const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, } = props;
11
+ const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, urlTitle, } = props;
12
12
  const theme = (0, theme_1.useTheme)();
13
13
  const hasBackgroundColor = backgroundColor || cardTheme !== 'default';
14
14
  const borderType = hasBackgroundColor ? 'none' : border;
15
- return (react_1.default.createElement(components_1.CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), url: url, border: borderType, analyticsEvents: analyticsEvents },
15
+ return (react_1.default.createElement(components_1.CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), url: url, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle },
16
16
  react_1.default.createElement(components_1.CardBase.Content, null,
17
17
  react_1.default.createElement(components_1.BackgroundImage, Object.assign({ className: b('image') }, (0, utils_1.getThemedValue)(background, theme), { style: { backgroundColor } })),
18
18
  react_1.default.createElement(Content_1.default, { title: title, text: text, additionalInfo: additionalInfo, size: "s", theme: cardTheme, links: links, buttons: buttons, colSizes: { all: 12, md: 12 } }))));
@@ -1,6 +1,7 @@
1
1
  import { LayoutItemProps, LinkTheme, MediaProps } from '../../models';
2
2
  export declare const getLayoutItemLinks: (links: LayoutItemProps['content']['links']) => {
3
3
  url: string;
4
+ urlTitle?: string | undefined;
4
5
  text?: string | undefined;
5
6
  textSize?: import("../../models").TextSize | undefined;
6
7
  theme: LinkTheme;
@@ -10,6 +10,7 @@ export declare const blockHeaderTransformer: ({
10
10
  justify?: import("../models").Justify | undefined;
11
11
  textSize?: import("../models").TextSize | undefined;
12
12
  url?: string | undefined;
13
+ urlTitle?: string | undefined;
13
14
  custom?: import("react").ReactNode;
14
15
  onClick?: (() => void) | undefined;
15
16
  };
@@ -9,7 +9,7 @@ const DEFAULT_SIZES = {
9
9
  md: 4,
10
10
  };
11
11
  const b = block('card-layout-block');
12
- const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, className, }) => (React.createElement(AnimateBlock, { className: b(null, className), animate: animated },
13
- (title || description) && React.createElement(Title, { title: title, subtitle: description }),
12
+ const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, className, titleClassName, }) => (React.createElement(AnimateBlock, { className: b(null, className), animate: animated },
13
+ (title || description) && (React.createElement(Title, { title: title, subtitle: description, className: titleClassName })),
14
14
  React.createElement(Row, null, React.Children.map(children, (child, index) => (React.createElement(Col, { key: index, sizes: colSizes, className: b('item') }, child))))));
15
15
  export default CardLayout;
@@ -8,6 +8,7 @@ export interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams {
8
8
  contentClassName?: string;
9
9
  children: ReactElement | ReactElement[];
10
10
  url?: string;
11
+ urlTitle?: string;
11
12
  target?: HTMLAttributeAnchorTarget;
12
13
  metrikaGoals?: MetrikaGoal;
13
14
  pixelEvents?: ButtonPixel;
@@ -11,7 +11,7 @@ const Header = () => null;
11
11
  const Content = () => null;
12
12
  const Footer = () => null;
13
13
  export const Layout = (props) => {
14
- const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', qa, } = props;
14
+ const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', urlTitle, qa, } = props;
15
15
  const handleMetrika = useMetrika();
16
16
  const handleAnalytics = useAnalytics(DefaultEventNames.CardBase, url);
17
17
  let header, content, footer, image, headerClass, footerClass;
@@ -50,7 +50,7 @@ export const Layout = (props) => {
50
50
  handleAnalytics(analyticsEvents);
51
51
  };
52
52
  return url ? (React.createElement(RouterLink, { href: url },
53
- React.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick, "data-qa": qa }, cardContent))) : (React.createElement("div", { className: fullClassName, "data-qa": qa }, cardContent));
53
+ React.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick, title: urlTitle, "data-qa": qa }, cardContent))) : (React.createElement("div", { className: fullClassName, "data-qa": qa }, cardContent));
54
54
  };
55
55
  Layout.Header = Header;
56
56
  Layout.Content = Content;
@@ -37,13 +37,13 @@ const LabelSizeMap = {
37
37
  };
38
38
  const FileLink = (props) => {
39
39
  const { hostname } = useContext(LocationContext);
40
- const { href, text, type = 'vertical', textSize = 'm', className, theme = 'default', onClick, tabIndex, } = props;
40
+ const { href, text, type = 'vertical', textSize = 'm', className, theme = 'default', onClick, tabIndex, urlTitle, } = props;
41
41
  const fileExt = getFileExt(href);
42
42
  const labelTheme = (FileExtensionThemes[fileExt] || 'unknown');
43
43
  const labelSize = LabelSizeMap[textSize];
44
44
  return (React.createElement("div", { className: b({ ext: fileExt, type, size: textSize, theme }, className) },
45
45
  React.createElement(Label, { className: b('file-label'), size: labelSize, theme: labelTheme }, fileExt),
46
46
  React.createElement("div", { className: b('link') },
47
- React.createElement("a", Object.assign({ href: href, onClick: onClick, tabIndex: tabIndex }, getLinkProps(href, hostname)), text))));
47
+ React.createElement("a", Object.assign({ href: href, onClick: onClick, tabIndex: tabIndex, title: urlTitle }, getLinkProps(href, hostname)), text))));
48
48
  };
49
49
  export default FileLink;
@@ -26,7 +26,7 @@ function getArrowSize(size) {
26
26
  }
27
27
  }
28
28
  const LinkBlock = (props) => {
29
- const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, tabIndex, qa, } = props;
29
+ const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, tabIndex, qa, urlTitle, } = props;
30
30
  const qaAttributes = getQaAttrubutes(qa, ['normal']);
31
31
  const handleMetrika = useMetrika();
32
32
  const handleAnalytics = useAnalytics(DefaultEventNames.Link, url);
@@ -48,7 +48,7 @@ const LinkBlock = (props) => {
48
48
  case 'normal': {
49
49
  const linkProps = getLinkProps(url, hostname, target);
50
50
  const content = children || text;
51
- return (React.createElement("a", Object.assign({ className: b('link', { theme: colorTheme, 'has-arrow': arrow }), href: href, onClick: onClick, tabIndex: tabIndex }, linkProps, { "data-qa": qaAttributes.normal }), arrow ? (React.createElement(Fragment, null,
51
+ return (React.createElement("a", Object.assign({ className: b('link', { theme: colorTheme, 'has-arrow': arrow }), href: href, onClick: onClick, tabIndex: tabIndex, title: urlTitle }, linkProps, { "data-qa": qaAttributes.normal }), arrow ? (React.createElement(Fragment, null,
52
52
  React.createElement("span", { className: b('content') }, content),
53
53
  WORD_JOINER_SYM,
54
54
  React.createElement(Icon, { className: b('arrow'), data: Chevron, size: getArrowSize(textSize) }))) : (content)));
@@ -22,7 +22,7 @@ export function getArrowSize(size, isMobile) {
22
22
  }
23
23
  const TitleItem = (props) => {
24
24
  const isMobile = useContext(MobileContext);
25
- const { textSize = 'm', text, anchor, justify, url, onClick, custom, className, qa, resetMargin = true, } = props;
25
+ const { textSize = 'm', text, anchor, justify, url, onClick, custom, className, qa, resetMargin = true, urlTitle, } = props;
26
26
  const { hostname } = useContext(LocationContext);
27
27
  const textMarkup = (React.createElement(React.Fragment, null,
28
28
  React.createElement(HTML, { className: b('text') }, text),
@@ -38,10 +38,10 @@ const TitleItem = (props) => {
38
38
  content = textMarkup;
39
39
  }
40
40
  else if (url) {
41
- content = (React.createElement("a", Object.assign({ className: b('link'), href: url }, getLinkProps(url, hostname), { onClick: onClick }), insideClickableContent));
41
+ content = (React.createElement("a", Object.assign({ className: b('link'), href: url }, getLinkProps(url, hostname), { onClick: onClick, title: urlTitle }), insideClickableContent));
42
42
  }
43
43
  else if (onClick) {
44
- content = (React.createElement("span", { className: b('link'), onClick: onClick }, insideClickableContent));
44
+ content = (React.createElement("span", { className: b('link'), onClick: onClick, title: urlTitle }, insideClickableContent));
45
45
  }
46
46
  return (React.createElement(Fragment, null,
47
47
  anchor && React.createElement(Anchor, { id: anchor, className: b('anchor') }),
@@ -34,5 +34,5 @@ export declare const navItemMap: {
34
34
  social: import("react").FC<import("./navigation/components/SocialIcon/SocialIcon").NavigationSocialItemOwnProps>;
35
35
  dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("./navigation/models").NavigationItemProps & import("./models").NavigationDropdownItem) => JSX.Element;
36
36
  link: import("react").FC<import("./navigation/models").NavigationItemProps & import("./models").NavigationLinkItem>;
37
- "github-button": ({ text, url, className, label, size, icon, }: import("./navigation/models").NavigationItemProps & import("./models").NavigationGithubButton) => JSX.Element;
37
+ "github-button": ({ text, url, className, label, size, icon, urlTitle, }: import("./navigation/models").NavigationItemProps & import("./models").NavigationGithubButton) => JSX.Element;
38
38
  };
@@ -221,6 +221,7 @@ export interface TabsBlockProps extends Animatable {
221
221
  }
222
222
  export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
223
223
  title?: TitleItemProps | string;
224
+ titleClassName?: string;
224
225
  description?: string;
225
226
  colSizes?: GridColumnSizesType;
226
227
  }
@@ -120,6 +120,7 @@ export interface MediaVideoProps extends AnalyticsEventsBase {
120
120
  }
121
121
  export interface LinkProps extends AnalyticsEventsBase, Stylable, Tabbable {
122
122
  url: string;
123
+ urlTitle?: string;
123
124
  text?: string;
124
125
  textSize?: TextSize;
125
126
  theme?: LinkTheme;
@@ -135,6 +136,7 @@ export interface FileLinkProps extends ClassNameProps, Tabbable {
135
136
  type?: FileLinkType;
136
137
  textSize?: TextSize;
137
138
  theme?: ContentTheme;
139
+ urlTitle?: string;
138
140
  onClick?: () => void;
139
141
  }
140
142
  export type ButtonTheme = ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
@@ -260,6 +262,7 @@ export interface TitleItemBaseProps {
260
262
  text: string;
261
263
  textSize?: TextSize;
262
264
  url?: string;
265
+ urlTitle?: string;
263
266
  custom?: string | ReactNode;
264
267
  onClick?: () => void;
265
268
  }
@@ -73,6 +73,7 @@ export interface QuoteProps extends Themable, CardBaseProps {
73
73
  }
74
74
  export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
75
75
  url?: string;
76
+ urlTitle?: string;
76
77
  background?: ThemeSupporting<ImageObjectProps>;
77
78
  paddingBottom?: 's' | 'm' | 'l' | 'xl';
78
79
  backgroundColor?: string;
@@ -29,6 +29,7 @@ export declare enum NavigationGithubButtonIcon {
29
29
  export interface NavigationGithubButton extends Omit<NavigationItemBase, 'icon'> {
30
30
  type: NavigationItemType.GithubButton;
31
31
  url: string;
32
+ urlTitle?: string;
32
33
  label?: string;
33
34
  icon?: keyof typeof NavigationGithubButtonIcon;
34
35
  size?: string;
@@ -36,6 +37,7 @@ export interface NavigationGithubButton extends Omit<NavigationItemBase, 'icon'>
36
37
  export interface NavigationLinkItem extends Omit<NavigationItemBase, 'url'> {
37
38
  type: NavigationItemType.Link;
38
39
  url: string;
40
+ urlTitle?: string;
39
41
  arrow?: boolean;
40
42
  target?: string;
41
43
  }
@@ -52,6 +54,7 @@ export interface NavigationSocialItem extends Omit<NavigationItemBase, 'text'> {
52
54
  type: NavigationItemType.Social;
53
55
  icon: ImageProps;
54
56
  url: string;
57
+ urlTitle?: string;
55
58
  }
56
59
  export type NavigationItemModel = NavigationLinkItem | NavigationButtonItem | NavigationDropdownItem;
57
60
  export type NavigationItemData = NavigationLinkItem | NavigationButtonItem | NavigationSocialItem | NavigationDropdownItem;
@@ -2,5 +2,5 @@ import { NavigationGithubButton } from '../../../../../models';
2
2
  import { NavigationItemProps } from '../../../../models';
3
3
  import './GithubButton.css';
4
4
  type NavigationGithubButtonProps = NavigationItemProps & NavigationGithubButton;
5
- export declare const GithubButton: ({ text, url, className, label, size, icon, }: NavigationGithubButtonProps) => JSX.Element;
5
+ export declare const GithubButton: ({ text, url, className, label, size, icon, urlTitle, }: NavigationGithubButtonProps) => JSX.Element;
6
6
  export {};
@@ -5,7 +5,7 @@ import './GithubButton.css';
5
5
  const b = block('github-button');
6
6
  const DEFAULT_LABEL = 'Stars on GitHub';
7
7
  /* More information about github-buttons in https://buttons.github.io/ */
8
- export const GithubButton = ({ text, url, className, label, size, icon, }) => {
8
+ export const GithubButton = ({ text, url, className, label, size, icon, urlTitle, }) => {
9
9
  const containerRef = useRef(null);
10
10
  const linkRef = useRef(null);
11
11
  useEffect(() => {
@@ -39,5 +39,5 @@ export const GithubButton = ({ text, url, className, label, size, icon, }) => {
39
39
  }, []);
40
40
  return (React.createElement("div", { className: b(null, className) },
41
41
  React.createElement("span", { ref: containerRef },
42
- React.createElement("a", Object.assign({ href: url, ref: linkRef, "data-show-count": "true", "aria-label": label || DEFAULT_LABEL }, (icon && { 'data-icon': NavigationGithubButtonIcon[icon] }), (size && { 'data-size': size })), text))));
42
+ React.createElement("a", Object.assign({ href: url, ref: linkRef, title: urlTitle, "data-show-count": "true", "aria-label": label || DEFAULT_LABEL }, (icon && { 'data-icon': NavigationGithubButtonIcon[icon] }), (size && { 'data-size': size })), text))));
43
43
  };
@@ -10,7 +10,7 @@ import './NavigationLink.css';
10
10
  const b = block('navigation-link');
11
11
  export const NavigationLink = (props) => {
12
12
  const { hostname, Link } = useContext(LocationContext);
13
- const { url, text, icon, arrow, target, className, iconSize } = props, rest = __rest(props, ["url", "text", "icon", "arrow", "target", "className", "iconSize"]);
13
+ const { url, text, icon, arrow, target, className, iconSize, urlTitle } = props, rest = __rest(props, ["url", "text", "icon", "arrow", "target", "className", "iconSize", "urlTitle"]);
14
14
  const linkExtraProps = getLinkProps(url, hostname, target);
15
15
  const iconData = icon && getMediaImage(icon);
16
16
  const classes = b(null, className);
@@ -18,10 +18,10 @@ export const NavigationLink = (props) => {
18
18
  React.createElement(ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }),
19
19
  arrow && React.createElement(NavigationArrow, { className: b('arrow') })));
20
20
  if ((linkExtraProps === null || linkExtraProps === void 0 ? void 0 : linkExtraProps.target) || !Link) {
21
- return (React.createElement("a", Object.assign({ href: url, title: text, className: classes }, rest, linkExtraProps), content));
21
+ return (React.createElement("a", Object.assign({ href: url, title: urlTitle || text, className: classes }, rest, linkExtraProps), content));
22
22
  }
23
23
  else {
24
24
  return (React.createElement(RouterLink, { href: url, passHref: true },
25
- React.createElement("a", Object.assign({ title: text }, rest, { className: classes }), content)));
25
+ React.createElement("a", Object.assign({ title: urlTitle || text }, rest, { className: classes }), content)));
26
26
  }
27
27
  };
@@ -4,10 +4,10 @@ import { getMediaImage } from '../../../components/Media/Image/utils';
4
4
  import { block } from '../../../utils';
5
5
  import './SocialIcon.css';
6
6
  const b = block('social-icon');
7
- const SocialIcon = ({ icon, url, className }) => {
7
+ const SocialIcon = ({ icon, url, className, urlTitle }) => {
8
8
  const iconData = getMediaImage(icon);
9
9
  const { alt } = iconData;
10
- return (React.createElement("a", { href: url, "aria-label": alt, title: alt, target: "_blank", rel: "noopener noreferrer", className: b(null, className) },
10
+ return (React.createElement("a", { href: url, "aria-label": alt, title: urlTitle || alt, target: "_blank", rel: "noopener noreferrer", className: b(null, className) },
11
11
  React.createElement(Image, Object.assign({ className: b('icon') }, iconData))));
12
12
  };
13
13
  export default SocialIcon;
@@ -11,6 +11,7 @@ export declare const getItemClickHandler: ({ column, index, onActiveItemChange,
11
11
  export declare function getNavigationItemWithIconSize(iconSize?: number): (item: NavigationItemModel) => NavigationButtonItem | NavigationDropdownItem | {
12
12
  type: NavigationItemType.Link;
13
13
  url: string;
14
+ urlTitle?: string | undefined;
14
15
  arrow?: boolean | undefined;
15
16
  target?: string | undefined;
16
17
  text: string;
@@ -6,11 +6,11 @@ import Content from '../Content/Content';
6
6
  import './BackgroundCard.css';
7
7
  const b = block('background-card');
8
8
  const BackgroundCard = (props) => {
9
- const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, } = props;
9
+ const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, urlTitle, } = props;
10
10
  const theme = useTheme();
11
11
  const hasBackgroundColor = backgroundColor || cardTheme !== 'default';
12
12
  const borderType = hasBackgroundColor ? 'none' : border;
13
- return (React.createElement(CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), url: url, border: borderType, analyticsEvents: analyticsEvents },
13
+ return (React.createElement(CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), url: url, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle },
14
14
  React.createElement(CardBase.Content, null,
15
15
  React.createElement(BackgroundImage, Object.assign({ className: b('image') }, getThemedValue(background, theme), { style: { backgroundColor } })),
16
16
  React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, size: "s", theme: cardTheme, links: links, buttons: buttons, colSizes: { all: 12, md: 12 } }))));
@@ -1,6 +1,7 @@
1
1
  import { LayoutItemProps, LinkTheme, MediaProps } from '../../models';
2
2
  export declare const getLayoutItemLinks: (links: LayoutItemProps['content']['links']) => {
3
3
  url: string;
4
+ urlTitle?: string | undefined;
4
5
  text?: string | undefined;
5
6
  textSize?: import("../../models").TextSize | undefined;
6
7
  theme: LinkTheme;
@@ -10,6 +10,7 @@ export declare const blockHeaderTransformer: ({
10
10
  justify?: import("../models").Justify | undefined;
11
11
  textSize?: import("../models").TextSize | undefined;
12
12
  url?: string | undefined;
13
+ urlTitle?: string | undefined;
13
14
  custom?: import("react").ReactNode;
14
15
  onClick?: (() => void) | undefined;
15
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "4.15.3",
3
+ "version": "4.17.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -221,6 +221,7 @@ export interface TabsBlockProps extends Animatable {
221
221
  }
222
222
  export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
223
223
  title?: TitleItemProps | string;
224
+ titleClassName?: string;
224
225
  description?: string;
225
226
  colSizes?: GridColumnSizesType;
226
227
  }
@@ -120,6 +120,7 @@ export interface MediaVideoProps extends AnalyticsEventsBase {
120
120
  }
121
121
  export interface LinkProps extends AnalyticsEventsBase, Stylable, Tabbable {
122
122
  url: string;
123
+ urlTitle?: string;
123
124
  text?: string;
124
125
  textSize?: TextSize;
125
126
  theme?: LinkTheme;
@@ -135,6 +136,7 @@ export interface FileLinkProps extends ClassNameProps, Tabbable {
135
136
  type?: FileLinkType;
136
137
  textSize?: TextSize;
137
138
  theme?: ContentTheme;
139
+ urlTitle?: string;
138
140
  onClick?: () => void;
139
141
  }
140
142
  export type ButtonTheme = ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
@@ -260,6 +262,7 @@ export interface TitleItemBaseProps {
260
262
  text: string;
261
263
  textSize?: TextSize;
262
264
  url?: string;
265
+ urlTitle?: string;
263
266
  custom?: string | ReactNode;
264
267
  onClick?: () => void;
265
268
  }