@gravity-ui/page-constructor 7.4.0 → 7.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/build/cjs/blocks/ContentLayout/ContentLayout.js +4 -2
  2. package/build/cjs/blocks/ContentLayout/ContentLayout.js.map +1 -1
  3. package/build/cjs/blocks/Header/Header.js +6 -13
  4. package/build/cjs/blocks/Header/Header.js.map +1 -1
  5. package/build/cjs/containers/PageConstructor/Provider.js +2 -0
  6. package/build/cjs/containers/PageConstructor/Provider.js.map +1 -1
  7. package/build/cjs/context/windowWidthContext/BreakpointContext.d.ts +4 -0
  8. package/build/cjs/context/windowWidthContext/BreakpointContext.js +33 -0
  9. package/build/cjs/context/windowWidthContext/BreakpointContext.js.map +1 -0
  10. package/build/cjs/context/windowWidthContext/index.d.ts +1 -0
  11. package/build/cjs/context/windowWidthContext/index.js +5 -0
  12. package/build/cjs/context/windowWidthContext/index.js.map +1 -0
  13. package/build/esm/blocks/ContentLayout/ContentLayout.js +4 -2
  14. package/build/esm/blocks/ContentLayout/ContentLayout.js.map +1 -1
  15. package/build/esm/blocks/Header/Header.js +6 -13
  16. package/build/esm/blocks/Header/Header.js.map +1 -1
  17. package/build/esm/containers/PageConstructor/Provider.js +2 -0
  18. package/build/esm/containers/PageConstructor/Provider.js.map +1 -1
  19. package/build/esm/context/windowWidthContext/BreakpointContext.d.ts +4 -0
  20. package/build/esm/context/windowWidthContext/BreakpointContext.js +27 -0
  21. package/build/esm/context/windowWidthContext/BreakpointContext.js.map +1 -0
  22. package/build/esm/context/windowWidthContext/index.d.ts +1 -0
  23. package/build/esm/context/windowWidthContext/index.js +2 -0
  24. package/build/esm/context/windowWidthContext/index.js.map +1 -0
  25. package/package.json +1 -1
  26. package/widget/index.js +1 -1
@@ -6,11 +6,12 @@ const react_1 = require("react");
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const React = tslib_1.__importStar(require("react"));
8
8
  const components_1 = require("../../components/index.js");
9
- const mobileContext_1 = require("../../context/mobileContext/index.js");
10
9
  const theme_1 = require("../../context/theme/index.js");
11
10
  const grid_1 = require("../../grid/index.js");
12
11
  const sub_blocks_1 = require("../../sub-blocks/index.js");
13
12
  const utils_1 = require("../../utils/index.js");
13
+ const windowWidthContext_1 = require("../../context/windowWidthContext/index.js");
14
+ const constants_1 = require("../../constants.js");
14
15
  const b = (0, utils_1.block)('content-layout-block');
15
16
  function getFileTextSize(size) {
16
17
  switch (size) {
@@ -33,7 +34,8 @@ function getTextWidth(size) {
33
34
  }
34
35
  }
35
36
  const ContentLayoutBlock = (props) => {
36
- const isMobile = React.useContext(mobileContext_1.MobileContext);
37
+ const windowWidth = (0, windowWidthContext_1.useWindowWidth)();
38
+ const isMobile = windowWidth <= constants_1.BREAKPOINTS.sm;
37
39
  const { textContent, fileContent, size = 'l', background, centered, theme = 'default', textWidth = 'm', } = props;
38
40
  const colSizes = React.useMemo(() => getTextWidth(textWidth), [textWidth]);
39
41
  const globalTheme = (0, theme_1.useTheme)();
@@ -1 +1 @@
1
- {"version":3,"file":"ContentLayout.js","sourceRoot":"../../../../src","sources":["blocks/ContentLayout/ContentLayout.tsx"],"names":[],"mappings":";;;;;;AAAA,qDAA+B;AAE/B,0DAA2D;AAC3D,wEAA0D;AAC1D,wDAA6C;AAC7C,8CAA+B;AAE/B,0DAAyC;AACzC,gDAAkD;AAIlD,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,sBAAsB,CAAC,CAAC;AAExC,SAAS,eAAe,CAAC,IAAiB;IACtC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,GAAG;YACJ,OAAO,GAAG,CAAC;QACf,KAAK,GAAG,CAAC;QACT;YACI,OAAO,GAAG,CAAC;IACnB,CAAC;AACL,CAAC;AAED,SAAS,YAAY,CAAC,IAAqB;IACvC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,GAAG;YACJ,OAAO,EAAC,GAAG,EAAE,EAAE,E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AQ,YAC9D,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACvB,2BAAC,qBAAQ,IACL,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,KAChB,IAAI,EACR,GAAG,EAAE,IAAI,CAAC,IAAI,EACd,IAAI,EAAC,YAAY,EACjB,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,EAC/B,KAAK,EAAE,KAAK,GACd,CACL,CAAC,GACA,CACT,EACA,UAAU,IAAI,CACX,gCAAK,SAAS,EAAE,CAAC,CAAC,YAAY,CAAC,YAC3B,uBAAC,4BAAe,IACZ,SAAS,EAAE,CAAC,CAAC,iBAAiB,CAAC,KAC3B,gBAAgB,EACpB,IAAI,EAAE,QAAQ,GAChB,GACA,CACT,IACC,CACT,CAAC;AACN,CAAC,CAAC;AAnDW,QAAA,kBAAkB,sBAmD7B;AACF,kBAAe,0BAAkB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BackgroundImage, FileLink} from '../../components';\nimport {MobileContext} from '../../context/mobileContext';\nimport {useTheme} from '../../context/theme';\nimport {Col} from '../../grid';\nimport {ContentLayoutBlockProps, ContentSize, ContentTextSize} from '../../models';\nimport {Content} from '../../sub-blocks';\nimport {block, getThemedValue} from '../../utils';\n\nimport './ContentLayout.scss';\n\nconst b = block('content-layout-block');\n\nfunction getFileTextSize(size: ContentSize) {\n switch (size) {\n case 's':\n return 's';\n case 'l':\n default:\n return 'l';\n }\n}\n\nfunction getTextWidth(size: ContentTextSize) {\n switch (size) {\n case 's':\n return {all: 12, md: 6};\n case 'l':\n return {all: 12, md: 12};\n case 'm':\n default:\n return {all: 12, md: 8};\n }\n}\n\nexport const ContentLayoutBlock = (props: ContentLayoutBlockProps) => {\n const isMobile = React.useContext(MobileContext);\n const {\n textContent,\n fileContent,\n size = 'l',\n background,\n centered,\n theme = 'default',\n textWidth = 'm',\n } = props;\n\n const colSizes = React.useMemo(() => getTextWidth(textWidth), [textWidth]);\n const globalTheme = useTheme();\n const themedBackground = getThemedValue(background, globalTheme);\n\n return (\n <div className={b({size, theme, background: Boolean(background)})}>\n <Content\n className={b('content')}\n {...textContent}\n size={size}\n centered={centered}\n colSizes={colSizes}\n theme={theme}\n />\n {fileContent && (\n <Col className={b('files', {size, centered})} reset sizes={colSizes}>\n {fileContent.map((file) => (\n <FileLink\n className={b('file')}\n {...file}\n key={file.href}\n type=\"horizontal\"\n textSize={getFileTextSize(size)}\n theme={theme}\n />\n ))}\n </Col>\n )}\n {background && (\n <div className={b('background')}>\n <BackgroundImage\n className={b('background-item')}\n {...themedBackground}\n hide={isMobile}\n />\n </div>\n )}\n </div>\n );\n};\nexport default ContentLayoutBlock;\n"]}
1
+ {"version":3,"file":"ContentLayout.js","sourceRoot":"../../../../src","sources":["blocks/ContentLayout/ContentLayout.tsx"],"names":[],"mappings":";;;;;;AAAA,qDAA+B;AAE/B,0DAA2D;AAC3D,wDAA6C;AAC7C,8CAA+B;AAE/B,0DAAyC;AACzC,gDAAkD;AAGlD,kFAAgE;AAChE,kDAA4C;AAE5C,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,sBAAsB,CAAC,CAAC;AAExC,SAAS,eAAe,CAAC,IAAiB;IACtC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,GAAG;YACJ,OAAO,GAAG,CAAC;QACf,KAAK,GAAG,CAAC;QACT;YACI,OAAO,GAAG,CAAC;IACnB,CAAC;AACL,CAAC;AAED,SAAS,YAAY,CAAC,IAAqB;IACvC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,GAAG;YACJ,OAAO,EAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAC,CAAC;QAC5B,KAAK,GAAG;YACJ,OAAO,EAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC,CAAC;QAC7B,KAAK,GAAG,CAAC;QACT;YACI,OAAO,EAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAC,CAAC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AAI,EAAC,YAAY,EACjB,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,EAC/B,KAAK,EAAE,KAAK,GACd,CACL,CAAC,GACA,CACT,EACA,UAAU,IAAI,CACX,gCAAK,SAAS,EAAE,CAAC,CAAC,YAAY,CAAC,YAC3B,uBAAC,4BAAe,IACZ,SAAS,EAAE,CAAC,CAAC,iBAAiB,CAAC,KAC3B,gBAAgB,EACpB,IAAI,EAAE,QAAQ,GAChB,GACA,CACT,IACC,CACT,CAAC;AACN,CAAC,CAAC;AArDW,QAAA,kBAAkB,sBAqD7B;AACF,kBAAe,0BAAkB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BackgroundImage, FileLink} from '../../components';\nimport {useTheme} from '../../context/theme';\nimport {Col} from '../../grid';\nimport {ContentLayoutBlockProps, ContentSize, ContentTextSize} from '../../models';\nimport {Content} from '../../sub-blocks';\nimport {block, getThemedValue} from '../../utils';\n\nimport './ContentLayout.scss';\nimport {useWindowWidth} from '../../context/windowWidthContext';\nimport {BREAKPOINTS} from '../../constants';\n\nconst b = block('content-layout-block');\n\nfunction getFileTextSize(size: ContentSize) {\n switch (size) {\n case 's':\n return 's';\n case 'l':\n default:\n return 'l';\n }\n}\n\nfunction getTextWidth(size: ContentTextSize) {\n switch (size) {\n case 's':\n return {all: 12, md: 6};\n case 'l':\n return {all: 12, md: 12};\n case 'm':\n default:\n return {all: 12, md: 8};\n }\n}\n\nexport const ContentLayoutBlock = (props: ContentLayoutBlockProps) => {\n const windowWidth = useWindowWidth();\n const isMobile = windowWidth <= BREAKPOINTS.sm;\n\n const {\n textContent,\n fileContent,\n size = 'l',\n background,\n centered,\n theme = 'default',\n textWidth = 'm',\n } = props;\n\n const colSizes = React.useMemo(() => getTextWidth(textWidth), [textWidth]);\n const globalTheme = useTheme();\n const themedBackground = getThemedValue(background, globalTheme);\n\n return (\n <div className={b({size, theme, background: Boolean(background)})}>\n <Content\n className={b('content')}\n {...textContent}\n size={size}\n centered={centered}\n colSizes={colSizes}\n theme={theme}\n />\n {fileContent && (\n <Col className={b('files', {size, centered})} reset sizes={colSizes}>\n {fileContent.map((file) => (\n <FileLink\n className={b('file')}\n {...file}\n key={file.href}\n type=\"horizontal\"\n textSize={getFileTextSize(size)}\n theme={theme}\n />\n ))}\n </Col>\n )}\n {background && (\n <div className={b('background')}>\n <BackgroundImage\n className={b('background-item')}\n {...themedBackground}\n hide={isMobile}\n />\n </div>\n )}\n </div>\n );\n};\nexport default ContentLayoutBlock;\n"]}
@@ -5,17 +5,17 @@ const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  /* eslint-disable complexity */
7
7
  const uikit_1 = require("@gravity-ui/uikit");
8
- const React = tslib_1.__importStar(require("react"));
9
8
  const components_1 = require("../../components/index.js");
10
9
  const HeaderBreadcrumbs_1 = tslib_1.__importDefault(require("../../components/HeaderBreadcrumbs/HeaderBreadcrumbs.js"));
11
10
  const utils_1 = require("../../components/Media/Image/utils.js");
12
11
  const YFMWrapper_1 = tslib_1.__importDefault(require("../../components/YFMWrapper/YFMWrapper.js"));
13
- const mobileContext_1 = require("../../context/mobileContext/index.js");
14
12
  const theme_1 = require("../../context/theme/index.js");
15
13
  const grid_1 = require("../../grid/index.js");
16
14
  const utils_2 = require("../../utils/index.js");
17
15
  const microdata_1 = require("../../utils/microdata.js");
18
16
  const utils_3 = require("./utils.js");
17
+ const windowWidthContext_1 = require("../../context/windowWidthContext/index.js");
18
+ const constants_1 = require("../../constants.js");
19
19
  const b = (0, utils_2.block)('header-block');
20
20
  const Background = ({ background, isMobile }) => {
21
21
  const { url, image, fullWidthMedia, video, color } = background;
@@ -26,7 +26,8 @@ const Background = ({ background, isMobile }) => {
26
26
  const FullWidthBackground = ({ background }) => ((0, jsx_runtime_1.jsx)("div", { className: b('background', { ['full-width']: true }), style: { backgroundColor: background?.color } }));
27
27
  const HeaderBlock = (props) => {
28
28
  const { title, overtitle, description, buttons, image, video, width = 'm', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', className, breadcrumbs, status, renderTitle, children, mediaView = 'full', centered, additionalInfo, } = props;
29
- const isMobile = React.useContext(mobileContext_1.MobileContext);
29
+ const windowWidth = (0, windowWidthContext_1.useWindowWidth)();
30
+ const isMobile = windowWidth <= constants_1.BREAKPOINTS.sm;
30
31
  const theme = (0, theme_1.useTheme)();
31
32
  const hasRightSideImage = Boolean((image || video) && !centered);
32
33
  const curImageSize = imageSize || (0, utils_3.getImageSize)(width);
@@ -38,10 +39,7 @@ const HeaderBlock = (props) => {
38
39
  const backgroundThemed = background && (0, utils_2.getThemedValue)(background, theme);
39
40
  const imageThemed = image && (0, utils_2.getThemedValue)(image, theme);
40
41
  const videoThemed = video && (0, utils_2.getThemedValue)(video, theme);
41
- const mediaWithMicrodata = (0, microdata_1.mergeVideoMicrodata)({ video: videoThemed, image: imageThemed }, {
42
- name: title,
43
- description,
44
- });
42
+ const mediaWithMicrodata = (0, microdata_1.mergeVideoMicrodata)({ video: videoThemed, image: imageThemed }, { name: title, description });
45
43
  const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;
46
44
  const titleId = (0, uikit_1.useUniqId)();
47
45
  return ((0, jsx_runtime_1.jsxs)("header", { className: b({
@@ -53,12 +51,7 @@ const HeaderBlock = (props) => {
53
51
  offset,
54
52
  theme: textTheme,
55
53
  'vertical-offset': curVerticalOffset,
56
- }), children: (0, jsx_runtime_1.jsxs)(grid_1.Col, { sizes: titleSizes, className: b('content-inner', { centered }), children: [overtitle && ((0, jsx_runtime_1.jsx)("div", { className: b('overtitle'), children: typeof overtitle === 'string' ? ((0, jsx_runtime_1.jsx)(YFMWrapper_1.default, { tagName: "div", className: b('overtitle'), content: overtitle, modifiers: {
57
- constructor: true,
58
- } })) : (overtitle) })), (0, jsx_runtime_1.jsxs)(YFMWrapper_1.default, { content: title, contentClassName: b('title'), className: b('title-container'), modifiers: {
59
- constructor: true,
60
- constructorTheme: textTheme,
61
- }, tagName: "h1", contentPosition: "end", children: [status, renderTitle ? renderTitle(title) : null] }), description && ((0, jsx_runtime_1.jsx)("div", { className: b('description', { theme: textTheme }), children: (0, jsx_runtime_1.jsx)(YFMWrapper_1.default, { content: description, modifiers: {
54
+ }), children: (0, jsx_runtime_1.jsxs)(grid_1.Col, { sizes: titleSizes, className: b('content-inner', { centered }), children: [overtitle && ((0, jsx_runtime_1.jsx)("div", { className: b('overtitle'), children: typeof overtitle === 'string' ? ((0, jsx_runtime_1.jsx)(YFMWrapper_1.default, { tagName: "div", className: b('overtitle'), content: overtitle, modifiers: { constructor: true } })) : (overtitle) })), (0, jsx_runtime_1.jsxs)(YFMWrapper_1.default, { content: title, contentClassName: b('title'), className: b('title-container'), modifiers: { constructor: true, constructorTheme: textTheme }, tagName: "h1", contentPosition: "end", children: [status, renderTitle ? renderTitle(title) : null] }), description && ((0, jsx_runtime_1.jsx)("div", { className: b('description', { theme: textTheme }), children: (0, jsx_runtime_1.jsx)(YFMWrapper_1.default, { content: description, modifiers: {
62
55
  constructor: true,
63
56
  constructorTheme: textTheme,
64
57
  } }) })), additionalInfo && ((0, jsx_runtime_1.jsx)("div", { className: b('additional-info', { theme: textTheme }), children: (0, jsx_runtime_1.jsx)(YFMWrapper_1.default, { content: additionalInfo, modifiers: {
@@ -1 +1 @@
1
- {"version":3,"file":"Header.js","sourceRoot":"../../../../src","sources":["blocks/Header/Header.tsx"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,6CAA4C;AAC5C,qDAA+B;AAE/B,0DAA2D;AAC3D,wHAAqF;AACrF,iEAAiE;AACjE,mGAAgE;AAChE,wEAA0D;AAC1D,wDAA6C;AAC7C,8CAA0C;AAE1C,gDAAkD;AAClD,wDAA0D;AAE1D,sCAAyE;AAGzE,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,cAAc,CAAC,CAAC;AAShC,MAAM,UAAU,GAAG,CAAC,EAAC,UAAU,EAAE,QAAQ,EAAkB,EAAE,EAAE;IAC3D,M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AI,EAAE,MAAM,CAAC,GAAG,YACxB,uBAAC,mBAAM,IAEH,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,EACtB,IAAI,EAAC,IAAI,EACT,UAAU,EAAE;gEACR,kBAAkB,EAAE,OAAO;gEAC3B,GAAG,MAAM,CAAC,UAAU;6DACvB,KACG,MAAM,IAPL,KAAK,CAQZ,IAV6B,KAAK,CAW3B,CAChB,CAAC,GACA,CACT,EACA,QAAQ,IACP,GACJ,GACJ,EACL,iBAAiB,IAAI,CAClB,uBAAC,kBAAK,IACF,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAC,CAAC,EAC7C,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,EAC1B,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,KACtB,kBAAkB,GACxB,CACL,IACC,GACJ,IACH,IACF,CACZ,CAAC;AACN,CAAC,CAAC;AAvKW,QAAA,WAAW,eAuKtB;AAEF,kBAAe,mBAAW,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport {useUniqId} from '@gravity-ui/uikit';\nimport * as React from 'react';\n\nimport {Button, Media, RouterLink} from '../../components';\nimport HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs/HeaderBreadcrumbs';\nimport {getMediaImage} from '../../components/Media/Image/utils';\nimport YFMWrapper from '../../components/YFMWrapper/YFMWrapper';\nimport {MobileContext} from '../../context/mobileContext';\nimport {useTheme} from '../../context/theme';\nimport {Col, Grid, Row} from '../../grid';\nimport {ClassNameProps, HeaderBlockBackground, HeaderBlockProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport {mergeVideoMicrodata} from '../../utils/microdata';\n\nimport {getImageSize, getTitleSizes, titleWithImageSizes} from './utils';\nimport './Header.scss';\n\nconst b = block('header-block');\n\nexport type HeaderBlockFullProps = HeaderBlockProps & ClassNameProps;\n\ninterface BackgroundProps {\n background: HeaderBlockBackground;\n isMobile: boolean;\n}\n\nconst Background = ({background, isMobile}: BackgroundProps) => {\n const {url, image, fullWidthMedia, video, color} = background;\n const imageObject = url ? getMediaImage(url) : image;\n const renderMedia = !isMobile || (typeof image === 'object' && 'mobile' in image);\n\n return (\n <div\n className={b('background', {media: true, 'full-width-media': fullWidthMedia})}\n style={{backgroundColor: color}}\n >\n {renderMedia && (\n <Media\n {...background}\n className={b('background-media')}\n imageClassName={b('image')}\n videoClassName={b('video')}\n isBackground={true}\n parallax={false}\n video={isMobile ? undefined : video}\n image={imageObject}\n />\n )}\n </div>\n );\n};\n\ninterface FullWidthBackgroundProps {\n background: HeaderBlockBackground;\n}\n\nconst FullWidthBackground = ({background}: FullWidthBackgroundProps) => (\n <div\n className={b('background', {['full-width']: true})}\n style={{backgroundColor: background?.color}}\n />\n);\n\nexport const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>) => {\n const {\n title,\n overtitle,\n description,\n buttons,\n image,\n video,\n width = 'm',\n imageSize,\n offset = 'default',\n background,\n theme: textTheme = 'light',\n verticalOffset = 'm',\n className,\n breadcrumbs,\n status,\n renderTitle,\n children,\n mediaView = 'full',\n centered,\n additionalInfo,\n } = props;\n const isMobile = React.useContext(MobileContext);\n const theme = useTheme();\n const hasRightSideImage = Boolean((image || video) && !centered);\n const curImageSize = imageSize || getImageSize(width);\n const titleSizes = hasRightSideImage ? titleWithImageSizes(curImageSize) : getTitleSizes(width);\n let curVerticalOffset = verticalOffset;\n\n if (hasRightSideImage && !verticalOffset) {\n curVerticalOffset = 'm';\n }\n\n const backgroundThemed = background && getThemedValue(background, theme);\n const imageThemed = image && getThemedValue(image, theme);\n const videoThemed = video && getThemedValue(video, theme);\n const mediaWithMicrodata = mergeVideoMicrodata(\n {video: videoThemed, image: imageThemed},\n {\n name: title,\n description,\n },\n );\n const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;\n const titleId = useUniqId();\n\n return (\n <header\n className={b(\n {\n ['has-media']: hasRightSideImage,\n ['full-width']: fullWidth,\n ['media-view']: mediaView,\n ['controls-view']: textTheme,\n },\n className,\n )}\n >\n {backgroundThemed && fullWidth && <FullWidthBackground background={backgroundThemed} />}\n {backgroundThemed && <Background background={backgroundThemed} isMobile={isMobile} />}\n <Grid containerClass={b('container-fluid')}>\n {breadcrumbs && (\n <Row className={b('breadcrumbs')}>\n <Col>\n <HeaderBreadcrumbs {...breadcrumbs} theme={textTheme} />\n </Col>\n </Row>\n )}\n <Row>\n <Col reset className={b('content-wrapper')}>\n <Row>\n <Col\n className={b('content', {\n offset,\n theme: textTheme,\n 'vertical-offset': curVerticalOffset,\n })}\n >\n <Col sizes={titleSizes} className={b('content-inner', {centered})}>\n {overtitle && (\n <div className={b('overtitle')}>\n {typeof overtitle === 'string' ? (\n <YFMWrapper\n tagName=\"div\"\n className={b('overtitle')}\n content={overtitle}\n modifiers={{\n constructor: true,\n }}\n />\n ) : (\n overtitle\n )}\n </div>\n )}\n <YFMWrapper\n content={title}\n contentClassName={b('title')}\n className={b('title-container')}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n tagName=\"h1\"\n contentPosition=\"end\"\n >\n {status}\n {renderTitle ? renderTitle(title) : null}\n </YFMWrapper>\n {description && (\n <div className={b('description', {theme: textTheme})}>\n <YFMWrapper\n content={description}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {additionalInfo && (\n <div className={b('additional-info', {theme: textTheme})}>\n <YFMWrapper\n content={additionalInfo}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {buttons && (\n <div className={b('buttons')} data-qa=\"header-buttons\">\n {buttons.map((button, index) => (\n <RouterLink href={button.url} key={index}>\n <Button\n key={index}\n className={b('button')}\n size=\"xl\"\n extraProps={{\n 'aria-describedby': titleId,\n ...button.extraProps,\n }}\n {...button}\n />\n </RouterLink>\n ))}\n </div>\n )}\n {children}\n </Col>\n </Col>\n </Row>\n {hasRightSideImage && (\n <Media\n className={b('media', {[curImageSize]: true})}\n videoClassName={b('video')}\n imageClassName={b('image')}\n {...mediaWithMicrodata}\n />\n )}\n </Col>\n </Row>\n </Grid>\n </header>\n );\n};\n\nexport default HeaderBlock;\n"]}
1
+ {"version":3,"file":"Header.js","sourceRoot":"../../../../src","sources":["blocks/Header/Header.tsx"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,6CAA4C;AAG5C,0DAA2D;AAC3D,wHAAqF;AACrF,iEAAiE;AACjE,mGAAgE;AAChE,wDAA6C;AAC7C,8CAA0C;AAE1C,gDAAkD;AAClD,wDAA0D;AAE1D,sCAAyE;AAEzE,kFAAgE;AAChE,kDAA4C;AAE5C,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,cAAc,CAAC,CAAC;AAShC,MAAM,UAAU,GAAG,CAAC,EAAC,UAAU,EAAE,QAAQ,EAAkB,EAAE,EAAE;IAC3D,MAAM,EAAC,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAC,GAAG,UAAU,CAAC;IAC9D,MAAM,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC,IAAA,qBAAa,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACrD,MAAM,WAAW,GAAG,CAAC,QAAQ,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAI,KAAK,CAAC,CAAC;IAElF,OAAO,CACH,gCACI,SAAS,EAAE,CAAC,CAAC,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,cAAc,EAAC,CAAC,EAC7E,KAAK,EAAE,EAAC,eAAe,EAAE,KAAK,EAAC,YAE9B,WAAW,IAAI,CACZ,uBAAC,kBAAK,OACE,UAAU,EACd,SAAS,EAAE,CAAC,CAAC,kBAAkB,CAAC,EAChC,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,EAC1B,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,EAC1B,YAAY,E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e,mBAAW,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport {useUniqId} from '@gravity-ui/uikit';\nimport * as React from 'react';\n\nimport {Button, Media, RouterLink} from '../../components';\nimport HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs/HeaderBreadcrumbs';\nimport {getMediaImage} from '../../components/Media/Image/utils';\nimport YFMWrapper from '../../components/YFMWrapper/YFMWrapper';\nimport {useTheme} from '../../context/theme';\nimport {Col, Grid, Row} from '../../grid';\nimport {ClassNameProps, HeaderBlockBackground, HeaderBlockProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport {mergeVideoMicrodata} from '../../utils/microdata';\n\nimport {getImageSize, getTitleSizes, titleWithImageSizes} from './utils';\nimport './Header.scss';\nimport {useWindowWidth} from '../../context/windowWidthContext';\nimport {BREAKPOINTS} from '../../constants';\n\nconst b = block('header-block');\n\nexport type HeaderBlockFullProps = HeaderBlockProps & ClassNameProps;\n\ninterface BackgroundProps {\n background: HeaderBlockBackground;\n isMobile: boolean;\n}\n\nconst Background = ({background, isMobile}: BackgroundProps) => {\n const {url, image, fullWidthMedia, video, color} = background;\n const imageObject = url ? getMediaImage(url) : image;\n const renderMedia = !isMobile || (typeof image === 'object' && 'mobile' in image);\n\n return (\n <div\n className={b('background', {media: true, 'full-width-media': fullWidthMedia})}\n style={{backgroundColor: color}}\n >\n {renderMedia && (\n <Media\n {...background}\n className={b('background-media')}\n imageClassName={b('image')}\n videoClassName={b('video')}\n isBackground={true}\n parallax={false}\n video={isMobile ? undefined : video}\n image={imageObject}\n />\n )}\n </div>\n );\n};\n\ninterface FullWidthBackgroundProps {\n background: HeaderBlockBackground;\n}\n\nconst FullWidthBackground = ({background}: FullWidthBackgroundProps) => (\n <div\n className={b('background', {['full-width']: true})}\n style={{backgroundColor: background?.color}}\n />\n);\n\nexport const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>) => {\n const {\n title,\n overtitle,\n description,\n buttons,\n image,\n video,\n width = 'm',\n imageSize,\n offset = 'default',\n background,\n theme: textTheme = 'light',\n verticalOffset = 'm',\n className,\n breadcrumbs,\n status,\n renderTitle,\n children,\n mediaView = 'full',\n centered,\n additionalInfo,\n } = props;\n const windowWidth = useWindowWidth();\n const isMobile = windowWidth <= BREAKPOINTS.sm;\n const theme = useTheme();\n const hasRightSideImage = Boolean((image || video) && !centered);\n const curImageSize = imageSize || getImageSize(width);\n const titleSizes = hasRightSideImage ? titleWithImageSizes(curImageSize) : getTitleSizes(width);\n let curVerticalOffset = verticalOffset;\n\n if (hasRightSideImage && !verticalOffset) {\n curVerticalOffset = 'm';\n }\n\n const backgroundThemed = background && getThemedValue(background, theme);\n const imageThemed = image && getThemedValue(image, theme);\n const videoThemed = video && getThemedValue(video, theme);\n const mediaWithMicrodata = mergeVideoMicrodata(\n {video: videoThemed, image: imageThemed},\n {name: title, description},\n );\n const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;\n const titleId = useUniqId();\n\n return (\n <header\n className={b(\n {\n ['has-media']: hasRightSideImage,\n ['full-width']: fullWidth,\n ['media-view']: mediaView,\n ['controls-view']: textTheme,\n },\n className,\n )}\n >\n {backgroundThemed && fullWidth && <FullWidthBackground background={backgroundThemed} />}\n {backgroundThemed && <Background background={backgroundThemed} isMobile={isMobile} />}\n <Grid containerClass={b('container-fluid')}>\n {breadcrumbs && (\n <Row className={b('breadcrumbs')}>\n <Col>\n <HeaderBreadcrumbs {...breadcrumbs} theme={textTheme} />\n </Col>\n </Row>\n )}\n <Row>\n <Col reset className={b('content-wrapper')}>\n <Row>\n <Col\n className={b('content', {\n offset,\n theme: textTheme,\n 'vertical-offset': curVerticalOffset,\n })}\n >\n <Col sizes={titleSizes} className={b('content-inner', {centered})}>\n {overtitle && (\n <div className={b('overtitle')}>\n {typeof overtitle === 'string' ? (\n <YFMWrapper\n tagName=\"div\"\n className={b('overtitle')}\n content={overtitle}\n modifiers={{constructor: true}}\n />\n ) : (\n overtitle\n )}\n </div>\n )}\n <YFMWrapper\n content={title}\n contentClassName={b('title')}\n className={b('title-container')}\n modifiers={{constructor: true, constructorTheme: textTheme}}\n tagName=\"h1\"\n contentPosition=\"end\"\n >\n {status}\n {renderTitle ? renderTitle(title) : null}\n </YFMWrapper>\n {description && (\n <div className={b('description', {theme: textTheme})}>\n <YFMWrapper\n content={description}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {additionalInfo && (\n <div className={b('additional-info', {theme: textTheme})}>\n <YFMWrapper\n content={additionalInfo}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {buttons && (\n <div className={b('buttons')} data-qa=\"header-buttons\">\n {buttons.map((button, index) => (\n <RouterLink href={button.url} key={index}>\n <Button\n key={index}\n className={b('button')}\n size=\"xl\"\n extraProps={{\n 'aria-describedby': titleId,\n ...button.extraProps,\n }}\n {...button}\n />\n </RouterLink>\n ))}\n </div>\n )}\n {children}\n </Col>\n </Col>\n </Row>\n {hasRightSideImage && (\n <Media\n className={b('media', {[curImageSize]: true})}\n videoClassName={b('video')}\n imageClassName={b('image')}\n {...mediaWithMicrodata}\n />\n )}\n </Col>\n </Row>\n </Grid>\n </header>\n );\n};\n\nexport default HeaderBlock;\n"]}
@@ -15,6 +15,7 @@ const mobileContext_1 = require("../../context/mobileContext/index.js");
15
15
  const projectSettingsContext_1 = require("../../context/projectSettingsContext/index.js");
16
16
  const ssrContext_1 = require("../../context/ssrContext/index.js");
17
17
  const theme_1 = require("../../context/theme/index.js");
18
+ const windowWidthContext_1 = require("../../context/windowWidthContext/index.js");
18
19
  const PageConstructorProvider = (props) => {
19
20
  const { isMobile, mapsContext = mapsContext_1.initialMapValue, locale = {}, location = {}, analytics = {}, ssrConfig = {}, projectSettings = {}, theme = constants_1.DEFAULT_THEME, children, image = {}, forms = FormsContext_1.DEFAULT_FORMS_CONTEXT_VALUE, } = props;
20
21
  /* eslint-disable react/jsx-key */
@@ -29,6 +30,7 @@ const PageConstructorProvider = (props) => {
29
30
  (0, jsx_runtime_1.jsx)(analyticsContext_1.AnalyticsContext.Provider, { value: analytics }),
30
31
  (0, jsx_runtime_1.jsx)(FormsContext_1.FormsContext.Provider, { value: forms }),
31
32
  (0, jsx_runtime_1.jsx)(ssrContext_1.SSRContext.Provider, { value: { isServer: ssrConfig?.isServer } }),
33
+ (0, jsx_runtime_1.jsx)(windowWidthContext_1.WindowWidthProvider, {}),
32
34
  ].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);
33
35
  /* eslint-enable react/jsx-key */
34
36
  return (0, jsx_runtime_1.jsx)(React.Fragment, { children: context });
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.js","sourceRoot":"../../../../src","sources":["containers/PageConstructor/Provider.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAE/B,6DAAyD;AACzD,8EAAuF;AACvF,6EAIiD;AACjD,sEAA2E;AAC3E,wEAA8E;AAC9E,4EAAoF;AACpF,0EAAoG;AACpG,wEAA0D;AAC1D,0FAG8C;AAC9C,kEAAqE;AACrE,wDAAiD;AAgB1C,MAAM,uBAAuB,GAAG,CACnC,KAA4D,EAC9D,EAAE;IACA,MAAM,EACF,QAAQ,EACR,WAAW,GAAG,6BAAe,EAC7B,MAAM,GAAG,EAAE,EACX,QAAQ,GAAG,EAAE,EACb,SAAS,GAAG,EAAE,EACd,SAAS,GAAG,EAAE,EACd,eAAe,GAAG,EAAE,EACpB,KAAK,GAAG,yBAAa,EACrB,QAAQ,EACR,KAAK,GAAG,EAAE,EACV,KAAK,GAAG,0CAA2B,GACtC,GAAG,KAAK,CAAC;IAEV,kCAAkC;IAClC,MAAM,OAAO,GAAG;QACZ,uBAAC,oBAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAC,KAAK,EAAC,GAAI;QACzC,uBAAC,+CAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,GAAI;QAC3D,uBAAC,6BAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,GAAI;QACzC,uBAAC,2BAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,GAAI;QACvC,uBAAC,iCAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,GAAI;QAC7C,uBAAC,6BAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAI;QACpD,uBAAC,yBAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,GAAI;QAC5C,uBAAC,mCAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS,GAAI;QAC/C,uBAAC,2BAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,GAAI;QACvC,uBAAC,uBAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAC,GAAI;KAClE,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;IACpF,iCAAiC;IAEjC,OAAO,uBAAC,KAAK,CAAC,QAAQ,cAAE,OAAO,GAAkB,CAAC;AACtD,CAAC,CAAC;AAjCW,QAAA,uBAAuB,2BAiClC","sourcesContent":["import * as React from 'react';\n\nimport {DEFAULT_THEME} from '../../components/constants';\nimport {AnalyticsContext, AnalyticsContextProps} from '../../context/analyticsContext';\nimport {\n DEFAULT_FORMS_CONTEXT_VALUE,\n FormsContext,\n FormsContextProps,\n} from '../../context/formsContext/FormsContext';\nimport {ImageContext, ImageContextProps} from '../../context/imageContext';\nimport {LocaleContext, LocaleContextProps} from '../../context/localeContext';\nimport {LocationContext, LocationContextProps} from '../../context/locationContext';\nimport {MapsContext, MapsContextType, initialMapValue} from '../../context/mapsContext/mapsContext';\nimport {MobileContext} from '../../context/mobileContext';\nimport {\n ProjectSettingsContext,\n ProjectSettingsContextProps,\n} from '../../context/projectSettingsContext';\nimport {SSRContext, SSRContextProps} from '../../context/ssrContext';\nimport {ThemeContext} from '../../context/theme';\nimport {Theme} from '../../models';\n\nexport interface PageConstructorProviderProps {\n isMobile?: boolean;\n locale?: LocaleContextProps;\n location?: LocationContextProps;\n ssrConfig?: SSRContextProps;\n theme?: Theme;\n mapsContext?: MapsContextType;\n projectSettings?: ProjectSettingsContextProps;\n analytics?: AnalyticsContextProps;\n forms?: FormsContextProps;\n image?: ImageContextProps;\n}\n\nexport const PageConstructorProvider = (\n props: React.PropsWithChildren<PageConstructorProviderProps>,\n) => {\n const {\n isMobile,\n mapsContext = initialMapValue,\n locale = {},\n location = {},\n analytics = {},\n ssrConfig = {},\n projectSettings = {},\n theme = DEFAULT_THEME,\n children,\n image = {},\n forms = DEFAULT_FORMS_CONTEXT_VALUE,\n } = props;\n\n /* eslint-disable react/jsx-key */\n const context = [\n <ThemeContext.Provider value={{theme}} />,\n <ProjectSettingsContext.Provider value={projectSettings} />,\n <LocaleContext.Provider value={locale} />,\n <ImageContext.Provider value={image} />,\n <LocationContext.Provider value={location} />,\n <MobileContext.Provider value={Boolean(isMobile)} />,\n <MapsContext.Provider value={mapsContext} />,\n <AnalyticsContext.Provider value={analytics} />,\n <FormsContext.Provider value={forms} />,\n <SSRContext.Provider value={{isServer: ssrConfig?.isServer}} />,\n ].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);\n /* eslint-enable react/jsx-key */\n\n return <React.Fragment>{context}</React.Fragment>;\n};\n"]}
1
+ {"version":3,"file":"Provider.js","sourceRoot":"../../../../src","sources":["containers/PageConstructor/Provider.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAE/B,6DAAyD;AACzD,8EAAuF;AACvF,6EAIiD;AACjD,sEAA2E;AAC3E,wEAA8E;AAC9E,4EAAoF;AACpF,0EAAoG;AACpG,wEAA0D;AAC1D,0FAG8C;AAC9C,kEAAqE;AACrE,wDAAiD;AAEjD,kFAAqE;AAe9D,MAAM,uBAAuB,GAAG,C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,CAAC;IACpF,iCAAiC;IAEjC,OAAO,uBAAC,KAAK,CAAC,QAAQ,cAAE,OAAO,GAAkB,CAAC;AACtD,CAAC,CAAC;AAlCW,QAAA,uBAAuB,2BAkClC","sourcesContent":["import * as React from 'react';\n\nimport {DEFAULT_THEME} from '../../components/constants';\nimport {AnalyticsContext, AnalyticsContextProps} from '../../context/analyticsContext';\nimport {\n DEFAULT_FORMS_CONTEXT_VALUE,\n FormsContext,\n FormsContextProps,\n} from '../../context/formsContext/FormsContext';\nimport {ImageContext, ImageContextProps} from '../../context/imageContext';\nimport {LocaleContext, LocaleContextProps} from '../../context/localeContext';\nimport {LocationContext, LocationContextProps} from '../../context/locationContext';\nimport {MapsContext, MapsContextType, initialMapValue} from '../../context/mapsContext/mapsContext';\nimport {MobileContext} from '../../context/mobileContext';\nimport {\n ProjectSettingsContext,\n ProjectSettingsContextProps,\n} from '../../context/projectSettingsContext';\nimport {SSRContext, SSRContextProps} from '../../context/ssrContext';\nimport {ThemeContext} from '../../context/theme';\nimport {Theme} from '../../models';\nimport {WindowWidthProvider} from '../../context/windowWidthContext';\n\nexport interface PageConstructorProviderProps {\n isMobile?: boolean;\n locale?: LocaleContextProps;\n location?: LocationContextProps;\n ssrConfig?: SSRContextProps;\n theme?: Theme;\n mapsContext?: MapsContextType;\n projectSettings?: ProjectSettingsContextProps;\n analytics?: AnalyticsContextProps;\n forms?: FormsContextProps;\n image?: ImageContextProps;\n}\n\nexport const PageConstructorProvider = (\n props: React.PropsWithChildren<PageConstructorProviderProps>,\n) => {\n const {\n isMobile,\n mapsContext = initialMapValue,\n locale = {},\n location = {},\n analytics = {},\n ssrConfig = {},\n projectSettings = {},\n theme = DEFAULT_THEME,\n children,\n image = {},\n forms = DEFAULT_FORMS_CONTEXT_VALUE,\n } = props;\n\n /* eslint-disable react/jsx-key */\n const context = [\n <ThemeContext.Provider value={{theme}} />,\n <ProjectSettingsContext.Provider value={projectSettings} />,\n <LocaleContext.Provider value={locale} />,\n <ImageContext.Provider value={image} />,\n <LocationContext.Provider value={location} />,\n <MobileContext.Provider value={Boolean(isMobile)} />,\n <MapsContext.Provider value={mapsContext} />,\n <AnalyticsContext.Provider value={analytics} />,\n <FormsContext.Provider value={forms} />,\n <SSRContext.Provider value={{isServer: ssrConfig?.isServer}} />,\n <WindowWidthProvider />,\n ].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);\n /* eslint-enable react/jsx-key */\n\n return <React.Fragment>{context}</React.Fragment>;\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ export declare const WindowWidthContext: React.Context<number>;
3
+ export declare const WindowWidthProvider: ({ children }: React.PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const useWindowWidth: () => number;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useWindowWidth = exports.WindowWidthProvider = exports.WindowWidthContext = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const React = tslib_1.__importStar(require("react"));
7
+ const throttle_1 = tslib_1.__importDefault(require("lodash/throttle.js"));
8
+ const ssrContext_1 = require("../ssrContext/index.js");
9
+ const constants_1 = require("../../constants.js");
10
+ const DEFAULT_WIDTH = constants_1.BREAKPOINTS.xl;
11
+ const UPDATE_FREQUENCY_MS = 100;
12
+ exports.WindowWidthContext = React.createContext(DEFAULT_WIDTH);
13
+ const WindowWidthProvider = ({ children }) => {
14
+ const { isServer } = React.useContext(ssrContext_1.SSRContext);
15
+ const [windowWidth, setWindowWidth] = React.useState(DEFAULT_WIDTH);
16
+ React.useEffect(() => {
17
+ if (isServer) {
18
+ return;
19
+ }
20
+ const handleResize = (0, throttle_1.default)(() => {
21
+ setWindowWidth(window.innerWidth);
22
+ }, UPDATE_FREQUENCY_MS, { leading: true });
23
+ handleResize();
24
+ window.addEventListener('resize', handleResize, { passive: true });
25
+ // eslint-disable-next-line consistent-return
26
+ return () => window.removeEventListener('resize', handleResize);
27
+ }, [isServer]);
28
+ return ((0, jsx_runtime_1.jsx)(exports.WindowWidthContext.Provider, { value: windowWidth, children: children }));
29
+ };
30
+ exports.WindowWidthProvider = WindowWidthProvider;
31
+ const useWindowWidth = () => React.useContext(exports.WindowWidthContext);
32
+ exports.useWindowWidth = useWindowWidth;
33
+ //# sourceMappingURL=BreakpointContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BreakpointContext.js","sourceRoot":"../../../../src","sources":["context/windowWidthContext/BreakpointContext.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAC/B,0EAAuC;AACvC,uDAAyC;AACzC,kDAA4C;AAE5C,MAAM,aAAa,GAAG,uBAAW,CAAC,EAAE,CAAC;AACrC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEnB,QAAA,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAS,aAAa,CAAC,CAAC;AAEtE,MAAM,mBAAmB,GAAG,CAAC,EAAC,QAAQ,EAA0B,EAAE,EAAE;IACvE,MAAM,EAAC,QAAQ,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,uBAAU,CAAC,CAAC;IAEhD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAEpE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IAAI,QAAQ,EAAE,CAAC;YACX,OAAO;QACX,CAAC;QAED,MAAM,YAAY,GAAG,IAAA,kBAAQ,EACzB,GAAG,EAAE;YACD,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACtC,CAAC,EACD,mBAAmB,EACnB,EAAC,OAAO,EAAE,IAAI,EAAC,CAClB,CAAC;QAEF,YAAY,EAAE,CAAC;QAEf,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QAEjE,6CAA6C;QAC7C,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACpE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACH,uBAAC,0BAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,YAAG,QAAQ,GAA+B,CAC5F,CAAC;AACN,CAAC,CAAC;AA7BW,QAAA,mBAAmB,uBA6B9B;AAEK,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,0BAAkB,CAAC,CAAC;AAA5D,QAAA,cAAc,kBAA8C","sourcesContent":["import * as React from 'react';\nimport throttle from 'lodash/throttle';\nimport {SSRContext} from '../ssrContext';\nimport {BREAKPOINTS} from '../../constants';\n\nconst DEFAULT_WIDTH = BREAKPOINTS.xl;\nconst UPDATE_FREQUENCY_MS = 100;\n\nexport const WindowWidthContext = React.createContext<number>(DEFAULT_WIDTH);\n\nexport const WindowWidthProvider = ({children}: React.PropsWithChildren) => {\n const {isServer} = React.useContext(SSRContext);\n\n const [windowWidth, setWindowWidth] = React.useState(DEFAULT_WIDTH);\n\n React.useEffect(() => {\n if (isServer) {\n return;\n }\n\n const handleResize = throttle(\n () => {\n setWindowWidth(window.innerWidth);\n },\n UPDATE_FREQUENCY_MS,\n {leading: true},\n );\n\n handleResize();\n\n window.addEventListener('resize', handleResize, {passive: true});\n\n // eslint-disable-next-line consistent-return\n return () => window.removeEventListener('resize', handleResize);\n }, [isServer]);\n\n return (\n <WindowWidthContext.Provider value={windowWidth}>{children}</WindowWidthContext.Provider>\n );\n};\n\nexport const useWindowWidth = () => React.useContext(WindowWidthContext);\n"]}
@@ -0,0 +1 @@
1
+ export * from "./BreakpointContext.js";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./BreakpointContext.js"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../../../../src","sources":["context/windowWidthContext/index.ts"],"names":[],"mappings":";;;AAAA,iEAAoC","sourcesContent":["export * from './BreakpointContext';\n"]}
@@ -2,12 +2,13 @@ import { createElement as _createElement } from "react";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as React from 'react';
4
4
  import { BackgroundImage, FileLink } from "../../components/index.js";
5
- import { MobileContext } from "../../context/mobileContext/index.js";
6
5
  import { useTheme } from "../../context/theme/index.js";
7
6
  import { Col } from "../../grid/index.js";
8
7
  import { Content } from "../../sub-blocks/index.js";
9
8
  import { block, getThemedValue } from "../../utils/index.js";
10
9
  import './ContentLayout.css';
10
+ import { useWindowWidth } from "../../context/windowWidthContext/index.js";
11
+ import { BREAKPOINTS } from "../../constants.js";
11
12
  const b = block('content-layout-block');
12
13
  function getFileTextSize(size) {
13
14
  switch (size) {
@@ -30,7 +31,8 @@ function getTextWidth(size) {
30
31
  }
31
32
  }
32
33
  export const ContentLayoutBlock = (props) => {
33
- const isMobile = React.useContext(MobileContext);
34
+ const windowWidth = useWindowWidth();
35
+ const isMobile = windowWidth <= BREAKPOINTS.sm;
34
36
  const { textContent, fileContent, size = 'l', background, centered, theme = 'default', textWidth = 'm', } = props;
35
37
  const colSizes = React.useMemo(() => getTextWidth(textWidth), [textWidth]);
36
38
  const globalTheme = useTheme();
@@ -1 +1 @@
1
- {"version":3,"file":"ContentLayout.js","sourceRoot":"../../../../src","sources":["blocks/ContentLayout/ContentLayout.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,kCAAyB;AAC3D,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,GAAG,EAAC,4BAAmB;AAE/B,OAA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jE,OAAO,CACH,eAAK,SAAS,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,EAAC,CAAC,aAC7D,KAAC,OAAO,IACJ,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,KACnB,WAAW,EACf,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,GACd,EACD,WAAW,IAAI,CACZ,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,CAAC,EAAE,KAAK,QAAC,KAAK,EAAE,QAAQ,YAC9D,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACvB,eAAC,QAAQ,IACL,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,KAChB,IAAI,EACR,GAAG,EAAE,IAAI,CAAC,IAAI,EACd,IAAI,EAAC,YAAY,EACjB,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,EAC/B,KAAK,EAAE,KAAK,GACd,CACL,CAAC,GACA,CACT,EACA,UAAU,IAAI,CACX,cAAK,SAAS,EAAE,CAAC,CAAC,YAAY,CAAC,YAC3B,KAAC,eAAe,IACZ,SAAS,EAAE,CAAC,CAAC,iBAAiB,CAAC,KAC3B,gBAAgB,EACpB,IAAI,EAAE,QAAQ,GAChB,GACA,CACT,IACC,CACT,CAAC;AACN,CAAC,CAAC;AACF,eAAe,kBAAkB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BackgroundImage, FileLink} from '../../components';\nimport {MobileContext} from '../../context/mobileContext';\nimport {useTheme} from '../../context/theme';\nimport {Col} from '../../grid';\nimport {ContentLayoutBlockProps, ContentSize, ContentTextSize} from '../../models';\nimport {Content} from '../../sub-blocks';\nimport {block, getThemedValue} from '../../utils';\n\nimport './ContentLayout.scss';\n\nconst b = block('content-layout-block');\n\nfunction getFileTextSize(size: ContentSize) {\n switch (size) {\n case 's':\n return 's';\n case 'l':\n default:\n return 'l';\n }\n}\n\nfunction getTextWidth(size: ContentTextSize) {\n switch (size) {\n case 's':\n return {all: 12, md: 6};\n case 'l':\n return {all: 12, md: 12};\n case 'm':\n default:\n return {all: 12, md: 8};\n }\n}\n\nexport const ContentLayoutBlock = (props: ContentLayoutBlockProps) => {\n const isMobile = React.useContext(MobileContext);\n const {\n textContent,\n fileContent,\n size = 'l',\n background,\n centered,\n theme = 'default',\n textWidth = 'm',\n } = props;\n\n const colSizes = React.useMemo(() => getTextWidth(textWidth), [textWidth]);\n const globalTheme = useTheme();\n const themedBackground = getThemedValue(background, globalTheme);\n\n return (\n <div className={b({size, theme, background: Boolean(background)})}>\n <Content\n className={b('content')}\n {...textContent}\n size={size}\n centered={centered}\n colSizes={colSizes}\n theme={theme}\n />\n {fileContent && (\n <Col className={b('files', {size, centered})} reset sizes={colSizes}>\n {fileContent.map((file) => (\n <FileLink\n className={b('file')}\n {...file}\n key={file.href}\n type=\"horizontal\"\n textSize={getFileTextSize(size)}\n theme={theme}\n />\n ))}\n </Col>\n )}\n {background && (\n <div className={b('background')}>\n <BackgroundImage\n className={b('background-item')}\n {...themedBackground}\n hide={isMobile}\n />\n </div>\n )}\n </div>\n );\n};\nexport default ContentLayoutBlock;\n"]}
1
+ {"version":3,"file":"ContentLayout.js","sourceRoot":"../../../../src","sources":["blocks/ContentLayout/ContentLayout.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,kCAAyB;AAC3D,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,GAAG,EAAC,4BAAmB;AAE/B,OAAO,EAAC,OAAO,EAAC,kCAAyB;AACzC,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,6BAAoB;AAElD,OAAO,qBAAqB,CAAC;AAC7B,O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EjE,OAAO,CACH,eAAK,SAAS,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,EAAC,CAAC,aAC7D,KAAC,OAAO,IACJ,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,KACnB,WAAW,EACf,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,GACd,EACD,WAAW,IAAI,CACZ,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,CAAC,EAAE,KAAK,QAAC,KAAK,EAAE,QAAQ,YAC9D,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACvB,eAAC,QAAQ,IACL,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,KAChB,IAAI,EACR,GAAG,EAAE,IAAI,CAAC,IAAI,EACd,IAAI,EAAC,YAAY,EACjB,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,EAC/B,KAAK,EAAE,KAAK,GACd,CACL,CAAC,GACA,CACT,EACA,UAAU,IAAI,CACX,cAAK,SAAS,EAAE,CAAC,CAAC,YAAY,CAAC,YAC3B,KAAC,eAAe,IACZ,SAAS,EAAE,CAAC,CAAC,iBAAiB,CAAC,KAC3B,gBAAgB,EACpB,IAAI,EAAE,QAAQ,GAChB,GACA,CACT,IACC,CACT,CAAC;AACN,CAAC,CAAC;AACF,eAAe,kBAAkB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BackgroundImage, FileLink} from '../../components';\nimport {useTheme} from '../../context/theme';\nimport {Col} from '../../grid';\nimport {ContentLayoutBlockProps, ContentSize, ContentTextSize} from '../../models';\nimport {Content} from '../../sub-blocks';\nimport {block, getThemedValue} from '../../utils';\n\nimport './ContentLayout.scss';\nimport {useWindowWidth} from '../../context/windowWidthContext';\nimport {BREAKPOINTS} from '../../constants';\n\nconst b = block('content-layout-block');\n\nfunction getFileTextSize(size: ContentSize) {\n switch (size) {\n case 's':\n return 's';\n case 'l':\n default:\n return 'l';\n }\n}\n\nfunction getTextWidth(size: ContentTextSize) {\n switch (size) {\n case 's':\n return {all: 12, md: 6};\n case 'l':\n return {all: 12, md: 12};\n case 'm':\n default:\n return {all: 12, md: 8};\n }\n}\n\nexport const ContentLayoutBlock = (props: ContentLayoutBlockProps) => {\n const windowWidth = useWindowWidth();\n const isMobile = windowWidth <= BREAKPOINTS.sm;\n\n const {\n textContent,\n fileContent,\n size = 'l',\n background,\n centered,\n theme = 'default',\n textWidth = 'm',\n } = props;\n\n const colSizes = React.useMemo(() => getTextWidth(textWidth), [textWidth]);\n const globalTheme = useTheme();\n const themedBackground = getThemedValue(background, globalTheme);\n\n return (\n <div className={b({size, theme, background: Boolean(background)})}>\n <Content\n className={b('content')}\n {...textContent}\n size={size}\n centered={centered}\n colSizes={colSizes}\n theme={theme}\n />\n {fileContent && (\n <Col className={b('files', {size, centered})} reset sizes={colSizes}>\n {fileContent.map((file) => (\n <FileLink\n className={b('file')}\n {...file}\n key={file.href}\n type=\"horizontal\"\n textSize={getFileTextSize(size)}\n theme={theme}\n />\n ))}\n </Col>\n )}\n {background && (\n <div className={b('background')}>\n <BackgroundImage\n className={b('background-item')}\n {...themedBackground}\n hide={isMobile}\n />\n </div>\n )}\n </div>\n );\n};\nexport default ContentLayoutBlock;\n"]}
@@ -1,18 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /* eslint-disable complexity */
3
3
  import { useUniqId } from '@gravity-ui/uikit';
4
- import * as React from 'react';
5
4
  import { Button, Media, RouterLink } from "../../components/index.js";
6
5
  import HeaderBreadcrumbs from "../../components/HeaderBreadcrumbs/HeaderBreadcrumbs.js";
7
6
  import { getMediaImage } from "../../components/Media/Image/utils.js";
8
7
  import YFMWrapper from "../../components/YFMWrapper/YFMWrapper.js";
9
- import { MobileContext } from "../../context/mobileContext/index.js";
10
8
  import { useTheme } from "../../context/theme/index.js";
11
9
  import { Col, Grid, Row } from "../../grid/index.js";
12
10
  import { block, getThemedValue } from "../../utils/index.js";
13
11
  import { mergeVideoMicrodata } from "../../utils/microdata.js";
14
12
  import { getImageSize, getTitleSizes, titleWithImageSizes } from "./utils.js";
15
13
  import './Header.css';
14
+ import { useWindowWidth } from "../../context/windowWidthContext/index.js";
15
+ import { BREAKPOINTS } from "../../constants.js";
16
16
  const b = block('header-block');
17
17
  const Background = ({ background, isMobile }) => {
18
18
  const { url, image, fullWidthMedia, video, color } = background;
@@ -23,7 +23,8 @@ const Background = ({ background, isMobile }) => {
23
23
  const FullWidthBackground = ({ background }) => (_jsx("div", { className: b('background', { ['full-width']: true }), style: { backgroundColor: background?.color } }));
24
24
  export const HeaderBlock = (props) => {
25
25
  const { title, overtitle, description, buttons, image, video, width = 'm', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', className, breadcrumbs, status, renderTitle, children, mediaView = 'full', centered, additionalInfo, } = props;
26
- const isMobile = React.useContext(MobileContext);
26
+ const windowWidth = useWindowWidth();
27
+ const isMobile = windowWidth <= BREAKPOINTS.sm;
27
28
  const theme = useTheme();
28
29
  const hasRightSideImage = Boolean((image || video) && !centered);
29
30
  const curImageSize = imageSize || getImageSize(width);
@@ -35,10 +36,7 @@ export const HeaderBlock = (props) => {
35
36
  const backgroundThemed = background && getThemedValue(background, theme);
36
37
  const imageThemed = image && getThemedValue(image, theme);
37
38
  const videoThemed = video && getThemedValue(video, theme);
38
- const mediaWithMicrodata = mergeVideoMicrodata({ video: videoThemed, image: imageThemed }, {
39
- name: title,
40
- description,
41
- });
39
+ const mediaWithMicrodata = mergeVideoMicrodata({ video: videoThemed, image: imageThemed }, { name: title, description });
42
40
  const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;
43
41
  const titleId = useUniqId();
44
42
  return (_jsxs("header", { className: b({
@@ -50,12 +48,7 @@ export const HeaderBlock = (props) => {
50
48
  offset,
51
49
  theme: textTheme,
52
50
  'vertical-offset': curVerticalOffset,
53
- }), children: _jsxs(Col, { sizes: titleSizes, className: b('content-inner', { centered }), children: [overtitle && (_jsx("div", { className: b('overtitle'), children: typeof overtitle === 'string' ? (_jsx(YFMWrapper, { tagName: "div", className: b('overtitle'), content: overtitle, modifiers: {
54
- constructor: true,
55
- } })) : (overtitle) })), _jsxs(YFMWrapper, { content: title, contentClassName: b('title'), className: b('title-container'), modifiers: {
56
- constructor: true,
57
- constructorTheme: textTheme,
58
- }, tagName: "h1", contentPosition: "end", children: [status, renderTitle ? renderTitle(title) : null] }), description && (_jsx("div", { className: b('description', { theme: textTheme }), children: _jsx(YFMWrapper, { content: description, modifiers: {
51
+ }), children: _jsxs(Col, { sizes: titleSizes, className: b('content-inner', { centered }), children: [overtitle && (_jsx("div", { className: b('overtitle'), children: typeof overtitle === 'string' ? (_jsx(YFMWrapper, { tagName: "div", className: b('overtitle'), content: overtitle, modifiers: { constructor: true } })) : (overtitle) })), _jsxs(YFMWrapper, { content: title, contentClassName: b('title'), className: b('title-container'), modifiers: { constructor: true, constructorTheme: textTheme }, tagName: "h1", contentPosition: "end", children: [status, renderTitle ? renderTitle(title) : null] }), description && (_jsx("div", { className: b('description', { theme: textTheme }), children: _jsx(YFMWrapper, { content: description, modifiers: {
59
52
  constructor: true,
60
53
  constructorTheme: textTheme,
61
54
  } }) })), additionalInfo && (_jsx("div", { className: b('additional-info', { theme: textTheme }), children: _jsx(YFMWrapper, { content: additionalInfo, modifiers: {
@@ -1 +1 @@
1
- {"version":3,"file":"Header.js","sourceRoot":"../../../../src","sources":["blocks/Header/Header.tsx"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAC,kCAA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AAI;4DACjB,gBAAgB,EAAE,SAAS;yDAC9B,GACH,GACA,CACT,EACA,cAAc,IAAI,CACf,cAAK,SAAS,EAAE,CAAC,CAAC,iBAAiB,EAAE,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,YACpD,KAAC,UAAU,IACP,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE;4DACP,WAAW,EAAE,IAAI;4DACjB,gBAAgB,EAAE,SAAS;yDAC9B,GACH,GACA,CACT,EACA,OAAO,IAAI,CACR,cAAK,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,aAAU,gBAAgB,YACjD,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5B,KAAC,UAAU,IAAC,IAAI,EAAE,MAAM,CAAC,GAAG,YACxB,KAAC,MAAM,IAEH,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,EACtB,IAAI,EAAC,IAAI,EACT,UAAU,EAAE;gEACR,kBAAkB,EAAE,OAAO;gEAC3B,GAAG,MAAM,CAAC,UAAU;6DACvB,KACG,MAAM,IAPL,KAAK,CAQZ,IAV6B,KAAK,CAW3B,CAChB,CAAC,GACA,CACT,EACA,QAAQ,IACP,GACJ,GACJ,EACL,iBAAiB,IAAI,CAClB,KAAC,KAAK,IACF,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAC,CAAC,EAC7C,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,EAC1B,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,KACtB,kBAAkB,GACxB,CACL,IACC,GACJ,IACH,IACF,CACZ,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport {useUniqId} from '@gravity-ui/uikit';\nimport * as React from 'react';\n\nimport {Button, Media, RouterLink} from '../../components';\nimport HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs/HeaderBreadcrumbs';\nimport {getMediaImage} from '../../components/Media/Image/utils';\nimport YFMWrapper from '../../components/YFMWrapper/YFMWrapper';\nimport {MobileContext} from '../../context/mobileContext';\nimport {useTheme} from '../../context/theme';\nimport {Col, Grid, Row} from '../../grid';\nimport {ClassNameProps, HeaderBlockBackground, HeaderBlockProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport {mergeVideoMicrodata} from '../../utils/microdata';\n\nimport {getImageSize, getTitleSizes, titleWithImageSizes} from './utils';\nimport './Header.scss';\n\nconst b = block('header-block');\n\nexport type HeaderBlockFullProps = HeaderBlockProps & ClassNameProps;\n\ninterface BackgroundProps {\n background: HeaderBlockBackground;\n isMobile: boolean;\n}\n\nconst Background = ({background, isMobile}: BackgroundProps) => {\n const {url, image, fullWidthMedia, video, color} = background;\n const imageObject = url ? getMediaImage(url) : image;\n const renderMedia = !isMobile || (typeof image === 'object' && 'mobile' in image);\n\n return (\n <div\n className={b('background', {media: true, 'full-width-media': fullWidthMedia})}\n style={{backgroundColor: color}}\n >\n {renderMedia && (\n <Media\n {...background}\n className={b('background-media')}\n imageClassName={b('image')}\n videoClassName={b('video')}\n isBackground={true}\n parallax={false}\n video={isMobile ? undefined : video}\n image={imageObject}\n />\n )}\n </div>\n );\n};\n\ninterface FullWidthBackgroundProps {\n background: HeaderBlockBackground;\n}\n\nconst FullWidthBackground = ({background}: FullWidthBackgroundProps) => (\n <div\n className={b('background', {['full-width']: true})}\n style={{backgroundColor: background?.color}}\n />\n);\n\nexport const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>) => {\n const {\n title,\n overtitle,\n description,\n buttons,\n image,\n video,\n width = 'm',\n imageSize,\n offset = 'default',\n background,\n theme: textTheme = 'light',\n verticalOffset = 'm',\n className,\n breadcrumbs,\n status,\n renderTitle,\n children,\n mediaView = 'full',\n centered,\n additionalInfo,\n } = props;\n const isMobile = React.useContext(MobileContext);\n const theme = useTheme();\n const hasRightSideImage = Boolean((image || video) && !centered);\n const curImageSize = imageSize || getImageSize(width);\n const titleSizes = hasRightSideImage ? titleWithImageSizes(curImageSize) : getTitleSizes(width);\n let curVerticalOffset = verticalOffset;\n\n if (hasRightSideImage && !verticalOffset) {\n curVerticalOffset = 'm';\n }\n\n const backgroundThemed = background && getThemedValue(background, theme);\n const imageThemed = image && getThemedValue(image, theme);\n const videoThemed = video && getThemedValue(video, theme);\n const mediaWithMicrodata = mergeVideoMicrodata(\n {video: videoThemed, image: imageThemed},\n {\n name: title,\n description,\n },\n );\n const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;\n const titleId = useUniqId();\n\n return (\n <header\n className={b(\n {\n ['has-media']: hasRightSideImage,\n ['full-width']: fullWidth,\n ['media-view']: mediaView,\n ['controls-view']: textTheme,\n },\n className,\n )}\n >\n {backgroundThemed && fullWidth && <FullWidthBackground background={backgroundThemed} />}\n {backgroundThemed && <Background background={backgroundThemed} isMobile={isMobile} />}\n <Grid containerClass={b('container-fluid')}>\n {breadcrumbs && (\n <Row className={b('breadcrumbs')}>\n <Col>\n <HeaderBreadcrumbs {...breadcrumbs} theme={textTheme} />\n </Col>\n </Row>\n )}\n <Row>\n <Col reset className={b('content-wrapper')}>\n <Row>\n <Col\n className={b('content', {\n offset,\n theme: textTheme,\n 'vertical-offset': curVerticalOffset,\n })}\n >\n <Col sizes={titleSizes} className={b('content-inner', {centered})}>\n {overtitle && (\n <div className={b('overtitle')}>\n {typeof overtitle === 'string' ? (\n <YFMWrapper\n tagName=\"div\"\n className={b('overtitle')}\n content={overtitle}\n modifiers={{\n constructor: true,\n }}\n />\n ) : (\n overtitle\n )}\n </div>\n )}\n <YFMWrapper\n content={title}\n contentClassName={b('title')}\n className={b('title-container')}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n tagName=\"h1\"\n contentPosition=\"end\"\n >\n {status}\n {renderTitle ? renderTitle(title) : null}\n </YFMWrapper>\n {description && (\n <div className={b('description', {theme: textTheme})}>\n <YFMWrapper\n content={description}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {additionalInfo && (\n <div className={b('additional-info', {theme: textTheme})}>\n <YFMWrapper\n content={additionalInfo}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {buttons && (\n <div className={b('buttons')} data-qa=\"header-buttons\">\n {buttons.map((button, index) => (\n <RouterLink href={button.url} key={index}>\n <Button\n key={index}\n className={b('button')}\n size=\"xl\"\n extraProps={{\n 'aria-describedby': titleId,\n ...button.extraProps,\n }}\n {...button}\n />\n </RouterLink>\n ))}\n </div>\n )}\n {children}\n </Col>\n </Col>\n </Row>\n {hasRightSideImage && (\n <Media\n className={b('media', {[curImageSize]: true})}\n videoClassName={b('video')}\n imageClassName={b('image')}\n {...mediaWithMicrodata}\n />\n )}\n </Col>\n </Row>\n </Grid>\n </header>\n );\n};\n\nexport default HeaderBlock;\n"]}
1
+ {"version":3,"file":"Header.js","sourceRoot":"../../../../src","sources":["blocks/Header/Header.tsx"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAC,kCAAyB;AAC3D,OAAO,iBAAiB,gEAA6D;AACrF,OAAO,EAAC,aAAa,EAAC,8CAA2C;AACjE,OAAO,UAAU,kDAA+C;AAChE,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,4BAAmB;AAE1C,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,6BAAoB;AAClD,OAAO,EAAC,mBAAmB,EAAC,iCAA8B;AAE1D,OAAO,EAAC,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAC,mBAAgB;AACzE,OAAO,cAAc,CAAC;AACtB,OAAO,EAAC,cAAc,EAAC,kDAAyC;AAChE,OAAO,EAAC,WAAW,EAAC,2BAAwB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AAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5B,KAAC,UAAU,IAAC,IAAI,EAAE,MAAM,CAAC,GAAG,YACxB,KAAC,MAAM,IAEH,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,EACtB,IAAI,EAAC,IAAI,EACT,UAAU,EAAE;gEACR,kBAAkB,EAAE,OAAO;gEAC3B,GAAG,MAAM,CAAC,UAAU;6DACvB,KACG,MAAM,IAPL,KAAK,CAQZ,IAV6B,KAAK,CAW3B,CAChB,CAAC,GACA,CACT,EACA,QAAQ,IACP,GACJ,GACJ,EACL,iBAAiB,IAAI,CAClB,KAAC,KAAK,IACF,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAC,CAAC,EAC7C,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,EAC1B,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,KACtB,kBAAkB,GACxB,CACL,IACC,GACJ,IACH,IACF,CACZ,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport {useUniqId} from '@gravity-ui/uikit';\nimport * as React from 'react';\n\nimport {Button, Media, RouterLink} from '../../components';\nimport HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs/HeaderBreadcrumbs';\nimport {getMediaImage} from '../../components/Media/Image/utils';\nimport YFMWrapper from '../../components/YFMWrapper/YFMWrapper';\nimport {useTheme} from '../../context/theme';\nimport {Col, Grid, Row} from '../../grid';\nimport {ClassNameProps, HeaderBlockBackground, HeaderBlockProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport {mergeVideoMicrodata} from '../../utils/microdata';\n\nimport {getImageSize, getTitleSizes, titleWithImageSizes} from './utils';\nimport './Header.scss';\nimport {useWindowWidth} from '../../context/windowWidthContext';\nimport {BREAKPOINTS} from '../../constants';\n\nconst b = block('header-block');\n\nexport type HeaderBlockFullProps = HeaderBlockProps & ClassNameProps;\n\ninterface BackgroundProps {\n background: HeaderBlockBackground;\n isMobile: boolean;\n}\n\nconst Background = ({background, isMobile}: BackgroundProps) => {\n const {url, image, fullWidthMedia, video, color} = background;\n const imageObject = url ? getMediaImage(url) : image;\n const renderMedia = !isMobile || (typeof image === 'object' && 'mobile' in image);\n\n return (\n <div\n className={b('background', {media: true, 'full-width-media': fullWidthMedia})}\n style={{backgroundColor: color}}\n >\n {renderMedia && (\n <Media\n {...background}\n className={b('background-media')}\n imageClassName={b('image')}\n videoClassName={b('video')}\n isBackground={true}\n parallax={false}\n video={isMobile ? undefined : video}\n image={imageObject}\n />\n )}\n </div>\n );\n};\n\ninterface FullWidthBackgroundProps {\n background: HeaderBlockBackground;\n}\n\nconst FullWidthBackground = ({background}: FullWidthBackgroundProps) => (\n <div\n className={b('background', {['full-width']: true})}\n style={{backgroundColor: background?.color}}\n />\n);\n\nexport const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>) => {\n const {\n title,\n overtitle,\n description,\n buttons,\n image,\n video,\n width = 'm',\n imageSize,\n offset = 'default',\n background,\n theme: textTheme = 'light',\n verticalOffset = 'm',\n className,\n breadcrumbs,\n status,\n renderTitle,\n children,\n mediaView = 'full',\n centered,\n additionalInfo,\n } = props;\n const windowWidth = useWindowWidth();\n const isMobile = windowWidth <= BREAKPOINTS.sm;\n const theme = useTheme();\n const hasRightSideImage = Boolean((image || video) && !centered);\n const curImageSize = imageSize || getImageSize(width);\n const titleSizes = hasRightSideImage ? titleWithImageSizes(curImageSize) : getTitleSizes(width);\n let curVerticalOffset = verticalOffset;\n\n if (hasRightSideImage && !verticalOffset) {\n curVerticalOffset = 'm';\n }\n\n const backgroundThemed = background && getThemedValue(background, theme);\n const imageThemed = image && getThemedValue(image, theme);\n const videoThemed = video && getThemedValue(video, theme);\n const mediaWithMicrodata = mergeVideoMicrodata(\n {video: videoThemed, image: imageThemed},\n {name: title, description},\n );\n const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;\n const titleId = useUniqId();\n\n return (\n <header\n className={b(\n {\n ['has-media']: hasRightSideImage,\n ['full-width']: fullWidth,\n ['media-view']: mediaView,\n ['controls-view']: textTheme,\n },\n className,\n )}\n >\n {backgroundThemed && fullWidth && <FullWidthBackground background={backgroundThemed} />}\n {backgroundThemed && <Background background={backgroundThemed} isMobile={isMobile} />}\n <Grid containerClass={b('container-fluid')}>\n {breadcrumbs && (\n <Row className={b('breadcrumbs')}>\n <Col>\n <HeaderBreadcrumbs {...breadcrumbs} theme={textTheme} />\n </Col>\n </Row>\n )}\n <Row>\n <Col reset className={b('content-wrapper')}>\n <Row>\n <Col\n className={b('content', {\n offset,\n theme: textTheme,\n 'vertical-offset': curVerticalOffset,\n })}\n >\n <Col sizes={titleSizes} className={b('content-inner', {centered})}>\n {overtitle && (\n <div className={b('overtitle')}>\n {typeof overtitle === 'string' ? (\n <YFMWrapper\n tagName=\"div\"\n className={b('overtitle')}\n content={overtitle}\n modifiers={{constructor: true}}\n />\n ) : (\n overtitle\n )}\n </div>\n )}\n <YFMWrapper\n content={title}\n contentClassName={b('title')}\n className={b('title-container')}\n modifiers={{constructor: true, constructorTheme: textTheme}}\n tagName=\"h1\"\n contentPosition=\"end\"\n >\n {status}\n {renderTitle ? renderTitle(title) : null}\n </YFMWrapper>\n {description && (\n <div className={b('description', {theme: textTheme})}>\n <YFMWrapper\n content={description}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {additionalInfo && (\n <div className={b('additional-info', {theme: textTheme})}>\n <YFMWrapper\n content={additionalInfo}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {buttons && (\n <div className={b('buttons')} data-qa=\"header-buttons\">\n {buttons.map((button, index) => (\n <RouterLink href={button.url} key={index}>\n <Button\n key={index}\n className={b('button')}\n size=\"xl\"\n extraProps={{\n 'aria-describedby': titleId,\n ...button.extraProps,\n }}\n {...button}\n />\n </RouterLink>\n ))}\n </div>\n )}\n {children}\n </Col>\n </Col>\n </Row>\n {hasRightSideImage && (\n <Media\n className={b('media', {[curImageSize]: true})}\n videoClassName={b('video')}\n imageClassName={b('image')}\n {...mediaWithMicrodata}\n />\n )}\n </Col>\n </Row>\n </Grid>\n </header>\n );\n};\n\nexport default HeaderBlock;\n"]}
@@ -11,6 +11,7 @@ import { MobileContext } from "../../context/mobileContext/index.js";
11
11
  import { ProjectSettingsContext, } from "../../context/projectSettingsContext/index.js";
12
12
  import { SSRContext } from "../../context/ssrContext/index.js";
13
13
  import { ThemeContext } from "../../context/theme/index.js";
14
+ import { WindowWidthProvider } from "../../context/windowWidthContext/index.js";
14
15
  export const PageConstructorProvider = (props) => {
15
16
  const { isMobile, mapsContext = initialMapValue, locale = {}, location = {}, analytics = {}, ssrConfig = {}, projectSettings = {}, theme = DEFAULT_THEME, children, image = {}, forms = DEFAULT_FORMS_CONTEXT_VALUE, } = props;
16
17
  /* eslint-disable react/jsx-key */
@@ -25,6 +26,7 @@ export const PageConstructorProvider = (props) => {
25
26
  _jsx(AnalyticsContext.Provider, { value: analytics }),
26
27
  _jsx(FormsContext.Provider, { value: forms }),
27
28
  _jsx(SSRContext.Provider, { value: { isServer: ssrConfig?.isServer } }),
29
+ _jsx(WindowWidthProvider, {}),
28
30
  ].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);
29
31
  /* eslint-enable react/jsx-key */
30
32
  return _jsx(React.Fragment, { children: context });
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.js","sourceRoot":"../../../../src","sources":["containers/PageConstructor/Provider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,aAAa,EAAC,sCAAmC;AACzD,OAAO,EAAC,gBAAgB,EAAwB,gDAAuC;AACvF,OAAO,EACH,2BAA2B,EAC3B,YAAY,GAEf,mDAAgD;AACjD,OAAO,EAAC,YAAY,EAAoB,4CAAmC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AAQ,IAAC,KAAK,EAAE,KAAK,GAAI;QACvC,KAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAC,GAAI;KAClE,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;IACpF,iCAAiC;IAEjC,OAAO,KAAC,KAAK,CAAC,QAAQ,cAAE,OAAO,GAAkB,CAAC;AACtD,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {DEFAULT_THEME} from '../../components/constants';\nimport {AnalyticsContext, AnalyticsContextProps} from '../../context/analyticsContext';\nimport {\n DEFAULT_FORMS_CONTEXT_VALUE,\n FormsContext,\n FormsContextProps,\n} from '../../context/formsContext/FormsContext';\nimport {ImageContext, ImageContextProps} from '../../context/imageContext';\nimport {LocaleContext, LocaleContextProps} from '../../context/localeContext';\nimport {LocationContext, LocationContextProps} from '../../context/locationContext';\nimport {MapsContext, MapsContextType, initialMapValue} from '../../context/mapsContext/mapsContext';\nimport {MobileContext} from '../../context/mobileContext';\nimport {\n ProjectSettingsContext,\n ProjectSettingsContextProps,\n} from '../../context/projectSettingsContext';\nimport {SSRContext, SSRContextProps} from '../../context/ssrContext';\nimport {ThemeContext} from '../../context/theme';\nimport {Theme} from '../../models';\n\nexport interface PageConstructorProviderProps {\n isMobile?: boolean;\n locale?: LocaleContextProps;\n location?: LocationContextProps;\n ssrConfig?: SSRContextProps;\n theme?: Theme;\n mapsContext?: MapsContextType;\n projectSettings?: ProjectSettingsContextProps;\n analytics?: AnalyticsContextProps;\n forms?: FormsContextProps;\n image?: ImageContextProps;\n}\n\nexport const PageConstructorProvider = (\n props: React.PropsWithChildren<PageConstructorProviderProps>,\n) => {\n const {\n isMobile,\n mapsContext = initialMapValue,\n locale = {},\n location = {},\n analytics = {},\n ssrConfig = {},\n projectSettings = {},\n theme = DEFAULT_THEME,\n children,\n image = {},\n forms = DEFAULT_FORMS_CONTEXT_VALUE,\n } = props;\n\n /* eslint-disable react/jsx-key */\n const context = [\n <ThemeContext.Provider value={{theme}} />,\n <ProjectSettingsContext.Provider value={projectSettings} />,\n <LocaleContext.Provider value={locale} />,\n <ImageContext.Provider value={image} />,\n <LocationContext.Provider value={location} />,\n <MobileContext.Provider value={Boolean(isMobile)} />,\n <MapsContext.Provider value={mapsContext} />,\n <AnalyticsContext.Provider value={analytics} />,\n <FormsContext.Provider value={forms} />,\n <SSRContext.Provider value={{isServer: ssrConfig?.isServer}} />,\n ].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);\n /* eslint-enable react/jsx-key */\n\n return <React.Fragment>{context}</React.Fragment>;\n};\n"]}
1
+ {"version":3,"file":"Provider.js","sourceRoot":"../../../../src","sources":["containers/PageConstructor/Provider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,aAAa,EAAC,sCAAmC;AACzD,OAAO,EAAC,gBAAgB,EAAwB,gDAAuC;AACvF,OAAO,EACH,2BAA2B,EAC3B,YAAY,GAEf,mDAAgD;AACjD,OAAO,EAAC,YAAY,EAAoB,4CAAmC;AAC3E,OAAO,EAAC,aAAa,EAAqB,6CAAoC;AAC9E,OAAO,EAAC,eAAe,EAAuB,+CAAsC;AACpF,OAAO,EAAC,WAAW,EAAmB,eAAe,EAAC,iDAA8C;AACpG,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EACH,sBAAsB,GAEzB,sDAA6C;AAC9C,OAAO,EAAC,UAAU,EAAkB,0CAAiC;AACrE,OAAO,EAAC,YAAY,EAAC,qCAA4B;AAEjD,OAAO,EAAC,mBAAmB,EAAC,kDAAyC;AAerE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,KAA4D,EAC9D,EAAE;IACA,MAAM,EACF,QAAQ,EAC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kB,CAAC;AACtD,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {DEFAULT_THEME} from '../../components/constants';\nimport {AnalyticsContext, AnalyticsContextProps} from '../../context/analyticsContext';\nimport {\n DEFAULT_FORMS_CONTEXT_VALUE,\n FormsContext,\n FormsContextProps,\n} from '../../context/formsContext/FormsContext';\nimport {ImageContext, ImageContextProps} from '../../context/imageContext';\nimport {LocaleContext, LocaleContextProps} from '../../context/localeContext';\nimport {LocationContext, LocationContextProps} from '../../context/locationContext';\nimport {MapsContext, MapsContextType, initialMapValue} from '../../context/mapsContext/mapsContext';\nimport {MobileContext} from '../../context/mobileContext';\nimport {\n ProjectSettingsContext,\n ProjectSettingsContextProps,\n} from '../../context/projectSettingsContext';\nimport {SSRContext, SSRContextProps} from '../../context/ssrContext';\nimport {ThemeContext} from '../../context/theme';\nimport {Theme} from '../../models';\nimport {WindowWidthProvider} from '../../context/windowWidthContext';\n\nexport interface PageConstructorProviderProps {\n isMobile?: boolean;\n locale?: LocaleContextProps;\n location?: LocationContextProps;\n ssrConfig?: SSRContextProps;\n theme?: Theme;\n mapsContext?: MapsContextType;\n projectSettings?: ProjectSettingsContextProps;\n analytics?: AnalyticsContextProps;\n forms?: FormsContextProps;\n image?: ImageContextProps;\n}\n\nexport const PageConstructorProvider = (\n props: React.PropsWithChildren<PageConstructorProviderProps>,\n) => {\n const {\n isMobile,\n mapsContext = initialMapValue,\n locale = {},\n location = {},\n analytics = {},\n ssrConfig = {},\n projectSettings = {},\n theme = DEFAULT_THEME,\n children,\n image = {},\n forms = DEFAULT_FORMS_CONTEXT_VALUE,\n } = props;\n\n /* eslint-disable react/jsx-key */\n const context = [\n <ThemeContext.Provider value={{theme}} />,\n <ProjectSettingsContext.Provider value={projectSettings} />,\n <LocaleContext.Provider value={locale} />,\n <ImageContext.Provider value={image} />,\n <LocationContext.Provider value={location} />,\n <MobileContext.Provider value={Boolean(isMobile)} />,\n <MapsContext.Provider value={mapsContext} />,\n <AnalyticsContext.Provider value={analytics} />,\n <FormsContext.Provider value={forms} />,\n <SSRContext.Provider value={{isServer: ssrConfig?.isServer}} />,\n <WindowWidthProvider />,\n ].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);\n /* eslint-enable react/jsx-key */\n\n return <React.Fragment>{context}</React.Fragment>;\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ export declare const WindowWidthContext: React.Context<number>;
3
+ export declare const WindowWidthProvider: ({ children }: React.PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const useWindowWidth: () => number;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import throttle from "lodash/throttle.js";
4
+ import { SSRContext } from "../ssrContext/index.js";
5
+ import { BREAKPOINTS } from "../../constants.js";
6
+ const DEFAULT_WIDTH = BREAKPOINTS.xl;
7
+ const UPDATE_FREQUENCY_MS = 100;
8
+ export const WindowWidthContext = React.createContext(DEFAULT_WIDTH);
9
+ export const WindowWidthProvider = ({ children }) => {
10
+ const { isServer } = React.useContext(SSRContext);
11
+ const [windowWidth, setWindowWidth] = React.useState(DEFAULT_WIDTH);
12
+ React.useEffect(() => {
13
+ if (isServer) {
14
+ return;
15
+ }
16
+ const handleResize = throttle(() => {
17
+ setWindowWidth(window.innerWidth);
18
+ }, UPDATE_FREQUENCY_MS, { leading: true });
19
+ handleResize();
20
+ window.addEventListener('resize', handleResize, { passive: true });
21
+ // eslint-disable-next-line consistent-return
22
+ return () => window.removeEventListener('resize', handleResize);
23
+ }, [isServer]);
24
+ return (_jsx(WindowWidthContext.Provider, { value: windowWidth, children: children }));
25
+ };
26
+ export const useWindowWidth = () => React.useContext(WindowWidthContext);
27
+ //# sourceMappingURL=BreakpointContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BreakpointContext.js","sourceRoot":"../../../../src","sources":["context/windowWidthContext/BreakpointContext.tsx"],"names":[],"mappings":";AAAA,OAAO,KA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,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport throttle from 'lodash/throttle';\nimport {SSRContext} from '../ssrContext';\nimport {BREAKPOINTS} from '../../constants';\n\nconst DEFAULT_WIDTH = BREAKPOINTS.xl;\nconst UPDATE_FREQUENCY_MS = 100;\n\nexport const WindowWidthContext = React.createContext<number>(DEFAULT_WIDTH);\n\nexport const WindowWidthProvider = ({children}: React.PropsWithChildren) => {\n const {isServer} = React.useContext(SSRContext);\n\n const [windowWidth, setWindowWidth] = React.useState(DEFAULT_WIDTH);\n\n React.useEffect(() => {\n if (isServer) {\n return;\n }\n\n const handleResize = throttle(\n () => {\n setWindowWidth(window.innerWidth);\n },\n UPDATE_FREQUENCY_MS,\n {leading: true},\n );\n\n handleResize();\n\n window.addEventListener('resize', handleResize, {passive: true});\n\n // eslint-disable-next-line consistent-return\n return () => window.removeEventListener('resize', handleResize);\n }, [isServer]);\n\n return (\n <WindowWidthContext.Provider value={windowWidth}>{children}</WindowWidthContext.Provider>\n );\n};\n\nexport const useWindowWidth = () => React.useContext(WindowWidthContext);\n"]}
@@ -0,0 +1 @@
1
+ export * from "./BreakpointContext.js";
@@ -0,0 +1,2 @@
1
+ export * from "./BreakpointContext.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../../../../src","sources":["context/windowWidthContext/index.ts"],"names":[],"mappings":"AAAA,uCAAoC","sourcesContent":["export * from './BreakpointContext';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "7.4.0",
3
+ "version": "7.5.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
package/widget/index.js CHANGED
@@ -1 +1 @@
1
- export default "(self.webpackChunk_gravity_ui_page_constructor=self.webpackChunk_gravity_ui_page_constructor||[]).push([[5760],{5760:function(_,t,r){_.exports=function(_){\"use strict\";function t(_){return _&&\"object\"==typeof _&&\"default\"in _?_:{default:_}}var r=t(_),s={name:\"x-pseudo\",weekdays:\"S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý\".split(\"_\"),months:\"J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér\".split(\"_\"),weekStart:1,weekdaysShort:\"S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát\".split(\"_\"),monthsShort:\"J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc\".split(\"_\"),weekdaysMin:\"S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá\".split(\"_\"),ordinal:function(_){return _},formats:{LT:\"HH:mm\",LTS:\"HH:mm:ss\",L:\"DD/MM/YYYY\",LL:\"D MMMM YYYY\",LLL:\"D MMMM YYYY HH:mm\",LLLL:\"dddd, D MMMM YYYY HH:mm\"},relativeTime:{future:\"í~ñ %s\",past:\"%s á~gó\",s:\"á ~féw ~sécó~ñds\",m:\"á ~míñ~úté\",mm:\"%d m~íñú~tés\",h:\"á~ñ hó~úr\",hh:\"%d h~óúrs\",d:\"á ~dáý\",dd:\"%d d~áýs\",M:\"á ~móñ~th\",MM:\"%d m~óñt~hs\",y:\"á ~ýéár\",yy:\"%d ý~éárs\"}};return r.default.locale(s,null,!0),s}(r(74353))}}]);";
1
+ export default "(self.webpackChunk_gravity_ui_page_constructor=self.webpackChunk_gravity_ui_page_constructor||[]).push([[6007],{56007:function(_,t,e){_.exports=function(_){\"use strict\";function t(_){return _&&\"object\"==typeof _&&\"default\"in _?_:{default:_}}var e=t(_),Y={name:\"zh\",weekdays:\"星期日_星期一_星期二_星期三_星期四_星期五_星期六\".split(\"_\"),weekdaysShort:\"周日_周一_周二_周三_周四_周五_周六\".split(\"_\"),weekdaysMin:\"_____五_六\".split(\"_\"),months:\"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月\".split(\"_\"),monthsShort:\"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月\".split(\"_\"),ordinal:function(_,t){return\"W\"===t?_+\"周\":_+\"日\"},weekStart:1,yearStart:4,formats:{LT:\"HH:mm\",LTS:\"HH:mm:ss\",L:\"YYYY/MM/DD\",LL:\"YYYY年M月D日\",LLL:\"YYYY年M月D日Ah点mm分\",LLLL:\"YYYY年M月D日ddddAh点mm分\",l:\"YYYY/M/D\",ll:\"YYYY年M月D日\",lll:\"YYYY年M月D日 HH:mm\",llll:\"YYYY年M月D日dddd HH:mm\"},relativeTime:{future:\"%s后\",past:\"%s前\",s:\"几秒\",m:\"1 分钟\",mm:\"%d 分钟\",h:\"1 小时\",hh:\"%d 小时\",d:\"1 天\",dd:\"%d 天\",M:\"1 个月\",MM:\"%d 个月\",y:\"1 年\",yy:\"%d 年\"},meridiem:function(_,t){var e=100*_+t;return e<600?\"凌晨\":e<900?\"早上\":e<1100?\"上午\":e<1300?\"中午\":e<1800?\"下午\":\"晚上\"}};return e.default.locale(Y,null,!0),Y}(e(74353))}}]);";