@doyourjob/gravity-ui-page-constructor 5.31.286 → 5.31.287

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/build/cjs/blocks/Header/schema.d.ts +81 -3
  2. package/build/cjs/blocks/HeaderSlider/schema.d.ts +27 -1
  3. package/build/cjs/blocks/Media/schema.d.ts +54 -2
  4. package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +27 -1
  5. package/build/cjs/blocks/Tabs/schema.d.ts +27 -1
  6. package/build/cjs/components/Media/Iframe/Iframe.js +18 -4
  7. package/build/cjs/components/Media/Iframe/utils.d.ts +2 -0
  8. package/build/cjs/components/Media/Iframe/utils.js +29 -0
  9. package/build/cjs/models/constructor-items/common.d.ts +2 -1
  10. package/build/cjs/schema/constants.d.ts +27 -1
  11. package/build/cjs/schema/validators/common.d.ts +27 -1
  12. package/build/cjs/schema/validators/common.js +28 -1
  13. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +27 -1
  14. package/build/cjs/sub-blocks/MediaCard/schema.d.ts +27 -1
  15. package/build/esm/blocks/Header/schema.d.ts +81 -3
  16. package/build/esm/blocks/HeaderSlider/schema.d.ts +27 -1
  17. package/build/esm/blocks/Media/schema.d.ts +54 -2
  18. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +27 -1
  19. package/build/esm/blocks/Tabs/schema.d.ts +27 -1
  20. package/build/esm/components/Media/Iframe/Iframe.js +18 -4
  21. package/build/esm/components/Media/Iframe/utils.d.ts +2 -0
  22. package/build/esm/components/Media/Iframe/utils.js +25 -0
  23. package/build/esm/models/constructor-items/common.d.ts +2 -1
  24. package/build/esm/schema/constants.d.ts +27 -1
  25. package/build/esm/schema/validators/common.d.ts +27 -1
  26. package/build/esm/schema/validators/common.js +28 -1
  27. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +27 -1
  28. package/build/esm/sub-blocks/MediaCard/schema.d.ts +27 -1
  29. package/package.json +1 -1
  30. package/schema/index.js +1 -1
  31. package/server/models/constructor-items/common.d.ts +2 -1
  32. package/widget/index.js +1 -1
@@ -738,7 +738,33 @@ export declare const HeaderSliderBlock: {
738
738
  type: string;
739
739
  };
740
740
  height: {
741
- type: string;
741
+ oneOf: ({
742
+ type: string;
743
+ optionName: string;
744
+ additionalProperties?: undefined;
745
+ properties?: undefined;
746
+ } | {
747
+ type: string;
748
+ additionalProperties: boolean;
749
+ optionName: string;
750
+ properties: {
751
+ all: {
752
+ type: string;
753
+ };
754
+ sm: {
755
+ type: string;
756
+ };
757
+ md: {
758
+ type: string;
759
+ };
760
+ lg: {
761
+ type: string;
762
+ };
763
+ xl: {
764
+ type: string;
765
+ };
766
+ };
767
+ })[];
742
768
  };
743
769
  width: {
744
770
  type: string;
@@ -299,7 +299,33 @@ export declare const Media: {
299
299
  type: string;
300
300
  };
301
301
  height: {
302
- type: string;
302
+ oneOf: ({
303
+ type: string;
304
+ optionName: string;
305
+ additionalProperties?: undefined;
306
+ properties?: undefined;
307
+ } | {
308
+ type: string;
309
+ additionalProperties: boolean;
310
+ optionName: string;
311
+ properties: {
312
+ all: {
313
+ type: string;
314
+ };
315
+ sm: {
316
+ type: string;
317
+ };
318
+ md: {
319
+ type: string;
320
+ };
321
+ lg: {
322
+ type: string;
323
+ };
324
+ xl: {
325
+ type: string;
326
+ };
327
+ };
328
+ })[];
303
329
  };
304
330
  width: {
305
331
  type: string;
@@ -1178,7 +1204,33 @@ export declare const MediaBlock: {
1178
1204
  type: string;
1179
1205
  };
1180
1206
  height: {
1181
- type: string;
1207
+ oneOf: ({
1208
+ type: string;
1209
+ optionName: string;
1210
+ additionalProperties?: undefined;
1211
+ properties?: undefined;
1212
+ } | {
1213
+ type: string;
1214
+ additionalProperties: boolean;
1215
+ optionName: string;
1216
+ properties: {
1217
+ all: {
1218
+ type: string;
1219
+ };
1220
+ sm: {
1221
+ type: string;
1222
+ };
1223
+ md: {
1224
+ type: string;
1225
+ };
1226
+ lg: {
1227
+ type: string;
1228
+ };
1229
+ xl: {
1230
+ type: string;
1231
+ };
1232
+ };
1233
+ })[];
1182
1234
  };
1183
1235
  width: {
1184
1236
  type: string;
@@ -315,7 +315,33 @@ export declare const PromoFeaturesItem: {
315
315
  type: string;
316
316
  };
317
317
  height: {
318
- type: string;
318
+ oneOf: ({
319
+ type: string;
320
+ optionName: string;
321
+ additionalProperties?: undefined;
322
+ properties?: undefined;
323
+ } | {
324
+ type: string;
325
+ additionalProperties: boolean;
326
+ optionName: string;
327
+ properties: {
328
+ all: {
329
+ type: string;
330
+ };
331
+ sm: {
332
+ type: string;
333
+ };
334
+ md: {
335
+ type: string;
336
+ };
337
+ lg: {
338
+ type: string;
339
+ };
340
+ xl: {
341
+ type: string;
342
+ };
343
+ };
344
+ })[];
319
345
  };
320
346
  width: {
321
347
  type: string;
@@ -314,7 +314,33 @@ export declare const tabsItem: {
314
314
  type: string;
315
315
  };
316
316
  height: {
317
- type: string;
317
+ oneOf: ({
318
+ type: string;
319
+ optionName: string;
320
+ additionalProperties?: undefined;
321
+ properties?: undefined;
322
+ } | {
323
+ type: string;
324
+ additionalProperties: boolean;
325
+ optionName: string;
326
+ properties: {
327
+ all: {
328
+ type: string;
329
+ };
330
+ sm: {
331
+ type: string;
332
+ };
333
+ md: {
334
+ type: string;
335
+ };
336
+ lg: {
337
+ type: string;
338
+ };
339
+ xl: {
340
+ type: string;
341
+ };
342
+ };
343
+ })[];
318
344
  };
319
345
  width: {
320
346
  type: string;
@@ -1,13 +1,27 @@
1
- import React from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import { block } from '../../../utils';
3
3
  import { i18n } from './i18n';
4
+ import { getIframeHeight } from './utils';
4
5
  import './Iframe.css';
5
6
  const b = block('media-component-iframe');
7
+ const getViewportWidth = () => (typeof window === 'undefined' ? 0 : window.innerWidth);
6
8
  const Iframe = (props) => {
7
9
  const { iframe, margins = true } = props;
8
- const { height = 400, src, width, name, title } = iframe;
9
- return iframe ? (React.createElement("div", { className: b({ margins }), style: { height } },
10
- React.createElement("iframe", { className: b('item'), loading: "lazy", title: title || i18n('iframe-title'), frameBorder: 0, src: src, width: width, height: height, name: name,
10
+ const { height, src, width, name, title } = iframe;
11
+ const shouldTrackViewportWidth = typeof height === 'object';
12
+ const [viewportWidth, setViewportWidth] = useState(() => shouldTrackViewportWidth ? getViewportWidth() : 0);
13
+ const resolvedHeight = getIframeHeight(height, viewportWidth);
14
+ useEffect(() => {
15
+ if (!shouldTrackViewportWidth) {
16
+ return undefined;
17
+ }
18
+ const handleResize = () => setViewportWidth(getViewportWidth());
19
+ handleResize();
20
+ window.addEventListener('resize', handleResize);
21
+ return () => window.removeEventListener('resize', handleResize);
22
+ }, [shouldTrackViewportWidth]);
23
+ return iframe ? (React.createElement("div", { className: b({ margins }), style: { height: resolvedHeight } },
24
+ React.createElement("iframe", { className: b('item'), loading: "lazy", title: title || i18n('iframe-title'), frameBorder: 0, src: src, width: width, height: resolvedHeight, name: name,
11
25
  /*
12
26
  1. allow: дает права на камеру, микрофон, полноэкранный режим
13
27
  и демонстрацию экрана (необходимы для Zoom).
@@ -0,0 +1,2 @@
1
+ import { ResponsiveIframeHeight } from '../../../models';
2
+ export declare const getIframeHeight: (height: number | ResponsiveIframeHeight | undefined, viewportWidth: number) => number;
@@ -0,0 +1,25 @@
1
+ import { BREAKPOINTS } from '../../../constants';
2
+ const responsiveHeightBreakpoints = [
3
+ ['all', BREAKPOINTS.xs],
4
+ ['sm', BREAKPOINTS.sm],
5
+ ['md', BREAKPOINTS.md],
6
+ ['lg', BREAKPOINTS.lg],
7
+ ['xl', BREAKPOINTS.xl],
8
+ ];
9
+ export const getIframeHeight = (height, viewportWidth) => {
10
+ var _a;
11
+ if (height === undefined) {
12
+ return 400;
13
+ }
14
+ if (typeof height === 'number') {
15
+ return height;
16
+ }
17
+ let result = (_a = height.all) !== null && _a !== void 0 ? _a : 400;
18
+ responsiveHeightBreakpoints.forEach(([breakpoint, minWidth]) => {
19
+ const breakpointHeight = height[breakpoint];
20
+ if (viewportWidth >= minWidth && breakpointHeight !== undefined) {
21
+ result = breakpointHeight;
22
+ }
23
+ });
24
+ return result;
25
+ };
@@ -258,10 +258,11 @@ export interface DataLensObjectProps {
258
258
  id: string;
259
259
  theme: 'dark' | 'light';
260
260
  }
261
+ export type ResponsiveIframeHeight = Partial<Record<'all' | 'sm' | 'md' | 'lg' | 'xl', number>>;
261
262
  export interface IframeProps {
262
263
  src: string;
263
264
  width?: number;
264
- height?: number;
265
+ height?: number | ResponsiveIframeHeight;
265
266
  title?: string;
266
267
  name?: string;
267
268
  }
@@ -4207,7 +4207,33 @@ export declare const cardSchemas: {
4207
4207
  type: string;
4208
4208
  };
4209
4209
  height: {
4210
- type: string;
4210
+ oneOf: ({
4211
+ type: string;
4212
+ optionName: string;
4213
+ additionalProperties?: undefined;
4214
+ properties?: undefined;
4215
+ } | {
4216
+ type: string;
4217
+ additionalProperties: boolean;
4218
+ optionName: string;
4219
+ properties: {
4220
+ all: {
4221
+ type: string;
4222
+ };
4223
+ sm: {
4224
+ type: string;
4225
+ };
4226
+ md: {
4227
+ type: string;
4228
+ };
4229
+ lg: {
4230
+ type: string;
4231
+ };
4232
+ xl: {
4233
+ type: string;
4234
+ };
4235
+ };
4236
+ })[];
4211
4237
  };
4212
4238
  width: {
4213
4239
  type: string;
@@ -1502,7 +1502,33 @@ export declare const MediaProps: {
1502
1502
  type: string;
1503
1503
  };
1504
1504
  height: {
1505
- type: string;
1505
+ oneOf: ({
1506
+ type: string;
1507
+ optionName: string;
1508
+ additionalProperties?: undefined;
1509
+ properties?: undefined;
1510
+ } | {
1511
+ type: string;
1512
+ additionalProperties: boolean;
1513
+ optionName: string;
1514
+ properties: {
1515
+ all: {
1516
+ type: string;
1517
+ };
1518
+ sm: {
1519
+ type: string;
1520
+ };
1521
+ md: {
1522
+ type: string;
1523
+ };
1524
+ lg: {
1525
+ type: string;
1526
+ };
1527
+ xl: {
1528
+ type: string;
1529
+ };
1530
+ };
1531
+ })[];
1506
1532
  };
1507
1533
  width: {
1508
1534
  type: string;
@@ -608,7 +608,34 @@ const IframeProps = {
608
608
  type: 'string',
609
609
  },
610
610
  height: {
611
- type: 'number',
611
+ oneOf: [
612
+ {
613
+ type: 'number',
614
+ optionName: 'constant',
615
+ },
616
+ {
617
+ type: 'object',
618
+ additionalProperties: false,
619
+ optionName: 'responsive',
620
+ properties: {
621
+ all: {
622
+ type: 'number',
623
+ },
624
+ sm: {
625
+ type: 'number',
626
+ },
627
+ md: {
628
+ type: 'number',
629
+ },
630
+ lg: {
631
+ type: 'number',
632
+ },
633
+ xl: {
634
+ type: 'number',
635
+ },
636
+ },
637
+ },
638
+ ],
612
639
  },
613
640
  width: {
614
641
  type: 'number',
@@ -347,7 +347,33 @@ export declare const LayoutItem: {
347
347
  type: string;
348
348
  };
349
349
  height: {
350
- type: string;
350
+ oneOf: ({
351
+ type: string;
352
+ optionName: string;
353
+ additionalProperties?: undefined;
354
+ properties?: undefined;
355
+ } | {
356
+ type: string;
357
+ additionalProperties: boolean;
358
+ optionName: string;
359
+ properties: {
360
+ all: {
361
+ type: string;
362
+ };
363
+ sm: {
364
+ type: string;
365
+ };
366
+ md: {
367
+ type: string;
368
+ };
369
+ lg: {
370
+ type: string;
371
+ };
372
+ xl: {
373
+ type: string;
374
+ };
375
+ };
376
+ })[];
351
377
  };
352
378
  width: {
353
379
  type: string;
@@ -341,7 +341,33 @@ export declare const MediaCardBlock: {
341
341
  type: string;
342
342
  };
343
343
  height: {
344
- type: string;
344
+ oneOf: ({
345
+ type: string;
346
+ optionName: string;
347
+ additionalProperties?: undefined;
348
+ properties?: undefined;
349
+ } | {
350
+ type: string;
351
+ additionalProperties: boolean;
352
+ optionName: string;
353
+ properties: {
354
+ all: {
355
+ type: string;
356
+ };
357
+ sm: {
358
+ type: string;
359
+ };
360
+ md: {
361
+ type: string;
362
+ };
363
+ lg: {
364
+ type: string;
365
+ };
366
+ xl: {
367
+ type: string;
368
+ };
369
+ };
370
+ })[];
345
371
  };
346
372
  width: {
347
373
  type: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doyourjob/gravity-ui-page-constructor",
3
- "version": "5.31.286",
3
+ "version": "5.31.287",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {