@gravity-ui/page-constructor 7.16.0 → 7.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.
- package/build/cjs/blocks/Map/schema.d.ts +0 -6
- package/build/cjs/components/Map/YMap/YMap.d.ts +1 -1
- package/build/cjs/components/Map/YMap/YMap.js +33 -14
- package/build/cjs/components/Map/YMap/YMap.js.map +1 -1
- package/build/cjs/components/Map/YMap/YandexMap.js +3 -3
- package/build/cjs/components/Map/YMap/YandexMap.js.map +1 -1
- package/build/cjs/components/Map/YMap/utils.d.ts +8 -0
- package/build/cjs/components/Map/YMap/utils.js +96 -0
- package/build/cjs/components/Map/YMap/utils.js.map +1 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -1
- package/build/cjs/models/constructor-items/blocks.js.map +1 -1
- package/build/cjs/models/constructor-items/common.d.ts +3 -1
- package/build/cjs/models/constructor-items/common.js.map +1 -1
- package/build/cjs/schema/validators/common.d.ts +0 -3
- package/build/cjs/schema/validators/common.js +0 -3
- package/build/cjs/schema/validators/common.js.map +1 -1
- package/build/esm/blocks/Map/schema.d.ts +0 -6
- package/build/esm/components/Map/YMap/YMap.d.ts +1 -1
- package/build/esm/components/Map/YMap/YMap.js +33 -14
- package/build/esm/components/Map/YMap/YMap.js.map +1 -1
- package/build/esm/components/Map/YMap/YandexMap.js +3 -3
- package/build/esm/components/Map/YMap/YandexMap.js.map +1 -1
- package/build/esm/components/Map/YMap/utils.d.ts +8 -0
- package/build/esm/components/Map/YMap/utils.js +90 -0
- package/build/esm/components/Map/YMap/utils.js.map +1 -0
- package/build/esm/models/constructor-items/blocks.d.ts +1 -1
- package/build/esm/models/constructor-items/blocks.js.map +1 -1
- package/build/esm/models/constructor-items/common.d.ts +3 -1
- package/build/esm/models/constructor-items/common.js.map +1 -1
- package/build/esm/schema/validators/common.d.ts +0 -3
- package/build/esm/schema/validators/common.js +0 -3
- package/build/esm/schema/validators/common.js.map +1 -1
- package/package.json +1 -1
- package/schema/index.js +1 -1
- package/server/models/constructor-items/blocks.d.ts +1 -1
- package/server/models/constructor-items/common.d.ts +3 -1
- package/widget/index.js +1 -1
|
@@ -88,9 +88,6 @@ export declare const Map: {
|
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
|
-
forceAspectRatio: {
|
|
92
|
-
type: string;
|
|
93
|
-
};
|
|
94
91
|
disableControls: {
|
|
95
92
|
type: string;
|
|
96
93
|
};
|
|
@@ -194,9 +191,6 @@ export declare const MapBlock: {
|
|
|
194
191
|
};
|
|
195
192
|
};
|
|
196
193
|
};
|
|
197
|
-
forceAspectRatio: {
|
|
198
|
-
type: string;
|
|
199
|
-
};
|
|
200
194
|
disableControls: {
|
|
201
195
|
type: string;
|
|
202
196
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { YMapMarkerPrivate, YMapProps } from "../../../models/index.js";
|
|
2
|
-
type PlacemarksProps = Pick<YMapProps, 'zoom' | 'markers'>;
|
|
2
|
+
type PlacemarksProps = Pick<YMapProps, 'zoom' | 'markers' | 'areaMargin'>;
|
|
3
3
|
export declare class YMap {
|
|
4
4
|
private ymap;
|
|
5
5
|
private mapRef;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.YMap = void 0;
|
|
4
|
+
const utils_1 = require("./utils.js");
|
|
4
5
|
var GeoObjectTypes;
|
|
5
6
|
(function (GeoObjectTypes) {
|
|
6
7
|
GeoObjectTypes["Properties"] = "properties";
|
|
@@ -79,33 +80,51 @@ class YMap {
|
|
|
79
80
|
}
|
|
80
81
|
});
|
|
81
82
|
}
|
|
83
|
+
// eslint-disable-next-line complexity
|
|
82
84
|
recalcZoomAndCenter(props) {
|
|
83
85
|
const coordsLength = this.coords.length;
|
|
84
|
-
const { zoom = 0 } = props;
|
|
86
|
+
const { zoom = 0, areaMargin } = props;
|
|
85
87
|
if (!coordsLength) {
|
|
86
88
|
return;
|
|
87
89
|
}
|
|
88
|
-
|
|
89
|
-
this.coords
|
|
90
|
-
leftBottom = [Math.min(leftBottom[0], point[0]), Math.min(leftBottom[1], point[1])];
|
|
91
|
-
rightTop = [Math.max(rightTop[0], point[0]), Math.max(rightTop[1], point[1])];
|
|
92
|
-
});
|
|
90
|
+
const utils = window.ymaps.util.bounds;
|
|
91
|
+
const [leftTop, rightBottom] = utils.fromPoints(this.coords);
|
|
93
92
|
let newMapParams = {
|
|
94
93
|
zoom,
|
|
95
94
|
center: [],
|
|
96
95
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
const parsedAreaMargin = areaMargin
|
|
97
|
+
? (0, utils_1.parseMargin)(areaMargin)
|
|
98
|
+
: [0, 0, 0, 0];
|
|
99
|
+
const hasZoom = Boolean(zoom);
|
|
100
|
+
const hasAreaMargin = parsedAreaMargin.some(Boolean);
|
|
101
|
+
const containerSize = [
|
|
102
|
+
this.mapRef?.clientWidth ?? 0,
|
|
103
|
+
this.mapRef?.clientHeight ?? 0,
|
|
104
|
+
];
|
|
105
|
+
switch (true) {
|
|
106
|
+
case hasAreaMargin && hasZoom:
|
|
107
|
+
// calculate center and zoom in accordace with current zoom and margin
|
|
108
|
+
newMapParams = (0, utils_1.calculateMapParamsWithMarginAndZoom)([leftTop, rightBottom], zoom, parsedAreaMargin, containerSize);
|
|
109
|
+
break;
|
|
110
|
+
case hasAreaMargin:
|
|
111
|
+
// calculate center and zoom with custom margin
|
|
112
|
+
newMapParams = utils.getCenterAndZoom([leftTop, rightBottom], containerSize, undefined, { margin: areaMargin, preciseZoom: true });
|
|
113
|
+
break;
|
|
114
|
+
case hasZoom:
|
|
115
|
+
// calculate only center
|
|
116
|
+
newMapParams.center = utils.getCenter([leftTop, rightBottom]);
|
|
117
|
+
break;
|
|
118
|
+
default:
|
|
119
|
+
// calculate center and zoom with default margin
|
|
120
|
+
newMapParams = utils.getCenterAndZoom([leftTop, rightBottom], containerSize, undefined, { margin: DEFAULT_MAP_CONTROL_BUTTON_HEIGHT });
|
|
103
121
|
}
|
|
104
122
|
this.ymap.setCenter(newMapParams.center);
|
|
105
123
|
// Use default zoom for one placemark
|
|
106
|
-
if (coordsLength
|
|
107
|
-
|
|
124
|
+
if (coordsLength <= 1 && !hasAreaMargin && hasZoom) {
|
|
125
|
+
return;
|
|
108
126
|
}
|
|
127
|
+
this.ymap.setZoom(newMapParams.zoom);
|
|
109
128
|
}
|
|
110
129
|
clearOldPlacemarks() {
|
|
111
130
|
if (this.coords.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YMap.js","sourceRoot":"../../../../../src","sources":["components/Map/YMap/YMap.ts"],"names":[],"mappings":";;;AAGA,IAAK,cAGJ;AAHD,WAAK,cAAc;IACf,2CAAyB,CAAA;IACzB,qCAAmB,CAAA;AACvB,CAAC,EAHI,cAAc,KAAd,cAAc,QAGlB;AAED,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAC3C,mGAAmG;AACnG,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AACpD,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAE7C,MAAM,wBAAwB,GAAyD;IACnF,MAAM,EAAE,cAAc,CAAC,OAAO;IAC9B,WAAW,EAAE,cAAc,CAAC,UAAU;IACtC,WAAW,EAAE,cAAc,CAAC,UAAU;IACtC,SAAS,EAAE,cAAc,CAAC,OAAO;IACjC,aAAa,EAAE,cAAc,CAAC,OAAO;IACrC,aAAa,EAAE,cAAc,CAAC,OAAO;IACrC,eAAe,EAAE,cAAc,CAAC,OAAO;IACvC,iBAAiB,EAAE,cAAc,CAAC,OAAO;IACzC,UAAU,EAAE,cAAc,CAAC,OAAO;IAClC,SAAS,EAAE,cAAc,CAAC,OAAO;IACjC,kBAAkB,EAAE,cAAc,CAAC,OAAO;IAC1C,MAAM,EAAE,cAAc,CAAC,OAAO;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,EAAC,CAC9C,CAAC;QACN,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAEzC,qCAAqC;QACrC,IAAI,YAAY,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACzC,CAAC;IACL,CAAC;IAEO,kBAAkB;QACtB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;CACJ;AAtHD,oBAsHC","sourcesContent":["import {YMapMarkerLabelPrivate, YMapMarkerPrivate, YMapProps} from '../../../models';\nimport {Coordinate} from '../../../models/constructor-items/common';\n\nenum GeoObjectTypes {\n Properties = 'properties',\n Options = 'options',\n}\n\nconst DEFAULT_PLACEMARKS_COLOR = '#dc534b';\n// presetStorage: https://yandex.com/dev/maps/jsapi/doc/2.1/ref/reference/option.presetStorage.html\nconst DEFAULT_PLACEMARKS_PRESET = 'islands#dotIcon';\nconst DEFAULT_MAP_CONTROL_BUTTON_HEIGHT = 30;\n\nconst geoObjectPropsAndOptions: Record<keyof YMapMarkerLabelPrivate, GeoObjectTypes> = {\n cursor: GeoObjectTypes.Options,\n iconCaption: GeoObjectTypes.Properties,\n iconContent: GeoObjectTypes.Properties,\n iconColor: GeoObjectTypes.Options,\n iconImageHref: GeoObjectTypes.Options,\n iconImageSize: GeoObjectTypes.Options,\n iconImageOffset: GeoObjectTypes.Options,\n iconImageClipRect: GeoObjectTypes.Options,\n iconLayout: GeoObjectTypes.Options,\n iconShape: GeoObjectTypes.Options,\n interactivityModel: GeoObjectTypes.Options,\n preset: GeoObjectTypes.Options,\n};\n\ntype PlacemarksProps = Pick<YMapProps, 'zoom' | 'markers'>;\n\nexport class YMap {\n private ymap: Ymaps.Map;\n private mapRef: HTMLDivElement | null;\n private coords: Coordinate[] = [];\n\n constructor(ymap: Ymaps.Map, mapRef: HTMLDivElement | null) {\n this.ymap = ymap;\n this.mapRef = mapRef;\n }\n\n async showPlacemarks(props: PlacemarksProps) {\n this.clearOldPlacemarks();\n\n for (const marker of props.markers) {\n if (marker.address) {\n await this.findAddress(marker);\n } else if (marker.coordinate) {\n this.findCoordinate(marker);\n }\n }\n\n this.recalcZoomAndCenter(props);\n }\n\n async findAddress(marker: YMapMarkerPrivate) {\n try {\n const res = await window.ymaps.geocode(marker.address, {results: 1});\n const geoObject = res.geoObjects.get(0);\n const coordinate = geoObject.geometry.getCoordinates();\n\n this.coords.push(coordinate);\n\n this.drawPlaceMarkStyle(geoObject, marker);\n\n this.ymap.geoObjects.add(geoObject);\n } catch {} // If error - placemark will not be displayed\n }\n\n findCoordinate(marker: YMapMarkerPrivate) {\n const geoObject = new window.ymaps.Placemark(marker.coordinate, {});\n\n this.coords.push(marker.coordinate as Coordinate);\n this.drawPlaceMarkStyle(geoObject, marker);\n this.ymap.geoObjects.add(geoObject);\n }\n\n private drawPlaceMarkStyle(geoObject: Ymaps.GeoObject, marker: YMapMarkerPrivate) {\n const {iconColor, preset = DEFAULT_PLACEMARKS_PRESET} = marker.label || {};\n let localIconColor: string | undefined = iconColor;\n\n // You can set the preset option together with the iconColor option only if it not a 'Stretchy' preset\n if (!preset.includes('Stretchy') && !iconColor) {\n localIconColor = DEFAULT_PLACEMARKS_COLOR;\n }\n\n Object.entries({\n ...marker.label,\n iconColor: localIconColor,\n preset,\n }).forEach(([key, value]) => {\n const geoObjectParamType: GeoObjectTypes | undefined =\n geoObjectPropsAndOptions[key as keyof YMapMarkerLabelPrivate];\n\n if (value && geoObjectParamType) {\n geoObject[geoObjectParamType].set(key, value);\n }\n });\n }\n\n private recalcZoomAndCenter(props: PlacemarksProps) {\n const coordsLength = this.coords.length;\n const {zoom = 0} = props;\n\n if (!coordsLength) {\n return;\n }\n\n let leftBottom = [Infinity, Infinity],\n rightTop = [-Infinity, -Infinity];\n\n this.coords.forEach((point) => {\n leftBottom = [Math.min(leftBottom[0], point[0]), Math.min(leftBottom[1], point[1])];\n rightTop = [Math.max(rightTop[0], point[0]), Math.max(rightTop[1], point[1])];\n });\n\n let newMapParams = {\n zoom,\n center: [],\n };\n\n if (zoom) {\n // compute only the center\n newMapParams.center = window.ymaps.util.bounds.getCenter([leftBottom, rightTop]);\n } else {\n newMapParams = window.ymaps.util.bounds.getCenterAndZoom(\n [leftBottom, rightTop],\n [this.mapRef?.clientWidth, this.mapRef?.clientHeight],\n undefined,\n {margin: DEFAULT_MAP_CONTROL_BUTTON_HEIGHT},\n );\n }\n\n this.ymap.setCenter(newMapParams.center);\n\n // Use default zoom for one placemark\n if (coordsLength > 1 && !zoom) {\n this.ymap.setZoom(newMapParams.zoom);\n }\n }\n\n private clearOldPlacemarks() {\n if (this.coords.length === 0) {\n return;\n }\n\n this.ymap.geoObjects.removeAll();\n this.coords = [];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"YMap.js","sourceRoot":"../../../../../src","sources":["components/Map/YMap/YMap.ts"],"names":[],"mappings":";;;AAGA,sCAAuF;AAEvF,IAAK,cAGJ;AAHD,WAAK,cAAc;IACf,2CAAyB,CAAA;IACzB,qCAAmB,CAAA;AACvB,CAAC,EAHI,cAAc,KAAd,cAAc,QAGlB;AAED,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAC3C,mGAAmG;AACnG,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AACpD,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAE7C,MAAM,wBAAwB,GAAyD;IACnF,MAAM,EAAE,cAAc,CAAC,OAAO;IAC9B,WAAW,EAAE,cAAc,CAAC,UAAU;IACtC,WAAW,EAAE,cAAc,CAAC,UAAU;IACtC,SAAS,EAAE,cAAc,CAAC,OAAO;IACjC,aAAa,E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aAAa,CAChB,CAAC;gBACF,MAAM;YACV,KAAK,aAAa;gBACd,+CAA+C;gBAC/C,YAAY,GAAG,KAAK,CAAC,gBAAgB,CACjC,CAAC,OAAO,EAAE,WAAW,CAAC,EACtB,aAAa,EACb,SAAS,EACT,EAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAC,CAC1C,CAAC;gBACF,MAAM;YACV,KAAK,OAAO;gBACR,wBAAwB;gBACxB,YAAY,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;gBAC9D,MAAM;YACV;gBACI,gDAAgD;gBAChD,YAAY,GAAG,KAAK,CAAC,gBAAgB,CACjC,CAAC,OAAO,EAAE,WAAW,CAAC,EACtB,aAAa,EACb,SAAS,EACT,EAAC,MAAM,EAAE,iCAAiC,EAAC,CAC9C,CAAC;QACV,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAEzC,qCAAqC;QACrC,IAAI,YAAY,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,OAAO,EAAE,CAAC;YACjD,OAAO;QACX,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAEO,kBAAkB;QACtB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;CACJ;AArJD,oBAqJC","sourcesContent":["import {YMapMarkerLabelPrivate, YMapMarkerPrivate, YMapProps} from '../../../models';\nimport {Coordinate} from '../../../models/constructor-items/common';\n\nimport {ParsedMargin, calculateMapParamsWithMarginAndZoom, parseMargin} from './utils';\n\nenum GeoObjectTypes {\n Properties = 'properties',\n Options = 'options',\n}\n\nconst DEFAULT_PLACEMARKS_COLOR = '#dc534b';\n// presetStorage: https://yandex.com/dev/maps/jsapi/doc/2.1/ref/reference/option.presetStorage.html\nconst DEFAULT_PLACEMARKS_PRESET = 'islands#dotIcon';\nconst DEFAULT_MAP_CONTROL_BUTTON_HEIGHT = 30;\n\nconst geoObjectPropsAndOptions: Record<keyof YMapMarkerLabelPrivate, GeoObjectTypes> = {\n cursor: GeoObjectTypes.Options,\n iconCaption: GeoObjectTypes.Properties,\n iconContent: GeoObjectTypes.Properties,\n iconColor: GeoObjectTypes.Options,\n iconImageHref: GeoObjectTypes.Options,\n iconImageSize: GeoObjectTypes.Options,\n iconImageOffset: GeoObjectTypes.Options,\n iconImageClipRect: GeoObjectTypes.Options,\n iconLayout: GeoObjectTypes.Options,\n iconShape: GeoObjectTypes.Options,\n interactivityModel: GeoObjectTypes.Options,\n preset: GeoObjectTypes.Options,\n};\n\ntype PlacemarksProps = Pick<YMapProps, 'zoom' | 'markers' | 'areaMargin'>;\n\nexport class YMap {\n private ymap: Ymaps.Map;\n private mapRef: HTMLDivElement | null;\n private coords: Coordinate[] = [];\n\n constructor(ymap: Ymaps.Map, mapRef: HTMLDivElement | null) {\n this.ymap = ymap;\n this.mapRef = mapRef;\n }\n\n async showPlacemarks(props: PlacemarksProps) {\n this.clearOldPlacemarks();\n\n for (const marker of props.markers) {\n if (marker.address) {\n await this.findAddress(marker);\n } else if (marker.coordinate) {\n this.findCoordinate(marker);\n }\n }\n\n this.recalcZoomAndCenter(props);\n }\n\n async findAddress(marker: YMapMarkerPrivate) {\n try {\n const res = await window.ymaps.geocode(marker.address, {results: 1});\n const geoObject = res.geoObjects.get(0);\n const coordinate = geoObject.geometry.getCoordinates();\n\n this.coords.push(coordinate);\n\n this.drawPlaceMarkStyle(geoObject, marker);\n\n this.ymap.geoObjects.add(geoObject);\n } catch {} // If error - placemark will not be displayed\n }\n\n findCoordinate(marker: YMapMarkerPrivate) {\n const geoObject = new window.ymaps.Placemark(marker.coordinate, {});\n\n this.coords.push(marker.coordinate as Coordinate);\n this.drawPlaceMarkStyle(geoObject, marker);\n this.ymap.geoObjects.add(geoObject);\n }\n\n private drawPlaceMarkStyle(geoObject: Ymaps.GeoObject, marker: YMapMarkerPrivate) {\n const {iconColor, preset = DEFAULT_PLACEMARKS_PRESET} = marker.label || {};\n let localIconColor: string | undefined = iconColor;\n\n // You can set the preset option together with the iconColor option only if it not a 'Stretchy' preset\n if (!preset.includes('Stretchy') && !iconColor) {\n localIconColor = DEFAULT_PLACEMARKS_COLOR;\n }\n\n Object.entries({\n ...marker.label,\n iconColor: localIconColor,\n preset,\n }).forEach(([key, value]) => {\n const geoObjectParamType: GeoObjectTypes | undefined =\n geoObjectPropsAndOptions[key as keyof YMapMarkerLabelPrivate];\n\n if (value && geoObjectParamType) {\n geoObject[geoObjectParamType].set(key, value);\n }\n });\n }\n\n // eslint-disable-next-line complexity\n private recalcZoomAndCenter(props: PlacemarksProps) {\n const coordsLength = this.coords.length;\n const {zoom = 0, areaMargin} = props;\n\n if (!coordsLength) {\n return;\n }\n\n const utils = window.ymaps.util.bounds;\n\n const [leftTop, rightBottom] = utils.fromPoints(this.coords);\n\n let newMapParams = {\n zoom,\n center: [],\n };\n\n const parsedAreaMargin = areaMargin\n ? parseMargin(areaMargin)\n : ([0, 0, 0, 0] as ParsedMargin);\n\n const hasZoom = Boolean(zoom);\n const hasAreaMargin = parsedAreaMargin.some(Boolean);\n const containerSize = [\n this.mapRef?.clientWidth ?? 0,\n this.mapRef?.clientHeight ?? 0,\n ] as Coordinate;\n\n switch (true) {\n case hasAreaMargin && hasZoom:\n // calculate center and zoom in accordace with current zoom and margin\n newMapParams = calculateMapParamsWithMarginAndZoom(\n [leftTop, rightBottom],\n zoom,\n parsedAreaMargin,\n containerSize,\n );\n break;\n case hasAreaMargin:\n // calculate center and zoom with custom margin\n newMapParams = utils.getCenterAndZoom(\n [leftTop, rightBottom],\n containerSize,\n undefined,\n {margin: areaMargin, preciseZoom: true},\n );\n break;\n case hasZoom:\n // calculate only center\n newMapParams.center = utils.getCenter([leftTop, rightBottom]);\n break;\n default:\n // calculate center and zoom with default margin\n newMapParams = utils.getCenterAndZoom(\n [leftTop, rightBottom],\n containerSize,\n undefined,\n {margin: DEFAULT_MAP_CONTROL_BUTTON_HEIGHT},\n );\n }\n\n this.ymap.setCenter(newMapParams.center);\n\n // Use default zoom for one placemark\n if (coordsLength <= 1 && !hasAreaMargin && hasZoom) {\n return;\n }\n\n this.ymap.setZoom(newMapParams.zoom);\n }\n\n private clearOldPlacemarks() {\n if (this.coords.length === 0) {\n return;\n }\n\n this.ymap.geoObjects.removeAll();\n this.coords = [];\n }\n}\n"]}
|
|
@@ -26,7 +26,7 @@ const BALLOON_DISABLING_MARKER_OPTIONS = {
|
|
|
26
26
|
interactivityModel: 'default#silent',
|
|
27
27
|
};
|
|
28
28
|
const YandexMap = (props) => {
|
|
29
|
-
const { markers, zoom, id, disableControls = false, disableBalloons = false, className, forceAspectRatio = true, } = props;
|
|
29
|
+
const { markers, zoom, id, disableControls = false, disableBalloons = false, areaMargin, className, forceAspectRatio = true, } = props;
|
|
30
30
|
const { apiKey, scriptSrc, nonce } = React.useContext(mapsContext_1.MapsContext);
|
|
31
31
|
const isMobile = React.useContext(mobileContext_1.MobileContext);
|
|
32
32
|
const { lang = 'ru' } = React.useContext(localeContext_1.LocaleContext);
|
|
@@ -94,12 +94,12 @@ const YandexMap = (props) => {
|
|
|
94
94
|
label: { ...label, ...BALLOON_DISABLING_MARKER_OPTIONS },
|
|
95
95
|
}))
|
|
96
96
|
: markers;
|
|
97
|
-
await ymap.showPlacemarks({ markers: privateMarkers, zoom });
|
|
97
|
+
await ymap.showPlacemarks({ markers: privateMarkers, zoom, areaMargin });
|
|
98
98
|
setReady(true);
|
|
99
99
|
};
|
|
100
100
|
showPlacemarks();
|
|
101
101
|
}
|
|
102
|
-
}, [ymap, markers, zoom, disableBalloons]);
|
|
102
|
+
}, [ymap, markers, zoom, disableBalloons, areaMargin]);
|
|
103
103
|
if (!markers)
|
|
104
104
|
return null;
|
|
105
105
|
return ((0, jsx_runtime_1.jsx)(ErrorWrapper_1.default, { isError: YandexMapApiLoader_1.YMapsApiLoader.status === YandexMapApiLoader_1.MapApiStatus.Error, text: (0, i18n_1.i18n)('map-load-error'), buttonText: (0, i18n_1.i18n)('map-try-again'), handler: onTryAgain, className: b('wrapper'), children: (0, jsx_runtime_1.jsxs)("div", { className: b('wrapper'), children: [(0, jsx_runtime_1.jsx)("div", { id: containerId, className: b({ hidden: !ready }, className), ref: ref, style: { height } }), loading ? (0, jsx_runtime_1.jsx)(uikit_1.Spin, { size: "xl", className: b('spinner') }) : null] }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YandexMap.js","sourceRoot":"../../../../../src","sources":["components/Map/YMap/YandexMap.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAE/B,6CAAuC;AACvC,0EAAuC;AAEvC,mFAA2E;AAC3E,6EAAqE;AACrE,2EAA6D;AAE7D,mDAAqC;AACrC,8FAA2D;AAC3D,2CAAwC;AAExC,oCAA4B;AAC5B,gEAAkE;AAClE,0CAA4B;AAE5B,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,KAAK,CAAC,CAAC;AACvB,MAAM,oBAAoB,GAAG,MAAM,CAAC;AACpC,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,0DAA0D;AAC1D,0CAA0C;AAC1C,4FAA4F;AAC5F,MAAM,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE9B,MAAM,gCAAgC,GAA2B;IAC7D,MAAM,EAAE,MAAM;IACd,kBAAkB,EAAE,gBAAgB;CACvC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAgB,EAAE,EAAE;IACnC,MAAM,EACF,OAAO,EACP,IAAI,EACJ,EAAE,EACF,eAAe,GAAG,KAAK,EACvB,eAAe,GAAG,KAA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5B,UAAU,EAAE,IAAA,WAAI,EAAC,eAAe,CAAC,EACjC,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,YAEvB,iCAAK,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,aAExB,gCACI,EAAE,EAAE,WAAW,EACf,SAAS,EAAE,CAAC,CAAC,EAAC,MAAM,EAAE,CAAC,KAAK,EAAC,EAAE,SAAS,CAAC,EACzC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,EAAC,MAAM,EAAC,GACjB,EACD,OAAO,CAAC,CAAC,CAAC,uBAAC,YAAI,IAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,IAC3D,GACK,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {Spin} from '@gravity-ui/uikit';\nimport debounce from 'lodash/debounce';\n\nimport {LocaleContext} from '../../../context/localeContext/localeContext';\nimport {MapsContext} from '../../../context/mapsContext/mapsContext';\nimport {MobileContext} from '../../../context/mobileContext';\nimport {YMapMarkerLabelPrivate, YMapMarkerPrivate, YMapProps} from '../../../models';\nimport {block} from '../../../utils';\nimport ErrorWrapper from '../../ErrorWrapper/ErrorWrapper';\nimport {getMapHeight} from '../helpers';\n\nimport {YMap} from './YMap';\nimport {MapApiStatus, YMapsApiLoader} from './YandexMapApiLoader';\nimport {i18n} from './i18n';\n\nconst b = block('map');\nconst DEFAULT_CONTAINER_ID = 'ymap';\nconst DEFAULT_ZOOM = 9;\n// Center - is a required parameter for creating a new map\n// We use this init center to create a map\n// The real center of the map will be calculated later, using the coordinates of the markers\nconst INITIAL_CENTER = [0, 0];\n\nconst BALLOON_DISABLING_MARKER_OPTIONS: YMapMarkerLabelPrivate = {\n cursor: 'drag',\n interactivityModel: 'default#silent',\n};\n\nconst YandexMap = (props: YMapProps) => {\n const {\n markers,\n zoom,\n id,\n disableControls = false,\n disableBalloons = false,\n areaMargin,\n className,\n forceAspectRatio = true,\n } = props;\n const {apiKey, scriptSrc, nonce} = React.useContext(MapsContext);\n const isMobile = React.useContext(MobileContext);\n\n const {lang = 'ru'} = React.useContext(LocaleContext);\n const containerId = `${DEFAULT_CONTAINER_ID}-${id}`;\n\n const [ymap, setYmaps] = React.useState<YMap | null>(null);\n const [height, setHeight] = React.useState<number | undefined>(undefined);\n const ref = React.useRef<HTMLDivElement>(null);\n\n const [loading, setLoading] = React.useState<boolean>(false);\n const [ready, setReady] = React.useState<boolean>(false);\n const [attemptsIndex, setAttemptsIndex] = React.useState<number>(0);\n const onTryAgain = React.useCallback(() => {\n setAttemptsIndex(attemptsIndex + 1);\n }, [attemptsIndex]);\n\n React.useEffect(() => {\n (async function () {\n setLoading(true);\n\n await YMapsApiLoader.loadApi(apiKey, scriptSrc, lang, nonce);\n\n window.ymaps?.ready(() => {\n setYmaps(\n new YMap(\n new window.ymaps.Map(\n containerId,\n {\n center: INITIAL_CENTER,\n zoom: zoom || DEFAULT_ZOOM,\n controls: disableControls ? [] : undefined,\n },\n {\n autoFitToViewport: 'always',\n suppressMapOpenBlock: disableControls,\n yandexMapDisablePoiInteractivity: disableControls,\n },\n ),\n ref.current,\n ),\n );\n });\n\n setLoading(false);\n })();\n }, [\n apiKey,\n lang,\n scriptSrc,\n containerId,\n zoom,\n nonce,\n attemptsIndex,\n setLoading,\n disableControls,\n ]);\n\n React.useEffect(() => {\n if (!forceAspectRatio) {\n return;\n }\n\n const updateSize = debounce(() => {\n if (ref.current) {\n setHeight(Math.round(getMapHeight(ref.current.offsetWidth, isMobile)));\n }\n }, 100);\n\n updateSize();\n window.addEventListener('resize', updateSize, {passive: true});\n\n // eslint-disable-next-line consistent-return\n return () => {\n window.removeEventListener('resize', updateSize);\n };\n }, [isMobile, forceAspectRatio]);\n\n React.useEffect(() => {\n if (ymap) {\n // show with computed center and placemarks\n const showPlacemarks = async () => {\n const privateMarkers: YMapMarkerPrivate[] = disableBalloons\n ? markers.map(({label, ...marker}) => ({\n ...marker,\n label: {...label, ...BALLOON_DISABLING_MARKER_OPTIONS},\n }))\n : markers;\n\n await ymap.showPlacemarks({markers: privateMarkers, zoom, areaMargin});\n\n setReady(true);\n };\n\n showPlacemarks();\n }\n }, [ymap, markers, zoom, disableBalloons, areaMargin]);\n\n if (!markers) return null;\n\n return (\n <ErrorWrapper\n isError={YMapsApiLoader.status === MapApiStatus.Error}\n text={i18n('map-load-error')}\n buttonText={i18n('map-try-again')}\n handler={onTryAgain}\n className={b('wrapper')}\n >\n <div className={b('wrapper')}>\n {/* hidden - to show the map after calculating the center */}\n <div\n id={containerId}\n className={b({hidden: !ready}, className)}\n ref={ref}\n style={{height}}\n />\n {loading ? <Spin size=\"xl\" className={b('spinner')} /> : null}\n </div>\n </ErrorWrapper>\n );\n};\n\nexport default YandexMap;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Coordinate, YMapMargin } from "../../../models/index.js";
|
|
2
|
+
export type ParsedMargin = [top: number, right: number, bottom: number, left: number];
|
|
3
|
+
export declare const parseMargin: (margin: YMapMargin) => ParsedMargin;
|
|
4
|
+
export declare const calcPixelBounds: ([leftTop, rightBottom]: [Coordinate, Coordinate], zoom: number, containerSize: Coordinate) => number[][];
|
|
5
|
+
export declare const calculateMapParamsWithMarginAndZoom: ([leftTop, rightBottom]: [Coordinate, Coordinate], zoom: number, areaMargin: ParsedMargin, containerSize: Coordinate) => {
|
|
6
|
+
center: any;
|
|
7
|
+
zoom: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateMapParamsWithMarginAndZoom = exports.calcPixelBounds = exports.parseMargin = void 0;
|
|
4
|
+
const parseMargin = (margin) => {
|
|
5
|
+
if (!Array.isArray(margin)) {
|
|
6
|
+
return [margin, margin, margin, margin];
|
|
7
|
+
}
|
|
8
|
+
if (margin.length === 2) {
|
|
9
|
+
return [margin[0], margin[1], margin[0], margin[1]];
|
|
10
|
+
}
|
|
11
|
+
return margin;
|
|
12
|
+
};
|
|
13
|
+
exports.parseMargin = parseMargin;
|
|
14
|
+
const calcPixelBounds = ([leftTop, rightBottom], zoom, containerSize) => {
|
|
15
|
+
const utils = window.ymaps.util.bounds;
|
|
16
|
+
let [[leftPx, topPx], [rightPx, bottomPx]] = utils.toGlobalPixelBounds([leftTop, rightBottom], zoom);
|
|
17
|
+
// fall back to container size in case there is only one marker and area is 0
|
|
18
|
+
if (rightPx - leftPx <= 0) {
|
|
19
|
+
const halfX = containerSize[0] / 2;
|
|
20
|
+
leftPx -= halfX;
|
|
21
|
+
rightPx += halfX;
|
|
22
|
+
}
|
|
23
|
+
if (bottomPx - topPx <= 0) {
|
|
24
|
+
const halfY = containerSize[1] / 2;
|
|
25
|
+
topPx -= halfY;
|
|
26
|
+
bottomPx += halfY;
|
|
27
|
+
}
|
|
28
|
+
return [
|
|
29
|
+
[leftPx, topPx],
|
|
30
|
+
[rightPx, bottomPx],
|
|
31
|
+
];
|
|
32
|
+
};
|
|
33
|
+
exports.calcPixelBounds = calcPixelBounds;
|
|
34
|
+
const calcNewZoom = (l, zoom, marginSum) => {
|
|
35
|
+
return Math.log2((Math.pow(2, zoom) * (l - marginSum)) / l);
|
|
36
|
+
};
|
|
37
|
+
const calculateMapParamsWithMarginAndZoom = ([leftTop, rightBottom], zoom, areaMargin, containerSize) => {
|
|
38
|
+
const utils = window.ymaps.util.bounds;
|
|
39
|
+
// calculate pixel bounds with current zoom
|
|
40
|
+
let [[leftPx, topPx], [rightPx, bottomPx]] = (0, exports.calcPixelBounds)([leftTop, rightBottom], zoom, containerSize);
|
|
41
|
+
const [topMargin, rightMargin, bottomMargin, leftMargin] = areaMargin;
|
|
42
|
+
let zoomV;
|
|
43
|
+
let zoomH;
|
|
44
|
+
// calculate new zoom value after margins are applied
|
|
45
|
+
if (leftMargin && rightMargin) {
|
|
46
|
+
zoomH = calcNewZoom(rightPx - leftPx, zoom, leftMargin + rightMargin);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
zoomH = zoom;
|
|
50
|
+
}
|
|
51
|
+
if (topMargin && bottomMargin) {
|
|
52
|
+
zoomV = calcNewZoom(bottomPx - topPx, zoom, topMargin + bottomMargin);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
zoomV = zoom;
|
|
56
|
+
}
|
|
57
|
+
const newZoom = Math.min(zoomV, zoomH);
|
|
58
|
+
// calculate pixel bounds with new zoom
|
|
59
|
+
[[leftPx, topPx], [rightPx, bottomPx]] = (0, exports.calcPixelBounds)([leftTop, rightBottom], newZoom, containerSize);
|
|
60
|
+
// calculate new bounds (scale if both size are present, otherwise shift the map)
|
|
61
|
+
if (leftMargin && rightMargin) {
|
|
62
|
+
leftPx -= leftMargin;
|
|
63
|
+
rightPx += rightMargin;
|
|
64
|
+
}
|
|
65
|
+
else if (leftMargin) {
|
|
66
|
+
leftPx -= leftMargin;
|
|
67
|
+
rightPx -= leftMargin;
|
|
68
|
+
}
|
|
69
|
+
else if (rightMargin) {
|
|
70
|
+
leftPx += rightMargin;
|
|
71
|
+
rightPx += rightMargin;
|
|
72
|
+
}
|
|
73
|
+
if (topMargin && bottomMargin) {
|
|
74
|
+
topPx -= topMargin;
|
|
75
|
+
bottomPx += bottomMargin;
|
|
76
|
+
}
|
|
77
|
+
else if (topMargin) {
|
|
78
|
+
topPx -= topMargin;
|
|
79
|
+
bottomPx -= topMargin;
|
|
80
|
+
}
|
|
81
|
+
else if (bottomMargin) {
|
|
82
|
+
topPx += bottomMargin;
|
|
83
|
+
bottomPx += bottomMargin;
|
|
84
|
+
}
|
|
85
|
+
// transform new bounds into coordinates
|
|
86
|
+
const [newLeftTop, newRightBottom] = utils.fromGlobalPixelBounds([
|
|
87
|
+
[leftPx, topPx],
|
|
88
|
+
[rightPx, bottomPx],
|
|
89
|
+
], newZoom);
|
|
90
|
+
return {
|
|
91
|
+
center: utils.getCenter([newLeftTop, newRightBottom]),
|
|
92
|
+
zoom: newZoom,
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
exports.calculateMapParamsWithMarginAndZoom = calculateMapParamsWithMarginAndZoom;
|
|
96
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"../../../../../src","sources":["components/Map/YMap/utils.ts"],"names":[],"mappings":";;;AAIO,MAAM,WAAW,GAAG,CAAC,MAAkB,EAAgB,EAAE;IAC5D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAVW,QAAA,WAAW,eAUtB;AAEK,MAAM,eAAe,GAAG,CAC3B,CAAC,OAAO,EAAE,WAAW,CAA2B,EAChD,IAAY,EACZ,aAAyB,EAC3B,EAAE;IACA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IAEvC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,GAAG,KAAK,CAAC,mBAAmB,CAClE,CAAC,OAAO,EAAE,WAAW,CAAC,EACtB,IAAI,CACqB,CAAC;IAE9B,6EAA6E;IAC7E,IAAI,OAAO,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC;QACxB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I,SAAS,CAAC;IAC1B,CAAC;SAAM,IAAI,YAAY,EAAE,CAAC;QACtB,KAAK,IAAI,YAAY,CAAC;QACtB,QAAQ,IAAI,YAAY,CAAC;IAC7B,CAAC;IAED,wCAAwC;IACxC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAC5D;QACI,CAAC,MAAM,EAAE,KAAK,CAAC;QACf,CAAC,OAAO,EAAE,QAAQ,CAAC;KACtB,EACD,OAAO,CACV,CAAC;IAEF,OAAO;QACH,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACrD,IAAI,EAAE,OAAO;KAChB,CAAC;AACN,CAAC,CAAC;AA9EW,QAAA,mCAAmC,uCA8E9C","sourcesContent":["import {Coordinate, YMapMargin} from '../../../models';\n\nexport type ParsedMargin = [top: number, right: number, bottom: number, left: number];\n\nexport const parseMargin = (margin: YMapMargin): ParsedMargin => {\n if (!Array.isArray(margin)) {\n return [margin, margin, margin, margin];\n }\n\n if (margin.length === 2) {\n return [margin[0], margin[1], margin[0], margin[1]];\n }\n\n return margin;\n};\n\nexport const calcPixelBounds = (\n [leftTop, rightBottom]: [Coordinate, Coordinate],\n zoom: number,\n containerSize: Coordinate,\n) => {\n const utils = window.ymaps.util.bounds;\n\n let [[leftPx, topPx], [rightPx, bottomPx]] = utils.toGlobalPixelBounds(\n [leftTop, rightBottom],\n zoom,\n ) as [Coordinate, Coordinate];\n\n // fall back to container size in case there is only one marker and area is 0\n if (rightPx - leftPx <= 0) {\n const halfX = containerSize[0] / 2;\n leftPx -= halfX;\n rightPx += halfX;\n }\n\n if (bottomPx - topPx <= 0) {\n const halfY = containerSize[1] / 2;\n topPx -= halfY;\n bottomPx += halfY;\n }\n\n return [\n [leftPx, topPx],\n [rightPx, bottomPx],\n ];\n};\n\nconst calcNewZoom = (l: number, zoom: number, marginSum: number) => {\n return Math.log2((Math.pow(2, zoom) * (l - marginSum)) / l);\n};\n\nexport const calculateMapParamsWithMarginAndZoom = (\n [leftTop, rightBottom]: [Coordinate, Coordinate],\n zoom: number,\n areaMargin: ParsedMargin,\n containerSize: Coordinate,\n) => {\n const utils = window.ymaps.util.bounds;\n\n // calculate pixel bounds with current zoom\n let [[leftPx, topPx], [rightPx, bottomPx]] = calcPixelBounds(\n [leftTop, rightBottom],\n zoom,\n containerSize,\n );\n\n const [topMargin, rightMargin, bottomMargin, leftMargin] = areaMargin;\n\n let zoomV: number;\n let zoomH: number;\n\n // calculate new zoom value after margins are applied\n if (leftMargin && rightMargin) {\n zoomH = calcNewZoom(rightPx - leftPx, zoom, leftMargin + rightMargin);\n } else {\n zoomH = zoom;\n }\n\n if (topMargin && bottomMargin) {\n zoomV = calcNewZoom(bottomPx - topPx, zoom, topMargin + bottomMargin);\n } else {\n zoomV = zoom;\n }\n\n const newZoom = Math.min(zoomV, zoomH);\n\n // calculate pixel bounds with new zoom\n [[leftPx, topPx], [rightPx, bottomPx]] = calcPixelBounds(\n [leftTop, rightBottom],\n newZoom,\n containerSize,\n );\n\n // calculate new bounds (scale if both size are present, otherwise shift the map)\n if (leftMargin && rightMargin) {\n leftPx -= leftMargin;\n rightPx += rightMargin;\n } else if (leftMargin) {\n leftPx -= leftMargin;\n rightPx -= leftMargin;\n } else if (rightMargin) {\n leftPx += rightMargin;\n rightPx += rightMargin;\n }\n\n if (topMargin && bottomMargin) {\n topPx -= topMargin;\n bottomPx += bottomMargin;\n } else if (topMargin) {\n topPx -= topMargin;\n bottomPx -= topMargin;\n } else if (bottomMargin) {\n topPx += bottomMargin;\n bottomPx += bottomMargin;\n }\n\n // transform new bounds into coordinates\n const [newLeftTop, newRightBottom] = utils.fromGlobalPixelBounds(\n [\n [leftPx, topPx],\n [rightPx, bottomPx],\n ],\n newZoom,\n );\n\n return {\n center: utils.getCenter([newLeftTop, newRightBottom]),\n zoom: newZoom,\n };\n};\n"]}
|
|
@@ -217,7 +217,7 @@ export interface MediaBlockProps extends MediaBaseBlockProps, WithBorder {
|
|
|
217
217
|
media: ThemeSupporting<MediaProps>;
|
|
218
218
|
}
|
|
219
219
|
export interface MapBlockProps extends MediaBaseBlockProps, WithBorder {
|
|
220
|
-
map: Omit<MapProps, 'forceAspectRatio'>;
|
|
220
|
+
map: Omit<MapProps, 'forceAspectRatio' | 'areaOffset'>;
|
|
221
221
|
}
|
|
222
222
|
export interface InfoBlockProps {
|
|
223
223
|
theme?: TextTheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.js","sourceRoot":"../../../../src","sources":["models/constructor-items/blocks.ts"],"names":[],"mappings":";;;AA4CA,IAAY,SAuBX;AAvBD,WAAY,SAAS;IACjB,wDAA2C,CAAA;IAC3C,8DAAiD,CAAA;IACjD,kBAAkB;IAClB,gDAAmC,CAAA;IACnC,yCAA4B,CAAA;IAC5B,+CAAkC,CAAA;IAClC,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,+CAAkC,CAAA;IAClC,uCAA0B,CAAA;IAC1B,qCAAwB,CAAA;IACxB,uCAA0B,CAAA;IAC1B,qCAAwB,CAAA;IACxB,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,uCAA0B,CAAA;IAC1B,kDAAqC,CAAA;IACrC,wDAA2C,CAAA;IAC3C,uCAA0B,CAAA;IAC1B,mCAAsB,CAAA;IACtB,yCAA4B,CAAA;IAC5B,qCAAwB,CAAA;AAC5B,CAAC,EAvBW,SAAS,yBAAT,SAAS,QAuBpB;AAEY,QAAA,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACtC,QAAA,gBAAgB,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAgCrF,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC7B,kCAAS,CAAA;IACT,kCAAS,CAAA;IACT,kCAAS,CAAA;IACT,kCAAS,CAAA;AACb,CAAC,EALW,qBAAqB,qCAArB,qBAAqB,QAKhC;AAED,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,sCAAwB,CAAA;IACxB,wCAA0B,CAAA;IAC1B,gDAAkC,CAAA;AACtC,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AA0UD,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC5B,iCAAS,CAAA;IACT,6CAAqB,CAAA;IACrB,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;AACzB,CAAC,EANW,oBAAoB,oCAApB,oBAAoB,QAM/B;AAOD,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,uCAAiB,CAAA;IACjB,yCAAmB,CAAA;AACvB,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,kDAA4B,CAAA;IAC5B,kDAA4B,CAAA;IAC5B,uCAAiB,CAAA;AACrB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B","sourcesContent":["import * as React from 'react';\n\nimport {ButtonSize} from '@gravity-ui/uikit';\n\nimport {GridColumnSize, GridColumnSizesType, IndentValue} from '../../grid/types';\nimport {ThemeSupporting} from '../../utils';\nimport {AnalyticsEventsBase} from '../common';\n\nimport {\n AnchorProps,\n Animatable,\n BackgroundImageProps,\n ButtonProps,\n CardBorder,\n ContentSize,\n ContentTextSize,\n ContentTheme,\n FileLinkProps,\n GravityIconProps,\n HeaderBreadCrumbsProps,\n HeaderImageSize,\n HeaderOffset,\n HeaderWidth,\n ImageDeviceProps,\n ImageProps,\n Justify,\n LegendTableMarkerType,\n LinkProps,\n MapProps,\n MediaDirection,\n MediaProps,\n MediaView,\n TextSize,\n TextTheme,\n ThemedImage,\n ThemedMediaProps,\n ThemedMediaVideoProps,\n TitleItemBaseProps,\n TitleItemProps,\n WithBorder,\n YandexFormProps,\n} from './common';\nimport {BannerCardProps, HubspotFormProps, SubBlock, SubBlockModels} from './sub-blocks';\n\nexport enum BlockType {\n PromoFeaturesBlock = 'promo-features-block',\n ExtendedFeaturesBlock = 'extended-features-block',\n /** @deprecated */\n SliderOldBlock = 'slider-old-block',\n SliderBlock = 'slider-block',\n QuestionsBlock = 'questions-block',\n FoldableListBlock = 'foldable-list-block',\n BannerBlock = 'banner-block',\n CompaniesBlock = 'companies-block',\n MediaBlock = 'media-block',\n InfoBlock = 'info-block',\n TableBlock = 'table-block',\n TabsBlock = 'tabs-block',\n HeaderSliderBlock = 'header-slider-block',\n HeaderBlock = 'header-block',\n IconsBlock = 'icons-block',\n CardLayoutBlock = 'card-layout-block',\n ContentLayoutBlock = 'content-layout-block',\n ShareBlock = 'share-block',\n MapBlock = 'map-block',\n FilterBlock = 'filter-block',\n FormBlock = 'form-block',\n}\n\nexport const BlockTypes = Object.values(BlockType);\nexport const HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];\n\nexport interface Childable {\n children?: SubBlock[];\n}\n\n//block props\nexport interface BlockBaseProps {\n anchor?: AnchorProps;\n visible?: GridColumnSize;\n /** @deprecated */\n resetPaddings?: boolean;\n indent?: {\n top?: IndentValue;\n bottom?: IndentValue;\n };\n qa?: string;\n}\n\nexport interface LoadableProps {\n source: string;\n /**\n * @deprecated Will be moved to params\n */\n serviceId?: number;\n params?: Record<string, string | number | boolean | object>;\n}\n\nexport interface LoadableChildren {\n loadable?: LoadableProps;\n}\n\nexport enum SliderBreakpointNames {\n Sm = 'sm',\n Md = 'md',\n Lg = 'lg',\n Xl = 'xl',\n}\n\nexport enum SliderType {\n MediaCard = 'media-card',\n HeaderCard = 'header-card',\n FullscreenCard = 'fullscreen-card',\n}\n\nexport type SliderBreakpointParams = Record<SliderBreakpointNames, number>;\nexport type SlidesToShow = Partial<SliderBreakpointParams> | number;\n\nexport interface SliderOldProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface SliderProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface HeaderSliderBlockProps extends Omit<SliderOldProps, 'title' | 'description'> {\n items: HeaderBlockProps[];\n}\n\ninterface HeaderBackgroundProps {\n /** @deprecated replaced by Media Props image */\n url?: string;\n /** @deprecated replaced by Media Props image */\n disableCompress?: boolean;\n}\n\nexport interface HeaderBlockBackground extends Partial<HeaderBackgroundProps>, Partial<MediaProps> {\n fullWidth?: boolean;\n fullWidthMedia?: boolean;\n}\n\nexport type ThemedHeaderBlockBackground = ThemeSupporting<HeaderBlockBackground>;\n\nexport interface HeaderBlockVideoIframe {\n src: string;\n autoplay?: boolean;\n previewImg?: string;\n height?: number;\n}\n\nexport interface HeaderBlockProps {\n title: string;\n overtitle?: string | JSX.Element;\n description?: string;\n additionalInfo?: string;\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme' | 'primary' | 'size' | 'extraProps'>[];\n width?: HeaderWidth;\n /** @deprecated imageSize now depends on width */\n imageSize?: HeaderImageSize;\n /**\n * @deprecated used only on the main page\n * TODO: delete after the possibility to remove padding-bottom in the block\n */\n offset?: HeaderOffset;\n image?: ThemedImage;\n video?: ThemedMediaVideoProps;\n videoIframe?: HeaderBlockVideoIframe;\n mediaView?: MediaView;\n centered?: boolean;\n background?: ThemedHeaderBlockBackground;\n theme?: 'light' | 'dark';\n verticalOffset?: '0' | 's' | 'm' | 'l' | 'xl';\n breadcrumbs?: HeaderBreadCrumbsProps;\n status?: JSX.Element;\n renderTitle?: (title: string) => React.ReactNode;\n}\n\nexport interface ExtendedFeaturesItem\n extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {\n title: string;\n label?: string;\n icon?: ThemedImage;\n /** @deprecated **/\n link?: LinkProps;\n}\n\nexport interface ExtendedFeaturesProps extends Animatable {\n items: ExtendedFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n colSizes?: GridColumnSizesType;\n}\n\nexport interface PromoFeaturesItem {\n title: string;\n text: string;\n theme?: 'accent' | 'accent-light' | 'primary';\n media?: ThemeSupporting<MediaProps>;\n}\n\nexport interface PromoFeaturesProps extends Animatable {\n items: PromoFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n theme?: 'grey' | 'default';\n}\n\nexport interface QuestionItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface QuestionsProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {\n items: QuestionItem[];\n}\n\nexport interface QuestionBlockItemProps extends QuestionItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface FoldableListItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface FoldableListProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {\n items: FoldableListItem[];\n}\n\nexport interface FoldableListBlockItemProps extends FoldableListItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface BannerBlockProps extends BannerCardProps, Animatable {}\n\nexport interface CompaniesBlockProps extends Animatable {\n title: string;\n description?: string;\n images: ThemeSupporting<ImageDeviceProps>;\n}\n\nexport interface MediaBaseBlockProps extends Animatable, MediaContentProps {\n direction?: MediaDirection;\n mobileDirection?: MediaDirection;\n largeMedia?: boolean;\n mediaOnly?: boolean;\n mediaOnlyColSizes?: GridColumnSizesType;\n}\n\nexport interface MediaContentProps\n extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'theme' | 'centered'> {\n description?: string;\n /** @deprecated Use array of buttons from ContentBlockProps instead**/\n button?: ButtonProps;\n}\n\nexport interface MediaBlockProps extends MediaBaseBlockProps, WithBorder {\n media: ThemeSupporting<MediaProps>;\n}\n\nexport interface MapBlockProps extends MediaBaseBlockProps, WithBorder {\n map: Omit<MapProps, 'forceAspectRatio'>;\n}\n\nexport interface InfoBlockProps {\n theme?: TextTheme;\n backgroundColor?: ThemeSupporting<string>;\n /** @deprecated **/\n title?: string;\n /** @deprecated **/\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme'>[];\n /** @deprecated **/\n sectionsTitle?: string;\n /** @deprecated **/\n links?: Pick<LinkProps, 'text' | 'url'>[];\n leftContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;\n rightContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;\n}\n\nexport interface TableProps {\n content: string[][];\n legend?: string[];\n hideLegend?: boolean;\n justify?: Justify[];\n marker?: LegendTableMarkerType;\n /**\n * Only as accessible name, not displayed explicitly\n */\n caption?: string;\n}\n\nexport interface TableBlockProps {\n title: string;\n table: TableProps;\n}\n\nexport interface TabsBlockItem\n extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'>,\n WithBorder {\n tabName: string;\n /**\n * @deprecated Use array links from ContentBlockProps instead\n */\n link?: LinkProps;\n image?: ThemedImage;\n caption?: string;\n media?: ThemedMediaProps;\n}\n\nexport interface TabsBlockProps extends Animatable {\n title?: TitleItemProps | string;\n description?: string;\n tabsColSizes?: GridColumnSizesType;\n centered?: boolean;\n direction?: MediaDirection;\n items: TabsBlockItem[];\n contentSize?: ContentSize;\n}\n\nexport interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n titleClassName?: string;\n description?: string;\n colSizes?: GridColumnSizesType;\n background?: ThemeSupporting<\n BackgroundImageProps & {\n border?: CardBorder;\n }\n >;\n}\n\nexport type FilterTag = {\n id: string;\n label: string;\n};\n\nexport type FilterItem = {\n tags: string[];\n card: SubBlockModels;\n};\n\nexport interface FilterBlockProps extends Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n description?: string;\n tags: FilterTag[];\n items: FilterItem[];\n tagButtonSize?: ButtonSize;\n allTag?: boolean | string;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n}\n\nexport interface IconsBlockItemProps extends AnalyticsEventsBase {\n url: string;\n text: string;\n src: ThemeSupporting<string>;\n}\n\nexport interface IconsBlockProps {\n title?: string;\n description?: string;\n size?: 's' | 'm' | 'l';\n items: IconsBlockItemProps[];\n colSizes?: GridColumnSizesType;\n}\n\ninterface ContentLayoutBlockParams {\n size?: ContentSize;\n background?: ThemeSupporting<BackgroundImageProps>;\n centered?: boolean;\n theme?: ContentTheme;\n textWidth?: ContentTextSize;\n}\n\nexport interface ContentLayoutBlockProps extends ContentLayoutBlockParams {\n textContent: ContentBlockProps;\n fileContent?: FileLinkProps[];\n}\n\nexport type SVGIcon = (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;\n\nexport interface ContentItemProps {\n title?: string;\n text?: string;\n icon?: ThemeSupporting<ImageProps | SVGIcon>;\n gravityIcon?: ThemeSupporting<GravityIconProps>;\n}\n\nexport interface ContentListProps {\n list: ContentItemProps[];\n size: ContentSize;\n theme?: ContentTheme;\n}\n\nexport interface ContentBlockProps {\n title?: TitleItemBaseProps | string;\n titleId?: string;\n text?: string;\n textId?: string;\n additionalInfo?: string;\n links?: LinkProps[];\n buttons?: ButtonProps[];\n size?: ContentSize;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n theme?: ContentTheme;\n list?: ContentItemProps[];\n controlPosition?: 'default' | 'bottom';\n}\n\nexport enum PCShareSocialNetwork {\n Vk = 'vk',\n Telegram = 'telegram',\n Twitter = 'twitter',\n Facebook = 'facebook',\n LinkedIn = 'linkedin',\n}\n\nexport interface ShareBlockProps {\n items: PCShareSocialNetwork[];\n title?: string;\n}\n\nexport enum FormBlockDataTypes {\n YANDEX = 'yandex',\n HUBSPOT = 'hubspot',\n}\n\nexport enum FormBlockDirection {\n FormContent = 'form-content',\n ContentForm = 'content-form',\n Center = 'center',\n}\n\nexport interface FormBlockYandexData {\n yandex: ThemeSupporting<YandexFormProps>;\n}\n\nexport interface FormBlockHubspotData {\n hubspot: ThemeSupporting<HubspotFormProps>;\n}\n\nexport type FormBlockData = FormBlockYandexData | FormBlockHubspotData;\n\nexport interface FormBlockProps {\n formData: FormBlockData;\n title?: string;\n textContent?: Omit<ContentBlockProps, 'centered' | 'colSizes' | 'size'>;\n direction?: FormBlockDirection;\n background?: ThemeSupporting<BackgroundImageProps>;\n}\n\n//block models\nexport type HeaderBlockModel = {\n type: BlockType.HeaderBlock;\n} & HeaderBlockProps;\n\nexport type SliderOldBlockModel = {\n type: BlockType.SliderOldBlock;\n} & SliderOldProps;\n\nexport type ExtendedFeaturesBlockModel = {\n type: BlockType.ExtendedFeaturesBlock;\n} & ExtendedFeaturesProps;\n\nexport type PromoFeaturesBlockModel = {\n type: BlockType.PromoFeaturesBlock;\n} & PromoFeaturesProps;\n\nexport type QuestionsBlockModel = {\n type: BlockType.QuestionsBlock;\n} & QuestionsProps;\n\nexport type FoldableListBlockModel = {\n type: BlockType.FoldableListBlock;\n} & FoldableListProps;\n\nexport type BannerBlockModel = {\n type: BlockType.BannerBlock;\n} & BannerBlockProps;\n\nexport type CompaniesBlockModel = {\n type: BlockType.CompaniesBlock;\n} & CompaniesBlockProps;\n\nexport type MediaBlockModel = {\n type: BlockType.MediaBlock;\n} & MediaBlockProps;\n\nexport type MapBlockModel = {\n type: BlockType.MapBlock;\n} & MapBlockProps;\n\nexport type InfoBlockModel = {\n type: BlockType.InfoBlock;\n} & InfoBlockProps;\n\nexport type TableBlockModel = {\n type: BlockType.TableBlock;\n} & TableBlockProps;\n\nexport type TabsBlockModel = {\n type: BlockType.TabsBlock;\n} & TabsBlockProps;\n\nexport type CardLayoutBlockModel = {\n type: BlockType.CardLayoutBlock;\n} & CardLayoutBlockProps;\n\nexport type FilterBlockModel = {\n type: BlockType.FilterBlock;\n} & FilterBlockProps;\n\nexport type IconsBlockModel = {\n type: BlockType.IconsBlock;\n} & IconsBlockProps;\n\nexport type HeaderSliderBlockModel = {\n type: BlockType.HeaderSliderBlock;\n} & HeaderSliderBlockProps;\n\nexport type ContentLayoutBlockModel = {\n type: BlockType.ContentLayoutBlock;\n} & ContentLayoutBlockProps;\n\nexport type ShareBLockModel = {\n type: BlockType.ShareBlock;\n} & ShareBlockProps;\n\nexport type FormBlockModel = {\n type: BlockType.FormBlock;\n} & FormBlockProps;\n\nexport type SliderBlockModel = {\n type: BlockType.SliderBlock;\n} & SliderProps;\n\ntype BlockModels =\n | SliderOldBlockModel\n | SliderBlockModel\n | ExtendedFeaturesBlockModel\n | PromoFeaturesBlockModel\n | QuestionsBlockModel\n | FoldableListBlockModel\n | BannerBlockModel\n | CompaniesBlockModel\n | MediaBlockModel\n | MapBlockModel\n | InfoBlockModel\n | TableBlockModel\n | TabsBlockModel\n | HeaderBlockModel\n | IconsBlockModel\n | HeaderSliderBlockModel\n | CardLayoutBlockModel\n | ContentLayoutBlockModel\n | ShareBLockModel\n | FilterBlockModel\n | FormBlockModel;\n\nexport type Block = BlockModels & BlockBaseProps;\n"]}
|
|
1
|
+
{"version":3,"file":"blocks.js","sourceRoot":"../../../../src","sources":["models/constructor-items/blocks.ts"],"names":[],"mappings":";;;AA4CA,IAAY,SAuBX;AAvBD,WAAY,SAAS;IACjB,wDAA2C,CAAA;IAC3C,8DAAiD,CAAA;IACjD,kBAAkB;IAClB,gDAAmC,CAAA;IACnC,yCAA4B,CAAA;IAC5B,+CAAkC,CAAA;IAClC,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,+CAAkC,CAAA;IAClC,uCAA0B,CAAA;IAC1B,qCAAwB,CAAA;IACxB,uCAA0B,CAAA;IAC1B,qCAAwB,CAAA;IACxB,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,uCAA0B,CAAA;IAC1B,kDAAqC,CAAA;IACrC,wDAA2C,CAAA;IAC3C,uCAA0B,CAAA;IAC1B,mCAAsB,CAAA;IACtB,yCAA4B,CAAA;IAC5B,qCAAwB,CAAA;AAC5B,CAAC,EAvBW,SAAS,yBAAT,SAAS,QAuBpB;AAEY,QAAA,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACtC,QAAA,gBAAgB,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAgCrF,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC7B,kCAAS,CAAA;IACT,kCAAS,CAAA;IACT,kCAAS,CAAA;IACT,kCAAS,CAAA;AACb,CAAC,EALW,qBAAqB,qCAArB,qBAAqB,QAKhC;AAED,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,sCAAwB,CAAA;IACxB,wCAA0B,CAAA;IAC1B,gDAAkC,CAAA;AACtC,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AA0UD,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC5B,iCAAS,CAAA;IACT,6CAAqB,CAAA;IACrB,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;AACzB,CAAC,EANW,oBAAoB,oCAApB,oBAAoB,QAM/B;AAOD,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,uCAAiB,CAAA;IACjB,yCAAmB,CAAA;AACvB,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,kDAA4B,CAAA;IAC5B,kDAA4B,CAAA;IAC5B,uCAAiB,CAAA;AACrB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B","sourcesContent":["import * as React from 'react';\n\nimport {ButtonSize} from '@gravity-ui/uikit';\n\nimport {GridColumnSize, GridColumnSizesType, IndentValue} from '../../grid/types';\nimport {ThemeSupporting} from '../../utils';\nimport {AnalyticsEventsBase} from '../common';\n\nimport {\n AnchorProps,\n Animatable,\n BackgroundImageProps,\n ButtonProps,\n CardBorder,\n ContentSize,\n ContentTextSize,\n ContentTheme,\n FileLinkProps,\n GravityIconProps,\n HeaderBreadCrumbsProps,\n HeaderImageSize,\n HeaderOffset,\n HeaderWidth,\n ImageDeviceProps,\n ImageProps,\n Justify,\n LegendTableMarkerType,\n LinkProps,\n MapProps,\n MediaDirection,\n MediaProps,\n MediaView,\n TextSize,\n TextTheme,\n ThemedImage,\n ThemedMediaProps,\n ThemedMediaVideoProps,\n TitleItemBaseProps,\n TitleItemProps,\n WithBorder,\n YandexFormProps,\n} from './common';\nimport {BannerCardProps, HubspotFormProps, SubBlock, SubBlockModels} from './sub-blocks';\n\nexport enum BlockType {\n PromoFeaturesBlock = 'promo-features-block',\n ExtendedFeaturesBlock = 'extended-features-block',\n /** @deprecated */\n SliderOldBlock = 'slider-old-block',\n SliderBlock = 'slider-block',\n QuestionsBlock = 'questions-block',\n FoldableListBlock = 'foldable-list-block',\n BannerBlock = 'banner-block',\n CompaniesBlock = 'companies-block',\n MediaBlock = 'media-block',\n InfoBlock = 'info-block',\n TableBlock = 'table-block',\n TabsBlock = 'tabs-block',\n HeaderSliderBlock = 'header-slider-block',\n HeaderBlock = 'header-block',\n IconsBlock = 'icons-block',\n CardLayoutBlock = 'card-layout-block',\n ContentLayoutBlock = 'content-layout-block',\n ShareBlock = 'share-block',\n MapBlock = 'map-block',\n FilterBlock = 'filter-block',\n FormBlock = 'form-block',\n}\n\nexport const BlockTypes = Object.values(BlockType);\nexport const HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];\n\nexport interface Childable {\n children?: SubBlock[];\n}\n\n//block props\nexport interface BlockBaseProps {\n anchor?: AnchorProps;\n visible?: GridColumnSize;\n /** @deprecated */\n resetPaddings?: boolean;\n indent?: {\n top?: IndentValue;\n bottom?: IndentValue;\n };\n qa?: string;\n}\n\nexport interface LoadableProps {\n source: string;\n /**\n * @deprecated Will be moved to params\n */\n serviceId?: number;\n params?: Record<string, string | number | boolean | object>;\n}\n\nexport interface LoadableChildren {\n loadable?: LoadableProps;\n}\n\nexport enum SliderBreakpointNames {\n Sm = 'sm',\n Md = 'md',\n Lg = 'lg',\n Xl = 'xl',\n}\n\nexport enum SliderType {\n MediaCard = 'media-card',\n HeaderCard = 'header-card',\n FullscreenCard = 'fullscreen-card',\n}\n\nexport type SliderBreakpointParams = Record<SliderBreakpointNames, number>;\nexport type SlidesToShow = Partial<SliderBreakpointParams> | number;\n\nexport interface SliderOldProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface SliderProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface HeaderSliderBlockProps extends Omit<SliderOldProps, 'title' | 'description'> {\n items: HeaderBlockProps[];\n}\n\ninterface HeaderBackgroundProps {\n /** @deprecated replaced by Media Props image */\n url?: string;\n /** @deprecated replaced by Media Props image */\n disableCompress?: boolean;\n}\n\nexport interface HeaderBlockBackground extends Partial<HeaderBackgroundProps>, Partial<MediaProps> {\n fullWidth?: boolean;\n fullWidthMedia?: boolean;\n}\n\nexport type ThemedHeaderBlockBackground = ThemeSupporting<HeaderBlockBackground>;\n\nexport interface HeaderBlockVideoIframe {\n src: string;\n autoplay?: boolean;\n previewImg?: string;\n height?: number;\n}\n\nexport interface HeaderBlockProps {\n title: string;\n overtitle?: string | JSX.Element;\n description?: string;\n additionalInfo?: string;\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme' | 'primary' | 'size' | 'extraProps'>[];\n width?: HeaderWidth;\n /** @deprecated imageSize now depends on width */\n imageSize?: HeaderImageSize;\n /**\n * @deprecated used only on the main page\n * TODO: delete after the possibility to remove padding-bottom in the block\n */\n offset?: HeaderOffset;\n image?: ThemedImage;\n video?: ThemedMediaVideoProps;\n videoIframe?: HeaderBlockVideoIframe;\n mediaView?: MediaView;\n centered?: boolean;\n background?: ThemedHeaderBlockBackground;\n theme?: 'light' | 'dark';\n verticalOffset?: '0' | 's' | 'm' | 'l' | 'xl';\n breadcrumbs?: HeaderBreadCrumbsProps;\n status?: JSX.Element;\n renderTitle?: (title: string) => React.ReactNode;\n}\n\nexport interface ExtendedFeaturesItem\n extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {\n title: string;\n label?: string;\n icon?: ThemedImage;\n /** @deprecated **/\n link?: LinkProps;\n}\n\nexport interface ExtendedFeaturesProps extends Animatable {\n items: ExtendedFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n colSizes?: GridColumnSizesType;\n}\n\nexport interface PromoFeaturesItem {\n title: string;\n text: string;\n theme?: 'accent' | 'accent-light' | 'primary';\n media?: ThemeSupporting<MediaProps>;\n}\n\nexport interface PromoFeaturesProps extends Animatable {\n items: PromoFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n theme?: 'grey' | 'default';\n}\n\nexport interface QuestionItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface QuestionsProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {\n items: QuestionItem[];\n}\n\nexport interface QuestionBlockItemProps extends QuestionItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface FoldableListItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface FoldableListProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {\n items: FoldableListItem[];\n}\n\nexport interface FoldableListBlockItemProps extends FoldableListItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface BannerBlockProps extends BannerCardProps, Animatable {}\n\nexport interface CompaniesBlockProps extends Animatable {\n title: string;\n description?: string;\n images: ThemeSupporting<ImageDeviceProps>;\n}\n\nexport interface MediaBaseBlockProps extends Animatable, MediaContentProps {\n direction?: MediaDirection;\n mobileDirection?: MediaDirection;\n largeMedia?: boolean;\n mediaOnly?: boolean;\n mediaOnlyColSizes?: GridColumnSizesType;\n}\n\nexport interface MediaContentProps\n extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'theme' | 'centered'> {\n description?: string;\n /** @deprecated Use array of buttons from ContentBlockProps instead**/\n button?: ButtonProps;\n}\n\nexport interface MediaBlockProps extends MediaBaseBlockProps, WithBorder {\n media: ThemeSupporting<MediaProps>;\n}\n\nexport interface MapBlockProps extends MediaBaseBlockProps, WithBorder {\n map: Omit<MapProps, 'forceAspectRatio' | 'areaOffset'>;\n}\n\nexport interface InfoBlockProps {\n theme?: TextTheme;\n backgroundColor?: ThemeSupporting<string>;\n /** @deprecated **/\n title?: string;\n /** @deprecated **/\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme'>[];\n /** @deprecated **/\n sectionsTitle?: string;\n /** @deprecated **/\n links?: Pick<LinkProps, 'text' | 'url'>[];\n leftContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;\n rightContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;\n}\n\nexport interface TableProps {\n content: string[][];\n legend?: string[];\n hideLegend?: boolean;\n justify?: Justify[];\n marker?: LegendTableMarkerType;\n /**\n * Only as accessible name, not displayed explicitly\n */\n caption?: string;\n}\n\nexport interface TableBlockProps {\n title: string;\n table: TableProps;\n}\n\nexport interface TabsBlockItem\n extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'>,\n WithBorder {\n tabName: string;\n /**\n * @deprecated Use array links from ContentBlockProps instead\n */\n link?: LinkProps;\n image?: ThemedImage;\n caption?: string;\n media?: ThemedMediaProps;\n}\n\nexport interface TabsBlockProps extends Animatable {\n title?: TitleItemProps | string;\n description?: string;\n tabsColSizes?: GridColumnSizesType;\n centered?: boolean;\n direction?: MediaDirection;\n items: TabsBlockItem[];\n contentSize?: ContentSize;\n}\n\nexport interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n titleClassName?: string;\n description?: string;\n colSizes?: GridColumnSizesType;\n background?: ThemeSupporting<\n BackgroundImageProps & {\n border?: CardBorder;\n }\n >;\n}\n\nexport type FilterTag = {\n id: string;\n label: string;\n};\n\nexport type FilterItem = {\n tags: string[];\n card: SubBlockModels;\n};\n\nexport interface FilterBlockProps extends Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n description?: string;\n tags: FilterTag[];\n items: FilterItem[];\n tagButtonSize?: ButtonSize;\n allTag?: boolean | string;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n}\n\nexport interface IconsBlockItemProps extends AnalyticsEventsBase {\n url: string;\n text: string;\n src: ThemeSupporting<string>;\n}\n\nexport interface IconsBlockProps {\n title?: string;\n description?: string;\n size?: 's' | 'm' | 'l';\n items: IconsBlockItemProps[];\n colSizes?: GridColumnSizesType;\n}\n\ninterface ContentLayoutBlockParams {\n size?: ContentSize;\n background?: ThemeSupporting<BackgroundImageProps>;\n centered?: boolean;\n theme?: ContentTheme;\n textWidth?: ContentTextSize;\n}\n\nexport interface ContentLayoutBlockProps extends ContentLayoutBlockParams {\n textContent: ContentBlockProps;\n fileContent?: FileLinkProps[];\n}\n\nexport type SVGIcon = (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;\n\nexport interface ContentItemProps {\n title?: string;\n text?: string;\n icon?: ThemeSupporting<ImageProps | SVGIcon>;\n gravityIcon?: ThemeSupporting<GravityIconProps>;\n}\n\nexport interface ContentListProps {\n list: ContentItemProps[];\n size: ContentSize;\n theme?: ContentTheme;\n}\n\nexport interface ContentBlockProps {\n title?: TitleItemBaseProps | string;\n titleId?: string;\n text?: string;\n textId?: string;\n additionalInfo?: string;\n links?: LinkProps[];\n buttons?: ButtonProps[];\n size?: ContentSize;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n theme?: ContentTheme;\n list?: ContentItemProps[];\n controlPosition?: 'default' | 'bottom';\n}\n\nexport enum PCShareSocialNetwork {\n Vk = 'vk',\n Telegram = 'telegram',\n Twitter = 'twitter',\n Facebook = 'facebook',\n LinkedIn = 'linkedin',\n}\n\nexport interface ShareBlockProps {\n items: PCShareSocialNetwork[];\n title?: string;\n}\n\nexport enum FormBlockDataTypes {\n YANDEX = 'yandex',\n HUBSPOT = 'hubspot',\n}\n\nexport enum FormBlockDirection {\n FormContent = 'form-content',\n ContentForm = 'content-form',\n Center = 'center',\n}\n\nexport interface FormBlockYandexData {\n yandex: ThemeSupporting<YandexFormProps>;\n}\n\nexport interface FormBlockHubspotData {\n hubspot: ThemeSupporting<HubspotFormProps>;\n}\n\nexport type FormBlockData = FormBlockYandexData | FormBlockHubspotData;\n\nexport interface FormBlockProps {\n formData: FormBlockData;\n title?: string;\n textContent?: Omit<ContentBlockProps, 'centered' | 'colSizes' | 'size'>;\n direction?: FormBlockDirection;\n background?: ThemeSupporting<BackgroundImageProps>;\n}\n\n//block models\nexport type HeaderBlockModel = {\n type: BlockType.HeaderBlock;\n} & HeaderBlockProps;\n\nexport type SliderOldBlockModel = {\n type: BlockType.SliderOldBlock;\n} & SliderOldProps;\n\nexport type ExtendedFeaturesBlockModel = {\n type: BlockType.ExtendedFeaturesBlock;\n} & ExtendedFeaturesProps;\n\nexport type PromoFeaturesBlockModel = {\n type: BlockType.PromoFeaturesBlock;\n} & PromoFeaturesProps;\n\nexport type QuestionsBlockModel = {\n type: BlockType.QuestionsBlock;\n} & QuestionsProps;\n\nexport type FoldableListBlockModel = {\n type: BlockType.FoldableListBlock;\n} & FoldableListProps;\n\nexport type BannerBlockModel = {\n type: BlockType.BannerBlock;\n} & BannerBlockProps;\n\nexport type CompaniesBlockModel = {\n type: BlockType.CompaniesBlock;\n} & CompaniesBlockProps;\n\nexport type MediaBlockModel = {\n type: BlockType.MediaBlock;\n} & MediaBlockProps;\n\nexport type MapBlockModel = {\n type: BlockType.MapBlock;\n} & MapBlockProps;\n\nexport type InfoBlockModel = {\n type: BlockType.InfoBlock;\n} & InfoBlockProps;\n\nexport type TableBlockModel = {\n type: BlockType.TableBlock;\n} & TableBlockProps;\n\nexport type TabsBlockModel = {\n type: BlockType.TabsBlock;\n} & TabsBlockProps;\n\nexport type CardLayoutBlockModel = {\n type: BlockType.CardLayoutBlock;\n} & CardLayoutBlockProps;\n\nexport type FilterBlockModel = {\n type: BlockType.FilterBlock;\n} & FilterBlockProps;\n\nexport type IconsBlockModel = {\n type: BlockType.IconsBlock;\n} & IconsBlockProps;\n\nexport type HeaderSliderBlockModel = {\n type: BlockType.HeaderSliderBlock;\n} & HeaderSliderBlockProps;\n\nexport type ContentLayoutBlockModel = {\n type: BlockType.ContentLayoutBlock;\n} & ContentLayoutBlockProps;\n\nexport type ShareBLockModel = {\n type: BlockType.ShareBlock;\n} & ShareBlockProps;\n\nexport type FormBlockModel = {\n type: BlockType.FormBlock;\n} & FormBlockProps;\n\nexport type SliderBlockModel = {\n type: BlockType.SliderBlock;\n} & SliderProps;\n\ntype BlockModels =\n | SliderOldBlockModel\n | SliderBlockModel\n | ExtendedFeaturesBlockModel\n | PromoFeaturesBlockModel\n | QuestionsBlockModel\n | FoldableListBlockModel\n | BannerBlockModel\n | CompaniesBlockModel\n | MediaBlockModel\n | MapBlockModel\n | InfoBlockModel\n | TableBlockModel\n | TabsBlockModel\n | HeaderBlockModel\n | IconsBlockModel\n | HeaderSliderBlockModel\n | CardLayoutBlockModel\n | ContentLayoutBlockModel\n | ShareBLockModel\n | FilterBlockModel\n | FormBlockModel;\n\nexport type Block = BlockModels & BlockBaseProps;\n"]}
|
|
@@ -245,7 +245,7 @@ export interface BackgroundMediaProps extends MediaProps, Animatable, QAProps {
|
|
|
245
245
|
className?: string;
|
|
246
246
|
mediaClassName?: string;
|
|
247
247
|
}
|
|
248
|
-
export type Coordinate = number
|
|
248
|
+
export type Coordinate = [number, number];
|
|
249
249
|
export interface MapBaseProps {
|
|
250
250
|
zoom?: number;
|
|
251
251
|
className?: string;
|
|
@@ -254,10 +254,12 @@ export interface MapBaseProps {
|
|
|
254
254
|
export interface GMapProps extends MapBaseProps {
|
|
255
255
|
address: string;
|
|
256
256
|
}
|
|
257
|
+
export type YMapMargin = number | [vertical: number, horizontal: number] | [top: number, right: number, bottom: number, left: number];
|
|
257
258
|
export interface YMapProps extends MapBaseProps {
|
|
258
259
|
markers: YMapMarker[];
|
|
259
260
|
disableControls?: boolean;
|
|
260
261
|
disableBalloons?: boolean;
|
|
262
|
+
areaMargin?: YMapMargin;
|
|
261
263
|
id: string;
|
|
262
264
|
}
|
|
263
265
|
export interface YMapMarker {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"../../../../src","sources":["models/constructor-items/common.ts"],"names":[],"mappings":";;;AAQA,QAAQ;AACR,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,2BAAa,CAAA;AACjB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,+CAA2B,CAAA;IAC3B,yCAAqB,CAAA;AACzB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,eAMX;AAND,WAAY,eAAe;IACvB,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,8BAAW,CAAA;AACf,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;AACjB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,iCAAa,CAAA;IACb,iCAAa,CAAA;AACjB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,yDAAmC,CAAA;IACnC,oEAA8C,CAAA;AAClD,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,+BAIX;AAJD,WAAY,+BAA+B;IACvC,gDAAa,CAAA;IACb,kDAAe,CAAA;IACf,oDAAiB,CAAA;AACrB,CAAC,EAJW,+BAA+B,+CAA/B,+BAA+B,QAI1C;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;AACrB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAC9B,6CAAmB,CAAA;IACnB,2CAAiB,CAAA;AACrB,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,gCAAmB,CAAA;IACnB,6CAAgC,CAAA;AACpC,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAuED,SAAS;AAET,IAAY,MAIX;AAJD,WAAY,MAAM;IACd,6BAAmB,CAAA;IACnB,2BAAiB,CAAA;IACjB,2BAAiB,CAAA;AACrB,CAAC,EAJW,MAAM,sBAAN,MAAM,QAIjB","sourcesContent":["import * as React from 'react';\n\nimport * as icons from '@gravity-ui/icons';\nimport {ButtonView, IconData, ButtonProps as UikitButtonProps} from '@gravity-ui/uikit';\n\nimport {ThemeSupporting} from '../../utils';\nimport {AnalyticsEventsBase, AnalyticsEventsProp, ClassNameProps, QAProps} from '../common';\n\n// enums\nexport enum AuthorType {\n Column = 'column',\n Line = 'line',\n}\n\nexport enum PriceDetailsType {\n MARKED_LIST = 'marked-list',\n SETTINGS = 'settings',\n}\n\nexport enum PriceLabelColor {\n BLUE = 'blue',\n GREEN = 'green',\n YELLOW = 'yellow',\n PURPLE = 'purple',\n RED = 'red',\n}\n\nexport enum PlayButtonType {\n Default = 'default',\n Text = 'text',\n}\n\nexport enum PlayButtonThemes {\n Blue = 'blue',\n Grey = 'grey',\n}\n\nexport enum CustomControlsType {\n WithMuteButton = 'with-mute-button',\n WithPlayPauseButton = 'with-play-pause-button',\n}\n\nexport enum CustomControlsButtonPositioning {\n Left = 'left',\n Right = 'right',\n Center = 'center',\n}\n\nexport enum MediaVideoType {\n Default = 'default',\n Player = 'player',\n}\n\nexport enum MediaVideoControlsType {\n Default = 'default',\n Custom = 'custom',\n}\n\nexport enum QuoteType {\n Chevron = 'chevron', // « »\n EnglishDouble = 'english-double', // “ ”\n}\n\n// types\nexport type TextTheme = 'light' | 'dark';\nexport type TextSize = 'xs' | 's' | 'sm' | 'm' | 'l';\nexport type DividerSize = '0' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';\nexport type HeaderWidth = 's' | 'm' | 'l';\nexport type HeaderImageSize = 's' | 'm';\nexport type HeaderOffset = 'default' | 'large';\nexport type Justify = 'start' | 'center' | 'end';\nexport type ColumnsCount = 1 | 2 | 3 | 4;\nexport type LegendTableMarkerType = 'disk' | 'tick';\nexport type LinkTheme = 'file-link' | 'normal' | 'back' | 'underline';\nexport type MediaDirection = 'media-content' | 'content-media';\nexport type PriceDescriptionColor = 'cornflower' | 'black';\nexport type ContentSize = 's' | 'm' | 'l';\nexport type ContentTextSize = 's' | 'm' | 'l';\nexport type ContentTheme = 'default' | 'dark' | 'light';\nexport type FileLinkType = 'vertical' | 'horizontal';\nexport type ImageCardMargins = 's' | 'm';\nexport type LayoutItemContentMargin = 'm' | 'l';\nexport type GravityIconProps = string | {name: keyof typeof icons; color: 'brand' | 'text-color'};\n\n// modifiers\nexport interface Themable {\n theme?: TextTheme;\n}\n\nexport interface Justifyable {\n justify?: Justify;\n}\n\nexport interface Stylable {\n className?: string;\n}\n\nexport interface Animatable {\n animated?: boolean;\n}\n\nexport interface Tabbable {\n tabIndex?: number;\n}\n\nexport interface Roleable {\n role?: React.AriaRole;\n}\n\nexport interface AriaProps {\n ariaProps?: React.AriaAttributes;\n}\n\n//common props\nexport interface Background {\n image?: string;\n color?: string;\n}\n\nexport interface AnchorProps {\n text: string;\n url: string;\n}\n\n/**\n * @deprecated Component VideoBlock will be deleted, which uses this logic\n */\ninterface LoopProps {\n start: number;\n end?: number;\n}\n\n// images\n\nexport enum Device {\n Desktop = 'desktop',\n Mobile = 'mobile',\n Tablet = 'tablet',\n}\n\nexport interface ImageInfoProps\n extends Pick<\n React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>,\n 'aria-describedby' | 'loading'\n >,\n ImageDevicesVisibleProps {\n alt?: string;\n fetchPriority?: 'high' | 'low' | 'auto';\n disableCompress?: boolean;\n}\n\nexport interface ImageObjectProps extends ImageInfoProps {\n src: string;\n}\n\nexport interface ImageDeviceProps extends ImageInfoProps {\n [Device.Desktop]: string;\n [Device.Mobile]: string;\n [Device.Tablet]?: string;\n}\n\nexport interface ImageDevicesVisibleProps {\n hide?: boolean | Partial<Record<Device, boolean>>;\n}\n\nexport type ImageProps = string | ImageObjectProps | ImageDeviceProps;\nexport type ThemedImage = ThemeSupporting<ImageProps>;\n\nexport interface BackgroundImageProps\n extends React.HTMLProps<HTMLDivElement>,\n Partial<ImageDeviceProps>,\n Partial<ImageObjectProps>,\n QAProps,\n ImageDevicesVisibleProps {\n style?: React.CSSProperties;\n imageClassName?: string;\n}\n\n//components props\nexport interface MediaVideoProps extends AnalyticsEventsBase {\n src: string[];\n type?: MediaVideoType;\n loop?: LoopProps | boolean;\n muted?: boolean;\n autoplay?: boolean;\n elapsedTime?: number;\n playButton?: PlayButtonProps;\n controls?: MediaVideoControlsType;\n customControlsOptions?: CustomControlsOptions;\n ariaLabel?: string;\n contain?: boolean;\n onVideoEnd?: () => void;\n ref?: React.Ref<HTMLVideoElement | null>;\n}\n\n// links\nexport interface LinkProps extends AnalyticsEventsBase, Stylable, Tabbable {\n url: string;\n urlTitle?: string;\n text?: string;\n textSize?: TextSize;\n theme?: LinkTheme;\n colorTheme?: TextTheme;\n arrow?: boolean;\n target?: string;\n extraProps?: React.HTMLProps<HTMLAnchorElement>;\n}\n\nexport interface FileLinkProps extends ClassNameProps, Tabbable {\n href: string;\n text: React.ReactNode;\n type?: FileLinkType;\n textSize?: TextSize;\n theme?: ContentTheme;\n urlTitle?: string;\n onClick?: () => void;\n extraProps?: React.HTMLProps<HTMLAnchorElement>;\n}\n\n// buttons\nexport type ButtonTheme =\n | ButtonView\n | 'github'\n | 'app-store'\n | 'google-play'\n | 'scale'\n | 'monochrome';\n\nexport interface ButtonProps extends AnalyticsEventsBase {\n text: string;\n url: string;\n urlTitle?: string;\n primary?: boolean;\n theme?: ButtonTheme;\n img?: ButtonImageProps | string;\n target?: string;\n size?: UikitButtonProps['size'];\n width?: UikitButtonProps['width'];\n extraProps?: UikitButtonProps['extraProps'];\n}\n\nexport type ButtonImagePosition = 'left' | 'right';\n\nexport interface ButtonImageProps {\n url?: string;\n position?: ButtonImagePosition;\n alt?: string;\n iconData?: IconData;\n iconSize?: number;\n className?: string;\n}\n\nexport interface CustomControlsOptions {\n type?: CustomControlsType;\n muteButtonShown?: boolean;\n positioning?: CustomControlsButtonPositioning;\n}\n\nexport interface PlayButtonProps extends ClassNameProps {\n type?: PlayButtonType;\n theme?: PlayButtonThemes;\n text?: string;\n}\n\nexport type ThemedMediaVideoProps = ThemeSupporting<MediaVideoProps>;\n\nexport interface MediaComponentVideoProps extends AnalyticsEventsBase {\n video: MediaVideoProps;\n height?: number;\n ratio?: number | 'auto';\n previewImg?: string;\n}\n\nexport interface MediaComponentVideoIframeProps {\n videoIframe: string;\n}\n\nexport interface MediaComponentYoutubeProps {\n youtube: string;\n previewImg?: string;\n fullscreen?: boolean;\n}\n\nexport interface MediaComponentImageProps {\n image: ImageProps | ImageProps[] | ImageDeviceProps;\n video?: MediaVideoProps;\n parallax?: boolean;\n height?: number;\n disableImageSliderForArrayInput?: boolean;\n}\n\nexport interface MediaComponentDataLensProps {\n dataLens: DataLensProps;\n}\n\nexport interface MediaComponentIframeProps {\n iframe: IframeProps;\n margins?: boolean;\n}\n\nexport interface MediaProps\n extends Animatable,\n Partial<MediaComponentDataLensProps>,\n Partial<MediaComponentYoutubeProps>,\n Partial<MediaComponentVideoIframeProps>,\n Partial<MediaComponentImageProps>,\n Partial<MediaComponentIframeProps>,\n Partial<MediaComponentVideoProps> {\n color?: string;\n videoMicrodata?: {\n name?: string;\n description?: string;\n duration?: string;\n uploadDate?: string;\n contentUrl?: string;\n thumbnailUrl?: string;\n };\n}\n\nexport interface BackgroundMediaProps extends MediaProps, Animatable, QAProps {\n fullWidthMedia?: boolean;\n className?: string;\n mediaClassName?: string;\n}\n\nexport type Coordinate = number[];\n\nexport interface MapBaseProps {\n zoom?: number;\n className?: string;\n forceAspectRatio?: boolean;\n}\n\nexport interface GMapProps extends MapBaseProps {\n address: string;\n}\n\nexport interface YMapProps extends MapBaseProps {\n markers: YMapMarker[];\n disableControls?: boolean;\n disableBalloons?: boolean;\n id: string;\n}\n\nexport interface YMapMarker {\n address?: string;\n coordinate?: Coordinate;\n label?: YMapMarkerLabel;\n}\n\nexport interface YMapMarkerLabel {\n iconCaption?: string;\n iconContent?: string;\n iconColor?: string;\n iconImageHref?: string;\n iconImageSize?: [number, number];\n iconImageOffset?: [number, number];\n iconImageClipRect?: [[number, number], [number, number]];\n iconLayout?: 'default#image';\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n iconShape?: Record<string, any>;\n preset?: string;\n}\n\nexport interface YMapMarkerPrivate extends YMapMarker {\n label?: YMapMarkerLabelPrivate;\n}\n\nexport interface YMapMarkerLabelPrivate extends YMapMarkerLabel {\n cursor?: string;\n interactivityModel?: string;\n}\n\nexport type MapProps = GMapProps | YMapProps;\n\nexport type ThemedMediaProps = ThemeSupporting<MediaProps>;\n\nexport interface DataLensObjectProps {\n id: string;\n theme: 'dark' | 'light';\n}\n\nexport interface IframeProps {\n src: string;\n width?: number;\n height?: number;\n title?: string;\n name?: string;\n}\n\nexport type DataLensProps = string | DataLensObjectProps;\n\nexport interface AuthorItem {\n firstName: string;\n secondName: string;\n description?: string;\n avatar?: ThemeSupporting<ImageProps> | JSX.Element;\n}\n\nexport interface HeaderBreadCrumbsProps extends ClassNameProps {\n items: {\n url: string;\n text: React.ReactNode;\n }[];\n theme?: TextTheme;\n analyticsEvents?: AnalyticsEventsProp;\n}\n\nexport interface TitleItemProps extends Justifyable, TitleItemBaseProps {\n navTitle?: string;\n anchor?: string;\n}\n\nexport interface TitleItemBaseProps {\n text: string;\n textSize?: TextSize;\n url?: string;\n urlTitle?: string;\n custom?: string | React.ReactNode;\n onClick?: () => void;\n}\n\nexport type MediaView = 'fit' | 'full';\n\n// card\nexport type MediaBorder = 'shadow' | 'line' | 'none';\nexport type CardBorder = MediaBorder;\nexport type ControlPosition = 'content' | 'footer';\n\nexport interface CardBaseProps {\n border?: CardBorder;\n}\n\nexport type CardLayoutProps = {\n controlPosition?: ControlPosition;\n};\n\n//price\nexport interface PriceDescriptionProps {\n title: string;\n detailedTitle?: string;\n description: string;\n label?: {\n color: PriceLabelColor;\n text?: string;\n size?: TextSize;\n };\n}\n\nexport interface PriceDetailsSettingsProps {\n title: string;\n description: string;\n}\n\nexport interface PriceDetailsListProps {\n text: string;\n}\n\nexport interface PriceDetailsProps {\n items?: PriceDetailsSettingsProps[] | PriceDetailsListProps[];\n}\n\nexport interface PriceItemProps\n extends PriceDetailsProps,\n PriceDescriptionProps,\n AnalyticsEventsBase {}\n\nexport interface PriceFoldableDetailsProps {\n title: string;\n size?: TextSize;\n titleColor?: PriceDescriptionColor;\n}\n\n/** @deprecated */\nexport interface PriceDetailedProps extends CardBaseProps {\n items: PriceItemProps[];\n description?: {\n titleSize?: TextSize;\n descriptionSize?: TextSize;\n titleColor?: PriceDescriptionColor;\n };\n details?: {\n titleSize?: TextSize;\n descriptionSize?: TextSize;\n };\n priceType?: PriceDetailsType;\n numberGroupItems?: 3 | 4 | 5;\n isCombined?: boolean;\n useMixedView?: boolean;\n foldable?: PriceFoldableDetailsProps;\n labelsDefaultText?: Record<PriceLabelColor, string>;\n}\n\nexport interface AuthorProps extends QAProps {\n author: AuthorItem;\n className?: string;\n authorContainerClassName?: string;\n type?: AuthorType;\n theme?: ContentTheme;\n}\n\nexport interface TitleProps {\n title?: TitleItemProps | string;\n subtitle?: string;\n}\n\nexport interface YandexFormProps extends AnalyticsEventsBase {\n id: number | string;\n containerId?: string;\n theme?: string;\n className?: string;\n headerHeight?: number;\n customFormOrigin?: string;\n customFormSection?: string;\n params?: {[key: string]: string};\n\n onSubmit?: () => void;\n onLoad?: () => void;\n}\n\nexport interface WithBorder {\n border?: MediaBorder;\n /**\n * @deprecated use custom class for media-component\n */\n disableShadow?: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"../../../../src","sources":["models/constructor-items/common.ts"],"names":[],"mappings":";;;AAQA,QAAQ;AACR,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,2BAAa,CAAA;AACjB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,+CAA2B,CAAA;IAC3B,yCAAqB,CAAA;AACzB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,eAMX;AAND,WAAY,eAAe;IACvB,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,8BAAW,CAAA;AACf,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;AACjB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,iCAAa,CAAA;IACb,iCAAa,CAAA;AACjB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,yDAAmC,CAAA;IACnC,oEAA8C,CAAA;AAClD,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,+BAIX;AAJD,WAAY,+BAA+B;IACvC,gDAAa,CAAA;IACb,kDAAe,CAAA;IACf,oDAAiB,CAAA;AACrB,CAAC,EAJW,+BAA+B,+CAA/B,+BAA+B,QAI1C;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;AACrB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAC9B,6CAAmB,CAAA;IACnB,2CAAiB,CAAA;AACrB,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,gCAAmB,CAAA;IACnB,6CAAgC,CAAA;AACpC,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAuED,SAAS;AAET,IAAY,MAIX;AAJD,WAAY,MAAM;IACd,6BAAmB,CAAA;IACnB,2BAAiB,CAAA;IACjB,2BAAiB,CAAA;AACrB,CAAC,EAJW,MAAM,sBAAN,MAAM,QAIjB","sourcesContent":["import * as React from 'react';\n\nimport * as icons from '@gravity-ui/icons';\nimport {ButtonView, IconData, ButtonProps as UikitButtonProps} from '@gravity-ui/uikit';\n\nimport {ThemeSupporting} from '../../utils';\nimport {AnalyticsEventsBase, AnalyticsEventsProp, ClassNameProps, QAProps} from '../common';\n\n// enums\nexport enum AuthorType {\n Column = 'column',\n Line = 'line',\n}\n\nexport enum PriceDetailsType {\n MARKED_LIST = 'marked-list',\n SETTINGS = 'settings',\n}\n\nexport enum PriceLabelColor {\n BLUE = 'blue',\n GREEN = 'green',\n YELLOW = 'yellow',\n PURPLE = 'purple',\n RED = 'red',\n}\n\nexport enum PlayButtonType {\n Default = 'default',\n Text = 'text',\n}\n\nexport enum PlayButtonThemes {\n Blue = 'blue',\n Grey = 'grey',\n}\n\nexport enum CustomControlsType {\n WithMuteButton = 'with-mute-button',\n WithPlayPauseButton = 'with-play-pause-button',\n}\n\nexport enum CustomControlsButtonPositioning {\n Left = 'left',\n Right = 'right',\n Center = 'center',\n}\n\nexport enum MediaVideoType {\n Default = 'default',\n Player = 'player',\n}\n\nexport enum MediaVideoControlsType {\n Default = 'default',\n Custom = 'custom',\n}\n\nexport enum QuoteType {\n Chevron = 'chevron', // « »\n EnglishDouble = 'english-double', // “ ”\n}\n\n// types\nexport type TextTheme = 'light' | 'dark';\nexport type TextSize = 'xs' | 's' | 'sm' | 'm' | 'l';\nexport type DividerSize = '0' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';\nexport type HeaderWidth = 's' | 'm' | 'l';\nexport type HeaderImageSize = 's' | 'm';\nexport type HeaderOffset = 'default' | 'large';\nexport type Justify = 'start' | 'center' | 'end';\nexport type ColumnsCount = 1 | 2 | 3 | 4;\nexport type LegendTableMarkerType = 'disk' | 'tick';\nexport type LinkTheme = 'file-link' | 'normal' | 'back' | 'underline';\nexport type MediaDirection = 'media-content' | 'content-media';\nexport type PriceDescriptionColor = 'cornflower' | 'black';\nexport type ContentSize = 's' | 'm' | 'l';\nexport type ContentTextSize = 's' | 'm' | 'l';\nexport type ContentTheme = 'default' | 'dark' | 'light';\nexport type FileLinkType = 'vertical' | 'horizontal';\nexport type ImageCardMargins = 's' | 'm';\nexport type LayoutItemContentMargin = 'm' | 'l';\nexport type GravityIconProps = string | {name: keyof typeof icons; color: 'brand' | 'text-color'};\n\n// modifiers\nexport interface Themable {\n theme?: TextTheme;\n}\n\nexport interface Justifyable {\n justify?: Justify;\n}\n\nexport interface Stylable {\n className?: string;\n}\n\nexport interface Animatable {\n animated?: boolean;\n}\n\nexport interface Tabbable {\n tabIndex?: number;\n}\n\nexport interface Roleable {\n role?: React.AriaRole;\n}\n\nexport interface AriaProps {\n ariaProps?: React.AriaAttributes;\n}\n\n//common props\nexport interface Background {\n image?: string;\n color?: string;\n}\n\nexport interface AnchorProps {\n text: string;\n url: string;\n}\n\n/**\n * @deprecated Component VideoBlock will be deleted, which uses this logic\n */\ninterface LoopProps {\n start: number;\n end?: number;\n}\n\n// images\n\nexport enum Device {\n Desktop = 'desktop',\n Mobile = 'mobile',\n Tablet = 'tablet',\n}\n\nexport interface ImageInfoProps\n extends Pick<\n React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>,\n 'aria-describedby' | 'loading'\n >,\n ImageDevicesVisibleProps {\n alt?: string;\n fetchPriority?: 'high' | 'low' | 'auto';\n disableCompress?: boolean;\n}\n\nexport interface ImageObjectProps extends ImageInfoProps {\n src: string;\n}\n\nexport interface ImageDeviceProps extends ImageInfoProps {\n [Device.Desktop]: string;\n [Device.Mobile]: string;\n [Device.Tablet]?: string;\n}\n\nexport interface ImageDevicesVisibleProps {\n hide?: boolean | Partial<Record<Device, boolean>>;\n}\n\nexport type ImageProps = string | ImageObjectProps | ImageDeviceProps;\nexport type ThemedImage = ThemeSupporting<ImageProps>;\n\nexport interface BackgroundImageProps\n extends React.HTMLProps<HTMLDivElement>,\n Partial<ImageDeviceProps>,\n Partial<ImageObjectProps>,\n QAProps,\n ImageDevicesVisibleProps {\n style?: React.CSSProperties;\n imageClassName?: string;\n}\n\n//components props\nexport interface MediaVideoProps extends AnalyticsEventsBase {\n src: string[];\n type?: MediaVideoType;\n loop?: LoopProps | boolean;\n muted?: boolean;\n autoplay?: boolean;\n elapsedTime?: number;\n playButton?: PlayButtonProps;\n controls?: MediaVideoControlsType;\n customControlsOptions?: CustomControlsOptions;\n ariaLabel?: string;\n contain?: boolean;\n onVideoEnd?: () => void;\n ref?: React.Ref<HTMLVideoElement | null>;\n}\n\n// links\nexport interface LinkProps extends AnalyticsEventsBase, Stylable, Tabbable {\n url: string;\n urlTitle?: string;\n text?: string;\n textSize?: TextSize;\n theme?: LinkTheme;\n colorTheme?: TextTheme;\n arrow?: boolean;\n target?: string;\n extraProps?: React.HTMLProps<HTMLAnchorElement>;\n}\n\nexport interface FileLinkProps extends ClassNameProps, Tabbable {\n href: string;\n text: React.ReactNode;\n type?: FileLinkType;\n textSize?: TextSize;\n theme?: ContentTheme;\n urlTitle?: string;\n onClick?: () => void;\n extraProps?: React.HTMLProps<HTMLAnchorElement>;\n}\n\n// buttons\nexport type ButtonTheme =\n | ButtonView\n | 'github'\n | 'app-store'\n | 'google-play'\n | 'scale'\n | 'monochrome';\n\nexport interface ButtonProps extends AnalyticsEventsBase {\n text: string;\n url: string;\n urlTitle?: string;\n primary?: boolean;\n theme?: ButtonTheme;\n img?: ButtonImageProps | string;\n target?: string;\n size?: UikitButtonProps['size'];\n width?: UikitButtonProps['width'];\n extraProps?: UikitButtonProps['extraProps'];\n}\n\nexport type ButtonImagePosition = 'left' | 'right';\n\nexport interface ButtonImageProps {\n url?: string;\n position?: ButtonImagePosition;\n alt?: string;\n iconData?: IconData;\n iconSize?: number;\n className?: string;\n}\n\nexport interface CustomControlsOptions {\n type?: CustomControlsType;\n muteButtonShown?: boolean;\n positioning?: CustomControlsButtonPositioning;\n}\n\nexport interface PlayButtonProps extends ClassNameProps {\n type?: PlayButtonType;\n theme?: PlayButtonThemes;\n text?: string;\n}\n\nexport type ThemedMediaVideoProps = ThemeSupporting<MediaVideoProps>;\n\nexport interface MediaComponentVideoProps extends AnalyticsEventsBase {\n video: MediaVideoProps;\n height?: number;\n ratio?: number | 'auto';\n previewImg?: string;\n}\n\nexport interface MediaComponentVideoIframeProps {\n videoIframe: string;\n}\n\nexport interface MediaComponentYoutubeProps {\n youtube: string;\n previewImg?: string;\n fullscreen?: boolean;\n}\n\nexport interface MediaComponentImageProps {\n image: ImageProps | ImageProps[] | ImageDeviceProps;\n video?: MediaVideoProps;\n parallax?: boolean;\n height?: number;\n disableImageSliderForArrayInput?: boolean;\n}\n\nexport interface MediaComponentDataLensProps {\n dataLens: DataLensProps;\n}\n\nexport interface MediaComponentIframeProps {\n iframe: IframeProps;\n margins?: boolean;\n}\n\nexport interface MediaProps\n extends Animatable,\n Partial<MediaComponentDataLensProps>,\n Partial<MediaComponentYoutubeProps>,\n Partial<MediaComponentVideoIframeProps>,\n Partial<MediaComponentImageProps>,\n Partial<MediaComponentIframeProps>,\n Partial<MediaComponentVideoProps> {\n color?: string;\n videoMicrodata?: {\n name?: string;\n description?: string;\n duration?: string;\n uploadDate?: string;\n contentUrl?: string;\n thumbnailUrl?: string;\n };\n}\n\nexport interface BackgroundMediaProps extends MediaProps, Animatable, QAProps {\n fullWidthMedia?: boolean;\n className?: string;\n mediaClassName?: string;\n}\n\nexport type Coordinate = [number, number];\n\nexport interface MapBaseProps {\n zoom?: number;\n className?: string;\n forceAspectRatio?: boolean;\n}\n\nexport interface GMapProps extends MapBaseProps {\n address: string;\n}\n\nexport type YMapMargin =\n | number\n | [vertical: number, horizontal: number]\n | [top: number, right: number, bottom: number, left: number];\n\nexport interface YMapProps extends MapBaseProps {\n markers: YMapMarker[];\n disableControls?: boolean;\n disableBalloons?: boolean;\n areaMargin?: YMapMargin;\n id: string;\n}\n\nexport interface YMapMarker {\n address?: string;\n coordinate?: Coordinate;\n label?: YMapMarkerLabel;\n}\n\nexport interface YMapMarkerLabel {\n iconCaption?: string;\n iconContent?: string;\n iconColor?: string;\n iconImageHref?: string;\n iconImageSize?: [number, number];\n iconImageOffset?: [number, number];\n iconImageClipRect?: [[number, number], [number, number]];\n iconLayout?: 'default#image';\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n iconShape?: Record<string, any>;\n preset?: string;\n}\n\nexport interface YMapMarkerPrivate extends YMapMarker {\n label?: YMapMarkerLabelPrivate;\n}\n\nexport interface YMapMarkerLabelPrivate extends YMapMarkerLabel {\n cursor?: string;\n interactivityModel?: string;\n}\n\nexport type MapProps = GMapProps | YMapProps;\n\nexport type ThemedMediaProps = ThemeSupporting<MediaProps>;\n\nexport interface DataLensObjectProps {\n id: string;\n theme: 'dark' | 'light';\n}\n\nexport interface IframeProps {\n src: string;\n width?: number;\n height?: number;\n title?: string;\n name?: string;\n}\n\nexport type DataLensProps = string | DataLensObjectProps;\n\nexport interface AuthorItem {\n firstName: string;\n secondName: string;\n description?: string;\n avatar?: ThemeSupporting<ImageProps> | JSX.Element;\n}\n\nexport interface HeaderBreadCrumbsProps extends ClassNameProps {\n items: {\n url: string;\n text: React.ReactNode;\n }[];\n theme?: TextTheme;\n analyticsEvents?: AnalyticsEventsProp;\n}\n\nexport interface TitleItemProps extends Justifyable, TitleItemBaseProps {\n navTitle?: string;\n anchor?: string;\n}\n\nexport interface TitleItemBaseProps {\n text: string;\n textSize?: TextSize;\n url?: string;\n urlTitle?: string;\n custom?: string | React.ReactNode;\n onClick?: () => void;\n}\n\nexport type MediaView = 'fit' | 'full';\n\n// card\nexport type MediaBorder = 'shadow' | 'line' | 'none';\nexport type CardBorder = MediaBorder;\nexport type ControlPosition = 'content' | 'footer';\n\nexport interface CardBaseProps {\n border?: CardBorder;\n}\n\nexport type CardLayoutProps = {\n controlPosition?: ControlPosition;\n};\n\n//price\nexport interface PriceDescriptionProps {\n title: string;\n detailedTitle?: string;\n description: string;\n label?: {\n color: PriceLabelColor;\n text?: string;\n size?: TextSize;\n };\n}\n\nexport interface PriceDetailsSettingsProps {\n title: string;\n description: string;\n}\n\nexport interface PriceDetailsListProps {\n text: string;\n}\n\nexport interface PriceDetailsProps {\n items?: PriceDetailsSettingsProps[] | PriceDetailsListProps[];\n}\n\nexport interface PriceItemProps\n extends PriceDetailsProps,\n PriceDescriptionProps,\n AnalyticsEventsBase {}\n\nexport interface PriceFoldableDetailsProps {\n title: string;\n size?: TextSize;\n titleColor?: PriceDescriptionColor;\n}\n\n/** @deprecated */\nexport interface PriceDetailedProps extends CardBaseProps {\n items: PriceItemProps[];\n description?: {\n titleSize?: TextSize;\n descriptionSize?: TextSize;\n titleColor?: PriceDescriptionColor;\n };\n details?: {\n titleSize?: TextSize;\n descriptionSize?: TextSize;\n };\n priceType?: PriceDetailsType;\n numberGroupItems?: 3 | 4 | 5;\n isCombined?: boolean;\n useMixedView?: boolean;\n foldable?: PriceFoldableDetailsProps;\n labelsDefaultText?: Record<PriceLabelColor, string>;\n}\n\nexport interface AuthorProps extends QAProps {\n author: AuthorItem;\n className?: string;\n authorContainerClassName?: string;\n type?: AuthorType;\n theme?: ContentTheme;\n}\n\nexport interface TitleProps {\n title?: TitleItemProps | string;\n subtitle?: string;\n}\n\nexport interface YandexFormProps extends AnalyticsEventsBase {\n id: number | string;\n containerId?: string;\n theme?: string;\n className?: string;\n headerHeight?: number;\n customFormOrigin?: string;\n customFormSection?: string;\n params?: {[key: string]: string};\n\n onSubmit?: () => void;\n onLoad?: () => void;\n}\n\nexport interface WithBorder {\n border?: MediaBorder;\n /**\n * @deprecated use custom class for media-component\n */\n disableShadow?: boolean;\n}\n"]}
|