@cloud-ru/uikit-product-site-banner 2.0.32 → 2.0.33-preview-e3701f2e.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.
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BannerSecondary = BannerSecondary;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const BannerCommon_1 = require("../../helperComponents/BannerCommon");
6
- const IMAGE_SIZE = [303, 208];
6
+ const IMAGE_PADDING = 8;
7
+ const IMAGE_SIZE = [303 - IMAGE_PADDING * 2, 208 - IMAGE_PADDING * 2];
7
8
  const getGapValue = (layouType) => (layouType === 'tablet' ? 32 : 24);
8
9
  function BannerSecondary(props) {
9
- return ((0, jsx_runtime_1.jsx)(BannerCommon_1.BannerCommon, Object.assign({ topSlot: null, sizes: { image: IMAGE_SIZE, mainGap: getGapValue(props.layoutType) } }, props)));
10
+ return ((0, jsx_runtime_1.jsx)(BannerCommon_1.BannerCommon, Object.assign({ topSlot: null, sizes: { image: IMAGE_SIZE, mainGap: getGapValue(props.layoutType), imagePadding: IMAGE_PADDING } }, props)));
10
11
  }
@@ -26,6 +26,8 @@ export type BannerCommonProps = WithSupportProps<WithLayoutType<{
26
26
  image: [number, number];
27
27
  /** Отступ между текстом и кнопками */
28
28
  mainGap: number;
29
+ /** Отступ вокруг картинки */
30
+ imagePadding?: number;
29
31
  };
30
32
  } & ColorWrapperProps>>;
31
- export declare function BannerCommon({ id, title, description, img, erid, buttons, layoutType, className, topSlot, sizes: { image: [maxImageWith, maxImageHeight], mainGap, }, ...rest }: BannerCommonProps): import("react/jsx-runtime").JSX.Element;
33
+ export declare function BannerCommon({ id, title, description, img, erid, buttons, layoutType, className, topSlot, sizes: { image: [maxImageWith, maxImageHeight], mainGap, imagePadding, }, ...rest }: BannerCommonProps): import("react/jsx-runtime").JSX.Element;
@@ -25,10 +25,11 @@ const ColorWrapper_1 = require("../ColorWrapper");
25
25
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
26
26
  const util_1 = require("./util");
27
27
  function BannerCommon(_a) {
28
- var { id, title, description, img, erid, buttons, layoutType, className, topSlot, sizes: { image: [maxImageWith, maxImageHeight], mainGap, } } = _a, rest = __rest(_a, ["id", "title", "description", "img", "erid", "buttons", "layoutType", "className", "topSlot", "sizes"]);
28
+ var { id, title, description, img, erid, buttons, layoutType, className, topSlot, sizes: { image: [maxImageWith, maxImageHeight], mainGap, imagePadding = 0, } } = _a, rest = __rest(_a, ["id", "title", "description", "img", "erid", "buttons", "layoutType", "className", "topSlot", "sizes"]);
29
29
  return ((0, jsx_runtime_1.jsxs)(ColorWrapper_1.ColorWrapper, Object.assign({ id: id, className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "data-layout-type": layoutType, style: {
30
30
  '--site-banner-main-gap': `${mainGap}px`,
31
31
  '--site-banner-image-max-width': `${maxImageWith}px`,
32
32
  '--site-banner-image-max-height': `${maxImageHeight}px`,
33
+ '--site-banner-image-padding': `${imagePadding}px`,
33
34
  } }, rest, { children: [erid && (0, jsx_runtime_1.jsx)(uikit_product_site_tag_1.Erid, { className: styles_module_scss_1.default.erid, tip: erid.tip, appearance: erid.appearance }), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.content, children: [topSlot, (0, jsx_runtime_1.jsxs)("div", { "data-color-wrapper-role": 'text', className: styles_module_scss_1.default.text, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, Object.assign({ className: styles_module_scss_1.default.title, family: 'sans' }, (0, util_1.getBlockTitleProps)(layoutType), { children: (0, jsx_runtime_1.jsx)(uikit_product_site_rich_text_1.RichText, { richText: title }) })), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyL, { className: styles_module_scss_1.default.description, children: (0, jsx_runtime_1.jsx)(uikit_product_site_rich_text_1.RichText, { richText: description }) })] }), buttons && buttons.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.buttons, children: [(0, jsx_runtime_1.jsx)(uikit_product_button_predefined_1.ButtonPromo, Object.assign({ className: styles_module_scss_1.default.button, target: '_self' }, buttons[0], { size: 'l', appearance: ColorWrapper_1.ColorWrapper.getButtonAppearance(rest.appearance) })), (buttons === null || buttons === void 0 ? void 0 : buttons.length) > 1 && ((0, jsx_runtime_1.jsx)(uikit_product_button_predefined_1.ButtonPromoOutline, Object.assign({ className: styles_module_scss_1.default.button, target: '_self' }, buttons[1], { size: 'l', appearance: ColorWrapper_1.ColorWrapper.getButtonAppearance(rest.appearance) })))] }))] }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.imgWrapper, children: (0, jsx_runtime_1.jsx)("img", { className: styles_module_scss_1.default.img, src: img, alt: title }) })] })));
34
35
  }
@@ -20,13 +20,14 @@
20
20
  max-width:var(--site-banner-image-max-width);
21
21
  max-height:var(--site-banner-image-max-height);
22
22
  flex-shrink:0;
23
- border-radius:4px;
24
23
  }
25
24
  .imgWrapper{
25
+ box-sizing:border-box;
26
26
  width:100%;
27
27
  display:flex;
28
28
  justify-content:center;
29
29
  align-items:center;
30
+ padding:var(--site-banner-image-padding);
30
31
  }
31
32
 
32
33
  .erid{
@@ -48,7 +49,7 @@
48
49
  .root{
49
50
  position:relative;
50
51
  display:grid;
51
- grid-template-columns:1fr var(--site-banner-image-max-width);
52
+ grid-template-columns:1fr calc(var(--site-banner-image-max-width) + var(--site-banner-image-padding) * 2);
52
53
  }
53
54
  .root[data-layout-type=tablet]{
54
55
  display:flex;
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { BannerCommon } from '../../helperComponents/BannerCommon';
3
- const IMAGE_SIZE = [303, 208];
3
+ const IMAGE_PADDING = 8;
4
+ const IMAGE_SIZE = [303 - IMAGE_PADDING * 2, 208 - IMAGE_PADDING * 2];
4
5
  const getGapValue = (layouType) => (layouType === 'tablet' ? 32 : 24);
5
6
  export function BannerSecondary(props) {
6
- return (_jsx(BannerCommon, Object.assign({ topSlot: null, sizes: { image: IMAGE_SIZE, mainGap: getGapValue(props.layoutType) } }, props)));
7
+ return (_jsx(BannerCommon, Object.assign({ topSlot: null, sizes: { image: IMAGE_SIZE, mainGap: getGapValue(props.layoutType), imagePadding: IMAGE_PADDING } }, props)));
7
8
  }
@@ -26,6 +26,8 @@ export type BannerCommonProps = WithSupportProps<WithLayoutType<{
26
26
  image: [number, number];
27
27
  /** Отступ между текстом и кнопками */
28
28
  mainGap: number;
29
+ /** Отступ вокруг картинки */
30
+ imagePadding?: number;
29
31
  };
30
32
  } & ColorWrapperProps>>;
31
- export declare function BannerCommon({ id, title, description, img, erid, buttons, layoutType, className, topSlot, sizes: { image: [maxImageWith, maxImageHeight], mainGap, }, ...rest }: BannerCommonProps): import("react/jsx-runtime").JSX.Element;
33
+ export declare function BannerCommon({ id, title, description, img, erid, buttons, layoutType, className, topSlot, sizes: { image: [maxImageWith, maxImageHeight], mainGap, imagePadding, }, ...rest }: BannerCommonProps): import("react/jsx-runtime").JSX.Element;
@@ -19,10 +19,11 @@ import { ColorWrapper } from '../ColorWrapper';
19
19
  import styles from './styles.module.css';
20
20
  import { getBlockTitleProps } from './util';
21
21
  export function BannerCommon(_a) {
22
- var { id, title, description, img, erid, buttons, layoutType, className, topSlot, sizes: { image: [maxImageWith, maxImageHeight], mainGap, } } = _a, rest = __rest(_a, ["id", "title", "description", "img", "erid", "buttons", "layoutType", "className", "topSlot", "sizes"]);
22
+ var { id, title, description, img, erid, buttons, layoutType, className, topSlot, sizes: { image: [maxImageWith, maxImageHeight], mainGap, imagePadding = 0, } } = _a, rest = __rest(_a, ["id", "title", "description", "img", "erid", "buttons", "layoutType", "className", "topSlot", "sizes"]);
23
23
  return (_jsxs(ColorWrapper, Object.assign({ id: id, className: cn(styles.root, className), "data-layout-type": layoutType, style: {
24
24
  '--site-banner-main-gap': `${mainGap}px`,
25
25
  '--site-banner-image-max-width': `${maxImageWith}px`,
26
26
  '--site-banner-image-max-height': `${maxImageHeight}px`,
27
+ '--site-banner-image-padding': `${imagePadding}px`,
27
28
  } }, rest, { children: [erid && _jsx(Erid, { className: styles.erid, tip: erid.tip, appearance: erid.appearance }), _jsxs("div", { className: styles.content, children: [topSlot, _jsxs("div", { "data-color-wrapper-role": 'text', className: styles.text, children: [_jsx(Typography, Object.assign({ className: styles.title, family: 'sans' }, getBlockTitleProps(layoutType), { children: _jsx(RichText, { richText: title }) })), _jsx(Typography.SansBodyL, { className: styles.description, children: _jsx(RichText, { richText: description }) })] }), buttons && buttons.length > 0 && (_jsxs("div", { className: styles.buttons, children: [_jsx(ButtonPromo, Object.assign({ className: styles.button, target: '_self' }, buttons[0], { size: 'l', appearance: ColorWrapper.getButtonAppearance(rest.appearance) })), (buttons === null || buttons === void 0 ? void 0 : buttons.length) > 1 && (_jsx(ButtonPromoOutline, Object.assign({ className: styles.button, target: '_self' }, buttons[1], { size: 'l', appearance: ColorWrapper.getButtonAppearance(rest.appearance) })))] }))] }), _jsx("div", { className: styles.imgWrapper, children: _jsx("img", { className: styles.img, src: img, alt: title }) })] })));
28
29
  }
@@ -20,13 +20,14 @@
20
20
  max-width:var(--site-banner-image-max-width);
21
21
  max-height:var(--site-banner-image-max-height);
22
22
  flex-shrink:0;
23
- border-radius:4px;
24
23
  }
25
24
  .imgWrapper{
25
+ box-sizing:border-box;
26
26
  width:100%;
27
27
  display:flex;
28
28
  justify-content:center;
29
29
  align-items:center;
30
+ padding:var(--site-banner-image-padding);
30
31
  }
31
32
 
32
33
  .erid{
@@ -48,7 +49,7 @@
48
49
  .root{
49
50
  position:relative;
50
51
  display:grid;
51
- grid-template-columns:1fr var(--site-banner-image-max-width);
52
+ grid-template-columns:1fr calc(var(--site-banner-image-max-width) + var(--site-banner-image-padding) * 2);
52
53
  }
53
54
  .root[data-layout-type=tablet]{
54
55
  display:flex;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloud-ru/uikit-product-site-banner",
3
3
  "title": "Site Banner",
4
- "version": "2.0.32",
4
+ "version": "2.0.33-preview-e3701f2e.0",
5
5
  "sideEffects": [
6
6
  "*.css",
7
7
  "*.woff",
@@ -45,5 +45,5 @@
45
45
  "@snack-uikit/utils": "3.7.0",
46
46
  "classnames": "2.5.1"
47
47
  },
48
- "gitHead": "be0899466862c8165b118bc16b07e9d2b9ed2513"
48
+ "gitHead": "24bdba53a72e53c518fac4b56da1c80646c922a2"
49
49
  }
@@ -5,12 +5,17 @@ import { BetterOmit } from '../../types';
5
5
 
6
6
  export type BannerSecondaryProps = BetterOmit<BannerCommonProps, 'topSlot' | 'sizes'>;
7
7
 
8
- const IMAGE_SIZE = [303, 208] as [number, number];
8
+ const IMAGE_PADDING = 8;
9
+ const IMAGE_SIZE = [303 - IMAGE_PADDING * 2, 208 - IMAGE_PADDING * 2] as [number, number];
9
10
 
10
11
  const getGapValue = (layouType: LayoutType) => (layouType === 'tablet' ? 32 : 24);
11
12
 
12
13
  export function BannerSecondary(props: BannerSecondaryProps) {
13
14
  return (
14
- <BannerCommon topSlot={null} sizes={{ image: IMAGE_SIZE, mainGap: getGapValue(props.layoutType) }} {...props} />
15
+ <BannerCommon
16
+ topSlot={null}
17
+ sizes={{ image: IMAGE_SIZE, mainGap: getGapValue(props.layoutType), imagePadding: IMAGE_PADDING }}
18
+ {...props}
19
+ />
15
20
  );
16
21
  }
@@ -41,6 +41,8 @@ export type BannerCommonProps = WithSupportProps<
41
41
  image: [number, number];
42
42
  /** Отступ между текстом и кнопками */
43
43
  mainGap: number;
44
+ /** Отступ вокруг картинки */
45
+ imagePadding?: number;
44
46
  };
45
47
  } & ColorWrapperProps
46
48
  >
@@ -59,6 +61,7 @@ export function BannerCommon({
59
61
  sizes: {
60
62
  image: [maxImageWith, maxImageHeight],
61
63
  mainGap,
64
+ imagePadding = 0,
62
65
  },
63
66
  ...rest
64
67
  }: BannerCommonProps) {
@@ -71,6 +74,7 @@ export function BannerCommon({
71
74
  '--site-banner-main-gap': `${mainGap}px`,
72
75
  '--site-banner-image-max-width': `${maxImageWith}px`,
73
76
  '--site-banner-image-max-height': `${maxImageHeight}px`,
77
+ '--site-banner-image-padding': `${imagePadding}px`,
74
78
  }}
75
79
  {...rest}
76
80
  >
@@ -22,13 +22,14 @@
22
22
 
23
23
  flex-shrink: 0;
24
24
 
25
- border-radius: 4px;
26
-
27
25
  &Wrapper {
26
+ box-sizing: border-box;
28
27
  width: 100%;
29
28
  display: flex;
30
29
  justify-content: center;
31
30
  align-items: center;
31
+
32
+ padding: var(--site-banner-image-padding);
32
33
  }
33
34
  }
34
35
 
@@ -57,7 +58,7 @@
57
58
 
58
59
  display: grid;
59
60
 
60
- grid-template-columns: 1fr var(--site-banner-image-max-width);
61
+ grid-template-columns: 1fr calc(var(--site-banner-image-max-width) + var(--site-banner-image-padding) * 2);
61
62
 
62
63
  &[data-layout-type='tablet'] {
63
64
  display: flex;